@fern-api/php-dynamic-snippets 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,8 @@ declare class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<
9
9
  ir: FernIr.dynamic.DynamicIntermediateRepresentation;
10
10
  config: FernGeneratorExec.GeneratorConfig;
11
11
  });
12
+ generate(request: FernIr.dynamic.EndpointSnippetRequest): Promise<FernIr.dynamic.EndpointSnippetResponse>;
13
+ generateSync(request: FernIr.dynamic.EndpointSnippetRequest): FernIr.dynamic.EndpointSnippetResponse;
12
14
  protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator;
13
15
  }
14
16
 
@@ -1 +1 @@
1
- import{a}from"./chunk-RYQOC3FW.js";import"./chunk-MMCQWL5J.js";import"./chunk-BGMLQMW7.js";import"./chunk-G6X3OBKW.js";import"./chunk-7HKG5U5F.js";import"./chunk-YELOIV6Y.js";import"./chunk-ZFTBBCKC.js";export{a as DynamicSnippetsGenerator};
1
+ import{a}from"./chunk-HG5P4KWD.js";import"./chunk-KYYOS3EX.js";import"./chunk-ZDJ3DR2Z.js";import"./chunk-JFJ3XGKL.js";import"./chunk-NXDI62IP.js";import"./chunk-HHDXN7HB.js";import"./chunk-LHXTVBUM.js";export{a as DynamicSnippetsGenerator};
@@ -1 +1 @@
1
- import{a}from"./chunk-MMCQWL5J.js";import"./chunk-7HKG5U5F.js";import"./chunk-ZFTBBCKC.js";export{a as EndpointSnippetGenerator};
1
+ import{a}from"./chunk-KYYOS3EX.js";import"./chunk-NXDI62IP.js";import"./chunk-LHXTVBUM.js";export{a as EndpointSnippetGenerator};
@@ -0,0 +1 @@
1
+ import{a as p}from"./chunk-KYYOS3EX.js";import{a as i}from"./chunk-ZDJ3DR2Z.js";import{a as t}from"./chunk-NXDI62IP.js";import{k as n,m as r}from"./chunk-LHXTVBUM.js";n();r();var o=class extends t{constructor({ir:e,config:a}){super(new i({ir:e,config:a}))}async generate(e){return super.generate(e)}generateSync(e){return super.generateSync(e)}createSnippetGenerator(e){return new p({context:e})}};export{o as a};
@@ -1 +1 @@
1
- import{j as l,k as a,m as y,n as s,p as i}from"./chunk-ZFTBBCKC.js";a();y();var c=class{constructor({context:r}){l(this,"context");this.context=r}getFilePropertyInfo({body:r,value:o}){var p;let e={fileFields:[],bodyPropertyFields:[]},n=(p=this.context.getRecord(o))!=null?p:{};for(let t of r.properties)switch(t.type){case"file":e.fileFields.push({name:this.context.getPropertyName(t.name),value:this.getSingleFileProperty({property:t,record:n})});break;case"fileArray":e.fileFields.push({name:this.context.getPropertyName(t.name),value:this.getArrayFileProperty({property:t,record:n})});break;case"bodyProperty":e.bodyPropertyFields.push({name:this.context.getPropertyName(t.name.name),value:this.getBodyProperty({property:t,record:n})});break;default:s(t)}return e}getSingleFileProperty({property:r,record:o}){let e=this.context.getSingleFileValue({property:r,record:o});return e==null?i.TypeLiteral.nop():i.TypeLiteral.file(e)}getArrayFileProperty({property:r,record:o}){let e=this.context.getFileArrayValues({property:r,record:o});return e==null?i.TypeLiteral.nop():i.TypeLiteral.list({values:e.map(n=>i.TypeLiteral.file(n))})}getBodyProperty({property:r,record:o}){let e=o[r.name.wireValue];return e==null?i.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:r.typeReference,value:e})}};export{c as a};
1
+ import{j as l,k as a,m as y,n as s,p as i}from"./chunk-LHXTVBUM.js";a();y();var c=class{constructor({context:r}){l(this,"context");this.context=r}getFilePropertyInfo({body:r,value:o}){var p;let e={fileFields:[],bodyPropertyFields:[]},n=(p=this.context.getRecord(o))!=null?p:{};for(let t of r.properties)switch(t.type){case"file":e.fileFields.push({name:this.context.getPropertyName(t.name),value:this.getSingleFileProperty({property:t,record:n})});break;case"fileArray":e.fileFields.push({name:this.context.getPropertyName(t.name),value:this.getArrayFileProperty({property:t,record:n})});break;case"bodyProperty":e.bodyPropertyFields.push({name:this.context.getPropertyName(t.name.name),value:this.getBodyProperty({property:t,record:n})});break;default:s(t)}return e}getSingleFileProperty({property:r,record:o}){let e=this.context.getSingleFileValue({property:r,record:o});return e==null?i.TypeLiteral.nop():i.TypeLiteral.file(e)}getArrayFileProperty({property:r,record:o}){let e=this.context.getFileArrayValues({property:r,record:o});return e==null?i.TypeLiteral.nop():i.TypeLiteral.list({values:e.map(n=>i.TypeLiteral.file(n))})}getBodyProperty({property:r,record:o}){let e=o[r.name.wireValue];return e==null?i.TypeLiteral.nop():this.context.dynamicTypeLiteralMapper.convert({typeReference:r.typeReference,value:e})}};export{c as a};
@@ -1 +1 @@
1
- import{b as a}from"./chunk-7HKG5U5F.js";import{j as c,k as p,m as l,n as o,p as r}from"./chunk-ZFTBBCKC.js";p();l();var u=class{constructor({context:e}){c(this,"context");this.context=e}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?r.TypeLiteral.null():(this.context.errors.add({severity:a.Critical,message:"Expected non-null value, but got null"}),r.TypeLiteral.nop());if(e.value===void 0)return r.TypeLiteral.nop();switch(e.typeReference.type){case"list":case"set":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return this.convertLiteral({literalType:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?r.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as})}case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"unknown":return this.convertUnknown({value:e.value});default:o(e.typeReference)}}convertLiteral({literalType:e,value:t}){switch(e.type){case"boolean":{let n=this.context.getValueAsBoolean({value:t});return n==null?r.TypeLiteral.nop():r.TypeLiteral.boolean(n)}case"string":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeLiteral.nop():r.TypeLiteral.string(n)}default:o(e)}}convertList({list:e,value:t}){return Array.isArray(t)?r.TypeLiteral.list({values:t.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:e,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:a.Critical,message:`Expected array but got: ${typeof t}`}),r.TypeLiteral.nop())}convertMap({map:e,value:t}){return typeof t!="object"||t==null?(this.context.errors.add({severity:a.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),r.TypeLiteral.nop()):r.TypeLiteral.map({entries:Object.entries(t).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:e.key,value:n,as:"key"}),value:this.convert({typeReference:e.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:n}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:o(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){return r.TypeLiteral.string("todo")}convertObject({object_:e,value:t}){var i;let n=this.context.associateByWireValue({parameters:e.properties,values:(i=this.context.getRecord(t))!=null?i:{}});return r.TypeLiteral.class_({reference:r.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getTypesNamespace(e.declaration.fernFilepath)}),fields:n.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyName(s.name.name),value:this.convert(s)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:t}){let n=this.getEnumValueName({enum_:e,value:t});return n==null?r.TypeLiteral.nop():r.TypeLiteral.reference(r.codeblock(i=>{i.writeNode(r.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getTypesNamespace(e.declaration.fernFilepath)})),i.write("::"),i.write(n),i.write("->value")}))}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:a.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let n=e.values.find(i=>i.wireValue===t);if(n==null){this.context.errors.add({severity:a.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return this.context.getClassName(n.name)}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return n==null?r.TypeLiteral.nop():n}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){for(let n of e.types)try{return this.convert({typeReference:n,value:t})}catch(i){continue}this.context.errors.add({severity:a.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}convertUnknown({value:e}){return r.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:n}){switch(e){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:t,as:n});return i==null?r.TypeLiteral.nop():r.TypeLiteral.number(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:t});return i==null?r.TypeLiteral.nop():r.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:t,as:n});return i==null?r.TypeLiteral.nop():r.TypeLiteral.boolean(i)}case"DATE":case"DATE_TIME":{let i=this.context.getValueAsString({value:t});return i==null?r.TypeLiteral.nop():r.TypeLiteral.datetime(i)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:t});return i==null?r.TypeLiteral.nop():r.TypeLiteral.string(i)}default:o(e)}}getValueAsNumber({value:e,as:t}){let n=t==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:e,as:t}){let n=t==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:n})}};export{u as a};
1
+ import{b as a}from"./chunk-NXDI62IP.js";import{j as c,k as p,m as l,n as o,p as r}from"./chunk-LHXTVBUM.js";p();l();var u=class{constructor({context:e}){c(this,"context");this.context=e}convert(e){if(e.value===null)return this.context.isNullable(e.typeReference)?r.TypeLiteral.null():(this.context.errors.add({severity:a.Critical,message:"Expected non-null value, but got null"}),r.TypeLiteral.nop());if(e.value===void 0)return r.TypeLiteral.nop();switch(e.typeReference.type){case"list":case"set":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return this.convertLiteral({literalType:e.typeReference.value,value:e.value});case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let t=this.context.resolveNamedType({typeId:e.typeReference.value});return t==null?r.TypeLiteral.nop():this.convertNamed({named:t,value:e.value,as:e.as})}case"optional":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"nullable":return this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as});case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"unknown":return this.convertUnknown({value:e.value});default:o(e.typeReference)}}convertLiteral({literalType:e,value:t}){switch(e.type){case"boolean":{let n=this.context.getValueAsBoolean({value:t});return n==null?r.TypeLiteral.nop():r.TypeLiteral.boolean(n)}case"string":{let n=this.context.getValueAsString({value:t});return n==null?r.TypeLiteral.nop():r.TypeLiteral.string(n)}default:o(e)}}convertList({list:e,value:t}){return Array.isArray(t)?r.TypeLiteral.list({values:t.map((n,i)=>{this.context.errors.scope({index:i});try{return this.convert({typeReference:e,value:n})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:a.Critical,message:`Expected array but got: ${typeof t}`}),r.TypeLiteral.nop())}convertMap({map:e,value:t}){return typeof t!="object"||t==null?(this.context.errors.add({severity:a.Critical,message:`Expected object but got: ${t==null?"null":typeof t}`}),r.TypeLiteral.nop()):r.TypeLiteral.map({entries:Object.entries(t).map(([n,i])=>{this.context.errors.scope(n);try{return{key:this.convert({typeReference:e.key,value:n,as:"key"}),value:this.convert({typeReference:e.value,value:i})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:t,as:n}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:t,as:n});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:t});case"enum":return this.convertEnum({enum_:e,value:t});case"object":return this.convertObject({object_:e,value:t});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t});default:o(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:t}){return r.TypeLiteral.string("todo")}convertObject({object_:e,value:t}){var i;let n=this.context.associateByWireValue({parameters:e.properties,values:(i=this.context.getRecord(t))!=null?i:{}});return r.TypeLiteral.class_({reference:r.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getTypesNamespace(e.declaration.fernFilepath)}),fields:n.map(s=>{this.context.errors.scope(s.name.wireValue);try{return{name:this.context.getPropertyName(s.name.name),value:this.convert(s)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:t}){let n=this.getEnumValueName({enum_:e,value:t});return n==null?r.TypeLiteral.nop():r.TypeLiteral.reference(r.codeblock(i=>{i.writeNode(r.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getTypesNamespace(e.declaration.fernFilepath)})),i.write("::"),i.write(n),i.write("->value")}))}getEnumValueName({enum_:e,value:t}){if(typeof t!="string"){this.context.errors.add({severity:a.Critical,message:`Expected enum value string, got: ${typeof t}`});return}let n=e.values.find(i=>i.wireValue===t);if(n==null){this.context.errors.add({severity:a.Critical,message:`An enum value named "${t}" does not exist in this context`});return}return this.context.getClassName(n.name)}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:t}){let n=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t});return n==null?r.TypeLiteral.nop():n}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:t}){for(let n of e.types)try{return this.convert({typeReference:n,value:t})}catch(i){continue}this.context.errors.add({severity:a.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof t}" value`})}convertUnknown({value:e}){return r.TypeLiteral.unknown(e)}convertPrimitive({primitive:e,value:t,as:n}){switch(e){case"INTEGER":case"LONG":case"UINT":case"UINT_64":{let i=this.getValueAsNumber({value:t,as:n});return i==null?r.TypeLiteral.nop():r.TypeLiteral.number(i)}case"FLOAT":case"DOUBLE":{let i=this.getValueAsNumber({value:t});return i==null?r.TypeLiteral.nop():r.TypeLiteral.float(i)}case"BOOLEAN":{let i=this.getValueAsBoolean({value:t,as:n});return i==null?r.TypeLiteral.nop():r.TypeLiteral.boolean(i)}case"DATE":case"DATE_TIME":{let i=this.context.getValueAsString({value:t});return i==null?r.TypeLiteral.nop():r.TypeLiteral.datetime(i)}case"BASE_64":case"UUID":case"BIG_INTEGER":case"STRING":{let i=this.context.getValueAsString({value:t});return i==null?r.TypeLiteral.nop():r.TypeLiteral.string(i)}default:o(e)}}getValueAsNumber({value:e,as:t}){let n=t==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:n})}getValueAsBoolean({value:e,as:t}){let n=t==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:n})}};export{u as a};
@@ -1,3 +1,3 @@
1
- import{b as o,d as p}from"./chunk-7HKG5U5F.js";import{j as f,k as F,m as P,n as c,p as s}from"./chunk-ZFTBBCKC.js";F();P();var v="$client",u="Example",I=`<?php
1
+ import{b as o,d as p}from"./chunk-NXDI62IP.js";import{j as P,k as v,m as x,n as c,p as s}from"./chunk-LHXTVBUM.js";v();x();var I="$client",l="Example",R=`<?php
2
2
 
3
- `,x=class{constructor({context:e}){f(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){var n;let r=this.buildCodeBlock({endpoint:e,snippet:t});return I+await r.toStringAsync({namespace:u,rootNamespace:u,customConfig:(n=this.context.customConfig)!=null?n:{}})}generateSnippetSync({endpoint:e,request:t}){var n;let r=this.buildCodeBlock({endpoint:e,snippet:t});return I+r.toString({namespace:u,rootNamespace:u,customConfig:(n=this.context.customConfig)!=null?n:{}})}buildCodeBlock({endpoint:e,snippet:t}){return s.codeblock(r=>{r.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),r.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})}constructClient({endpoint:e,snippet:t}){return s.codeblock(r=>{r.write(`${v} = `),r.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){return s.invokeMethod({on:s.codeblock(v),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}),multiline:!0})}getConstructorArgs({endpoint:e,snippet:t}){let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:o.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let n=[],a=this.getConstructorBaseUrlArgs({baseUrl:t.baseURL,environment:t.environment});return a.length>0&&n.push(...a),this.context.errors.scope(p.Headers),this.context.ir.headers!=null&&t.headers!=null&&n.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),n.length===0?r:[...r,{name:"options",assignment:s.TypeLiteral.map({entries:n.map(i=>({key:s.TypeLiteral.string(i.name),value:i.value}))})}]}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorBasicAuthArgs({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});default:c(e)}}getConstructorBasicAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),assignment:s.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),assignment:s.TypeLiteral.string(t.password)}]}getConstructorBaseUrlArgs({baseUrl:e,environment:t}){let r=this.getBaseUrlArg({baseUrl:e,environment:t});return s.TypeLiteral.isNop(r)?[]:[{name:"baseUrl",value:r}]}getBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null)return this.context.errors.add({severity:o.Critical,message:"Cannot specify both baseUrl and environment options"}),s.TypeLiteral.nop();if(e!=null)return s.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentClassAccessFromID(t);return r==null?(this.context.errors.add({severity:o.Warning,message:`Environment ${JSON.stringify(t)} was not found`}),s.TypeLiteral.nop()):s.TypeLiteral.reference(s.codeblock(n=>{n.writeNode(r),n.write("->value")}))}this.context.isMultiEnvironmentValues(t)&&this.context.errors.add({severity:o.Warning,message:"The PHP SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}return s.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),assignment:s.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let n of e){let a=this.getConstructorHeaderArg({header:n,value:t.value});a!=null&&r.push({name:this.context.getPropertyName(n.name.name),value:a})}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!s.TypeLiteral.isNop(r))return r}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:c(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];if(this.context.errors.scope(p.PathParameters),e.pathParameters!=null){let n=this.getPathParameters({namedParameters:e.pathParameters,snippet:t});r.push(...n.map(a=>a.value))}return this.context.errors.unscope(),this.context.errors.scope(p.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:c(e)}}getBytesBodyRequestArg({value:e}){return this.context.errors.add({severity:o.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),s.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:e,snippet:t}){let r=[];this.context.errors.scope(p.PathParameters);let a=[];e.pathParameters!=null&&a.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(p.RequestBody);let i=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:!1})||r.push(...a.map(l=>l.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:!1,inlineFileProperties:!0})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:!1})?a:[],filePropertyInfo:i})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:n}){var h,m,y,g;this.context.errors.scope(p.QueryParameters);let i=this.context.associateQueryParametersByWireValue({parameters:(h=e.queryParameters)!=null?h:[],values:(m=t.queryParameters)!=null?m:{}}).map(d=>({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert(d)}));this.context.errors.unscope(),this.context.errors.scope(p.Headers);let R=this.context.associateByWireValue({parameters:(y=e.headers)!=null?y:[],values:(g=t.headers)!=null?g:{}}).map(d=>({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert(d)}));this.context.errors.unscope(),this.context.errors.scope(p.RequestBody);let A=e.body!=null?this.getInlinedRequestBodyConstructorFields({body:e.body,value:t.requestBody,filePropertyInfo:n}):[];return this.context.errors.unscope(),s.TypeLiteral.class_({reference:s.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getRequestNamespace(e.declaration.fernFilepath)}),fields:[...r,...i,...R,...A]})}getInlinedRequestBodyConstructorFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:r});default:c(e)}}getFileUploadRequestBodyConstructorFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:c(e)}}getInlinedRequestBodyPropertyConstructorFields({parameters:e,value:t}){var a;let r=[],n=this.context.associateByWireValue({parameters:e,values:(a=this.context.getRecord(t))!=null?a:{}});for(let i of n)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getPathParameters({namedParameters:e,snippet:t}){var a;let r=[],n=this.context.associateByWireValue({parameters:e,values:(a=t.pathParameters)!=null?a:{}});for(let i of n)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getPropertyName(t)).join("->")}->${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getRootClientClassInstantiation(e){return s.instantiateClass({classReference:s.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:e,multiline:!0})}};export{x as a};
3
+ `,A=class{constructor({context:e}){P(this,"context");this.context=e}async generateSnippet({endpoint:e,request:t}){var n;let r=this.buildCodeBlock({endpoint:e,snippet:t});return R+await r.toStringAsync({namespace:l,rootNamespace:l,customConfig:(n=this.context.customConfig)!=null?n:{}})}generateSnippetSync({endpoint:e,request:t}){var n;let r=this.buildCodeBlock({endpoint:e,snippet:t});return R+r.toString({namespace:l,rootNamespace:l,customConfig:(n=this.context.customConfig)!=null?n:{}})}buildCodeBlock({endpoint:e,snippet:t}){return s.codeblock(r=>{r.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),r.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))})}constructClient({endpoint:e,snippet:t}){return s.codeblock(r=>{r.write(`${I} = `),r.writeNode(this.getRootClientClassInstantiation(this.getConstructorArgs({endpoint:e,snippet:t})))})}callMethod({endpoint:e,snippet:t}){return s.invokeMethod({on:s.codeblock(I),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t}),multiline:!0})}getConstructorArgs({endpoint:e,snippet:t}){let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getConstructorAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:o.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let n=[],a=this.getConstructorBaseUrlArgs({baseUrl:t.baseURL,environment:t.environment});return a.length>0&&n.push(...a),this.context.errors.scope(p.Headers),this.context.ir.headers!=null&&t.headers!=null&&n.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope(),n.length===0?r:[...r,{name:"options",assignment:s.TypeLiteral.map({entries:n.map(i=>({key:s.TypeLiteral.string(i.name),value:i.value}))})}]}getConstructorAuthArgs({auth:e,values:t}){switch(e.type){case"basic":return t.type!=="basic"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorBasicAuthArgs({auth:e,values:t});case"bearer":return t.type!=="bearer"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorBearerAuthArgs({auth:e,values:t});case"header":return t.type!=="header"?(this.context.errors.add({severity:o.Critical,message:this.context.newAuthMismatchError({auth:e,values:t}).message}),[]):this.getConstructorHeaderAuthArgs({auth:e,values:t});default:c(e)}}getConstructorBasicAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.username),assignment:s.TypeLiteral.string(t.username)},{name:this.context.getPropertyName(e.password),assignment:s.TypeLiteral.string(t.password)}]}getConstructorBaseUrlArgs({baseUrl:e,environment:t}){let r=this.getBaseUrlArg({baseUrl:e,environment:t});return s.TypeLiteral.isNop(r)?[]:[{name:"baseUrl",value:r}]}getBaseUrlArg({baseUrl:e,environment:t}){if(e!=null&&t!=null)return this.context.errors.add({severity:o.Critical,message:"Cannot specify both baseUrl and environment options"}),s.TypeLiteral.nop();if(e!=null)return s.TypeLiteral.string(e);if(t!=null){if(this.context.isSingleEnvironmentID(t)){let r=this.context.getEnvironmentClassAccessFromID(t);return r==null?(this.context.errors.add({severity:o.Warning,message:`Environment ${JSON.stringify(t)} was not found`}),s.TypeLiteral.nop()):s.TypeLiteral.reference(s.codeblock(n=>{n.writeNode(r),n.write("->value")}))}this.context.isMultiEnvironmentValues(t)&&this.context.errors.add({severity:o.Warning,message:"The PHP SDK doesn't support a multi-environment client option yet; use the baseUrl option instead"})}return s.TypeLiteral.nop()}getConstructorBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.token),assignment:s.TypeLiteral.string(t.token)}]}getConstructorHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getPropertyName(e.header.name.name),assignment:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getConstructorHeaderArgs({headers:e,values:t}){let r=[];for(let n of e){let a=this.getConstructorHeaderArg({header:n,value:t.value});a!=null&&r.push({name:this.context.getPropertyName(n.name.name),value:a})}return r}getConstructorHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!s.TypeLiteral.isNop(r))return r}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:c(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){let r=[];if(this.context.errors.scope(p.PathParameters),e.pathParameters!=null){let n=this.getPathParameters({namedParameters:e.pathParameters,snippet:t});r.push(...n.map(a=>a.value))}return this.context.errors.unscope(),this.context.errors.scope(p.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope(),r}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:c(e)}}getBytesBodyRequestArg({value:e}){return this.context.errors.add({severity:o.Critical,message:"The PHP SDK doesn't support bytes requests yet"}),s.TypeLiteral.nop()}getMethodArgsForInlinedRequest({request:e,snippet:t}){var h,u;let r=[],n=(u=(h=this.context.customConfig)==null?void 0:h.inlinePathParameters)!=null?u:!1;this.context.errors.scope(p.PathParameters);let a=[];e.pathParameters!=null&&a.push(...this.getPathParameters({namedParameters:e.pathParameters,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(p.RequestBody);let i=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:n})||r.push(...a.map(m=>m.value)),this.context.needsRequestParameter({request:e,inlinePathParameters:n,inlineFileProperties:!0})&&r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:n})?a:[],filePropertyInfo:i})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:n}){var y,g,f,F;this.context.errors.scope(p.QueryParameters);let i=this.context.associateQueryParametersByWireValue({parameters:(y=e.queryParameters)!=null?y:[],values:(g=t.queryParameters)!=null?g:{}}).map(d=>({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert(d)}));this.context.errors.unscope(),this.context.errors.scope(p.Headers);let u=this.context.associateByWireValue({parameters:(f=e.headers)!=null?f:[],values:(F=t.headers)!=null?F:{}}).map(d=>({name:this.context.getPropertyName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert(d)}));this.context.errors.unscope(),this.context.errors.scope(p.RequestBody);let m=e.body!=null?this.getInlinedRequestBodyConstructorFields({body:e.body,value:t.requestBody,filePropertyInfo:n}):[];return this.context.errors.unscope(),s.TypeLiteral.class_({reference:s.classReference({name:this.context.getClassName(e.declaration.name),namespace:this.context.getRequestNamespace(e.declaration.fernFilepath)}),fields:[...r,...i,...u,...m]})}getInlinedRequestBodyConstructorFields({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:r});default:c(e)}}getFileUploadRequestBodyConstructorFields({filePropertyInfo:e}){return[...e.fileFields,...e.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:e,value:t}){return{name:this.context.getPropertyName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t});default:c(e)}}getInlinedRequestBodyPropertyConstructorFields({parameters:e,value:t}){var a;let r=[],n=this.context.associateByWireValue({parameters:e,values:(a=this.context.getRecord(t))!=null?a:{}});for(let i of n)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getPathParameters({namedParameters:e,snippet:t}){var a;let r=[],n=this.context.associateByWireValue({parameters:e,values:(a=t.pathParameters)!=null?a:{}});for(let i of n)r.push({name:this.context.getPropertyName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>this.context.getPropertyName(t)).join("->")}->${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getRootClientClassInstantiation(e){return s.instantiateClass({classReference:s.classReference({name:this.context.getRootClientClassName(),namespace:this.context.rootNamespace}),arguments_:e,multiline:!0})}};export{A as a};
@@ -0,0 +1,28 @@
1
+ var ct=Object.create;var se=Object.defineProperty,ht=Object.defineProperties,lt=Object.getOwnPropertyDescriptor,pt=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertyNames,he=Object.getOwnPropertySymbols,dt=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty,Se=Object.prototype.propertyIsEnumerable;var Ne=(r,t,e)=>t in r?se(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,le=(r,t)=>{for(var e in t||(t={}))ve.call(t,e)&&Ne(r,e,t[e]);if(he)for(var e of he(t))Se.call(t,e)&&Ne(r,e,t[e]);return r},pe=(r,t)=>ht(r,pt(t));var qr=r=>typeof r=="symbol"?r:r+"",Hr=(r,t)=>{var e={};for(var n in r)ve.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&he)for(var n of he(r))t.indexOf(n)<0&&Se.call(r,n)&&(e[n]=r[n]);return e};var Le=(r,t)=>()=>(r&&(t=r(r=0)),t);var Qr=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),wt=(r,t)=>{for(var e in t)se(r,e,{get:t[e],enumerable:!0})},Ce=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mt(t))!ve.call(r,i)&&i!==e&&se(r,i,{get:()=>t[i],enumerable:!(n=lt(t,i))||n.enumerable});return r};var Xr=(r,t,e)=>(e=r!=null?ct(dt(r)):{},Ce(t||!r||!r.__esModule?se(e,"default",{value:r,enumerable:!0}):e,r)),Zr=r=>Ce(se({},"__esModule",{value:!0}),r);var f=(r,t,e)=>Ne(r,typeof t!="symbol"?t+"":t,e);function Ue(){throw new Error("setTimeout has not been defined")}function Me(){throw new Error("clearTimeout has not been defined")}function Pe(r){if(D===setTimeout)return setTimeout(r,0);if((D===Ue||!D)&&setTimeout)return D=setTimeout,setTimeout(r,0);try{return D(r,0)}catch(t){try{return D.call(null,r,0)}catch(e){return D.call(this,r,0)}}}function xt(r){if($===clearTimeout)return clearTimeout(r);if(($===Me||!$)&&clearTimeout)return $=clearTimeout,clearTimeout(r);try{return $(r)}catch(t){try{return $.call(null,r)}catch(e){return $.call(this,r)}}}function yt(){!ie||!G||(ie=!1,G.length?b=G.concat(b):me=-1,b.length&&De())}function De(){if(!ie){var r=Pe(yt);ie=!0;for(var t=b.length;t;){for(G=b,b=[];++me<t;)G&&G[me].run();me=-1,t=b.length}G=null,ie=!1,xt(r)}}function gt(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];b.push(new $e(r,t)),b.length===1&&!ie&&Pe(De)}function $e(r,t){this.fun=r,this.array=t}function J(){}function Pt(r){throw new Error("process.binding is not supported")}function Dt(){return"/"}function $t(r){throw new Error("process.chdir is not supported")}function Yt(){return 0}function Ft(r){var t=Ot.call(ne)*.001,e=Math.floor(t),n=Math.floor(t%1*1e9);return r&&(e=e-r[0],n=n-r[1],n<0&&(e--,n+=1e9)),[e,n]}function Vt(){var r=new Date,t=r-Wt;return t/1e3}var D,$,b,ie,G,me,Tt,At,Et,Nt,vt,Lt,_t,Rt,It,kt,bt,St,Ct,Bt,Ut,Mt,ne,Ot,Wt,d,Be,u=Le(()=>{"use strict";D=Ue,$=Me;typeof globalThis.setTimeout=="function"&&(D=setTimeout);typeof globalThis.clearTimeout=="function"&&($=clearTimeout);b=[],ie=!1,me=-1;$e.prototype.run=function(){this.fun.apply(null,this.array)};Tt="browser",At="browser",Et=!0,Nt={},vt=[],Lt="",_t={},Rt={},It={};kt=J,bt=J,St=J,Ct=J,Bt=J,Ut=J,Mt=J;ne=globalThis.performance||{},Ot=ne.now||ne.mozNow||ne.msNow||ne.oNow||ne.webkitNow||function(){return new Date().getTime()};Wt=new Date;d={nextTick:gt,title:Tt,browser:Et,env:Nt,argv:vt,version:Lt,versions:_t,on:kt,addListener:bt,once:St,off:Ct,removeListener:Bt,removeAllListeners:Ut,emit:Mt,binding:Pt,cwd:Dt,chdir:$t,umask:Yt,hrtime:Ft,platform:At,release:Rt,config:It,uptime:Vt},Be={};Object.keys(Be).forEach(r=>{let t=r.split("."),e=d;for(let n=0;n<t.length;n++){let i=t[n];n===t.length-1?e[i]=Be[r]:e=e[i]||(e[i]={})}})});function We(){Re=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=r.length;t<e;++t)R[t]=r[t],v[r.charCodeAt(t)]=t;v[45]=62,v[95]=63}function Gt(r){Re||We();var t,e,n,i,o,s,h=r.length;if(h%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o=r[h-2]==="="?2:r[h-1]==="="?1:0,s=new zt(h*3/4-o),n=o>0?h-4:h;var l=0;for(t=0,e=0;t<n;t+=4,e+=3)i=v[r.charCodeAt(t)]<<18|v[r.charCodeAt(t+1)]<<12|v[r.charCodeAt(t+2)]<<6|v[r.charCodeAt(t+3)],s[l++]=i>>16&255,s[l++]=i>>8&255,s[l++]=i&255;return o===2?(i=v[r.charCodeAt(t)]<<2|v[r.charCodeAt(t+1)]>>4,s[l++]=i&255):o===1&&(i=v[r.charCodeAt(t)]<<10|v[r.charCodeAt(t+1)]<<4|v[r.charCodeAt(t+2)]>>2,s[l++]=i>>8&255,s[l++]=i&255),s}function Jt(r){return R[r>>18&63]+R[r>>12&63]+R[r>>6&63]+R[r&63]}function qt(r,t,e){for(var n,i=[],o=t;o<e;o+=3)n=(r[o]<<16)+(r[o+1]<<8)+r[o+2],i.push(Jt(n));return i.join("")}function Ye(r){Re||We();for(var t,e=r.length,n=e%3,i="",o=[],s=16383,h=0,l=e-n;h<l;h+=s)o.push(qt(r,h,h+s>l?l:h+s));return n===1?(t=r[e-1],i+=R[t>>2],i+=R[t<<4&63],i+="=="):n===2&&(t=(r[e-2]<<8)+r[e-1],i+=R[t>>10],i+=R[t>>4&63],i+=R[t<<2&63],i+="="),o.push(i),o.join("")}function de(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function S(r,t){if(de()<t)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(t),r.__proto__=a.prototype):(r===null&&(r=new a(t)),r.length=t),r}function a(r,t,e){if(!a.TYPED_ARRAY_SUPPORT&&!(this instanceof a))return new a(r,t,e);if(typeof r=="number"){if(typeof t=="string")throw new Error("If encoding is specified then the first argument must be a string");return Ie(this,r)}return Ve(this,r,t,e)}function Ve(r,t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer!="undefined"&&t instanceof ArrayBuffer?Xt(r,t,e,n):typeof t=="string"?Qt(r,t,e):Zt(r,t)}function ze(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 Ht(r,t,e,n){return ze(t),t<=0?S(r,t):e!==void 0?typeof n=="string"?S(r,t).fill(e,n):S(r,t).fill(e):S(r,t)}function Ie(r,t){if(ze(t),r=S(r,t<0?0:ke(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)r[e]=0;return r}function Qt(r,t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!a.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=Ge(t,e)|0;r=S(r,n);var i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function _e(r,t){var e=t.length<0?0:ke(t.length)|0;r=S(r,e);for(var n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Xt(r,t,e,n){if(t.byteLength,e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return e===void 0&&n===void 0?t=new Uint8Array(t):n===void 0?t=new Uint8Array(t,e):t=new Uint8Array(t,e,n),a.TYPED_ARRAY_SUPPORT?(r=t,r.__proto__=a.prototype):r=_e(r,t),r}function Zt(r,t){if(I(t)){var e=ke(t.length)|0;return r=S(r,e),r.length===0||t.copy(r,0,0,e),r}if(t){if(typeof ArrayBuffer!="undefined"&&t.buffer instanceof ArrayBuffer||"length"in t)return typeof t.length!="number"||wr(t.length)?S(r,0):_e(r,t);if(t.type==="Buffer"&&Array.isArray(t.data))return _e(r,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function ke(r){if(r>=de())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+de().toString(16)+" bytes");return r|0}function I(r){return!!(r!=null&&r._isBuffer)}function Ge(r,t){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 e=r.length;if(e===0)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return we(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return je(r).length;default:if(n)return we(r).length;t=(""+t).toLowerCase(),n=!0}}function jt(r,t,e){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return fr(this,t,e);case"utf8":case"utf-8":return He(this,t,e);case"ascii":return sr(this,t,e);case"latin1":case"binary":return ar(this,t,e);case"base64":return ir(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ur(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function q(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}function Je(r,t,e,n,i){if(r.length===0)return-1;if(typeof e=="string"?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(i)return-1;e=r.length-1}else if(e<0)if(i)e=0;else return-1;if(typeof t=="string"&&(t=a.from(t,n)),I(t))return t.length===0?-1:Oe(r,t,e,n,i);if(typeof t=="number")return t=t&255,a.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Oe(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function Oe(r,t,e,n,i){var o=1,s=r.length,h=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||t.length<2)return-1;o=2,s/=2,h/=2,e/=2}function l(E,re){return o===1?E[re]:E.readUInt16BE(re*o)}var m;if(i){var w=-1;for(m=e;m<s;m++)if(l(r,m)===l(t,w===-1?0:m-w)){if(w===-1&&(w=m),m-w+1===h)return w*o}else w!==-1&&(m-=m-w),w=-1}else for(e+h>s&&(e=s-h),m=e;m>=0;m--){for(var x=!0,L=0;L<h;L++)if(l(r,m+L)!==l(t,L)){x=!1;break}if(x)return m}return-1}function Kt(r,t,e,n){e=Number(e)||0;var i=r.length-e;n?(n=Number(n),n>i&&(n=i)):n=i;var o=t.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var h=parseInt(t.substr(s*2,2),16);if(isNaN(h))return s;r[e+s]=h}return s}function er(r,t,e,n){return ge(we(t,r.length-e),r,e,n)}function qe(r,t,e,n){return ge(mr(t),r,e,n)}function tr(r,t,e,n){return qe(r,t,e,n)}function rr(r,t,e,n){return ge(je(t),r,e,n)}function nr(r,t,e,n){return ge(dr(t,r.length-e),r,e,n)}function ir(r,t,e){return t===0&&e===r.length?Ye(r):Ye(r.slice(t,e))}function He(r,t,e){e=Math.min(r.length,e);for(var n=[],i=t;i<e;){var o=r[i],s=null,h=o>239?4:o>223?3:o>191?2:1;if(i+h<=e){var l,m,w,x;switch(h){case 1:o<128&&(s=o);break;case 2:l=r[i+1],(l&192)===128&&(x=(o&31)<<6|l&63,x>127&&(s=x));break;case 3:l=r[i+1],m=r[i+2],(l&192)===128&&(m&192)===128&&(x=(o&15)<<12|(l&63)<<6|m&63,x>2047&&(x<55296||x>57343)&&(s=x));break;case 4:l=r[i+1],m=r[i+2],w=r[i+3],(l&192)===128&&(m&192)===128&&(w&192)===128&&(x=(o&15)<<18|(l&63)<<12|(m&63)<<6|w&63,x>65535&&x<1114112&&(s=x))}}s===null?(s=65533,h=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=h}return or(n)}function or(r){var t=r.length;if(t<=Fe)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=Fe));return e}function sr(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]&127);return n}function ar(r,t,e){var n="";e=Math.min(r.length,e);for(var i=t;i<e;++i)n+=String.fromCharCode(r[i]);return n}function fr(r,t,e){var n=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=t;o<e;++o)i+=pr(r[o]);return i}function ur(r,t,e){for(var n=r.slice(t,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}function y(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}function A(r,t,e,n,i,o){if(!I(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(e+n>r.length)throw new RangeError("Index out of range")}function xe(r,t,e,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(r.length-e,2);i<o;++i)r[e+i]=(t&255<<8*(n?i:1-i))>>>(n?i:1-i)*8}function ye(r,t,e,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(r.length-e,4);i<o;++i)r[e+i]=t>>>(n?i:3-i)*8&255}function Qe(r,t,e,n,i,o){if(e+n>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function Xe(r,t,e,n,i){return i||Qe(r,t,e,4,34028234663852886e22,-34028234663852886e22),et(r,t,e,n,23,4),e+4}function Ze(r,t,e,n,i){return i||Qe(r,t,e,8,17976931348623157e292,-17976931348623157e292),et(r,t,e,n,52,8),e+8}function hr(r){if(r=lr(r).replace(cr,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function lr(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function pr(r){return r<16?"0"+r.toString(16):r.toString(16)}function we(r,t){t=t||1/0;for(var e,n=r.length,i=null,o=[],s=0;s<n;++s){if(e=r.charCodeAt(s),e>55295&&e<57344){if(!i){if(e>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(t-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return o}function mr(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function dr(r,t){for(var e,n,i,o=[],s=0;s<r.length&&!((t-=2)<0);++s)e=r.charCodeAt(s),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function je(r){return Gt(hr(r))}function ge(r,t,e,n){for(var i=0;i<n&&!(i+e>=t.length||i>=r.length);++i)t[i+e]=r[i];return i}function wr(r){return r!==r}function xr(r){return r!=null&&(!!r._isBuffer||Ke(r)||yr(r))}function Ke(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function yr(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&Ke(r.slice(0,0))}function Te(r,t,e,n,i){var o,s,h=i*8-n-1,l=(1<<h)-1,m=l>>1,w=-7,x=e?i-1:0,L=e?-1:1,E=r[t+x];for(x+=L,o=E&(1<<-w)-1,E>>=-w,w+=h;w>0;o=o*256+r[t+x],x+=L,w-=8);for(s=o&(1<<-w)-1,o>>=-w,w+=n;w>0;s=s*256+r[t+x],x+=L,w-=8);if(o===0)o=1-m;else{if(o===l)return s?NaN:(E?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-m}return(E?-1:1)*s*Math.pow(2,o-n)}function et(r,t,e,n,i,o){var s,h,l,m=o*8-i-1,w=(1<<m)-1,x=w>>1,L=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:o-1,re=n?1:-1,ut=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(h=isNaN(t)?1:0,s=w):(s=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+x>=1?t+=L/l:t+=L*Math.pow(2,1-x),t*l>=2&&(s++,l/=2),s+x>=w?(h=0,s=w):s+x>=1?(h=(t*l-1)*Math.pow(2,i),s=s+x):(h=t*Math.pow(2,x-1)*Math.pow(2,i),s=0));i>=8;r[e+E]=h&255,E+=re,h/=256,i-=8);for(s=s<<i|h,m+=i;m>0;r[e+E]=s&255,E+=re,s/=256,m-=8);r[e+E-re]|=ut*128}var R,v,zt,Re,Fe,cr,tt=Le(()=>{"use strict";u();c();R=[],v=[],zt=typeof Uint8Array!="undefined"?Uint8Array:Array,Re=!1;a.TYPED_ARRAY_SUPPORT=globalThis.TYPED_ARRAY_SUPPORT!==void 0?globalThis.TYPED_ARRAY_SUPPORT:!0;a.poolSize=8192;a._augment=function(r){return r.__proto__=a.prototype,r};a.from=function(r,t,e){return Ve(null,r,t,e)};a.kMaxLength=de();a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,typeof Symbol!="undefined"&&Symbol.species&&a[Symbol.species]);a.alloc=function(r,t,e){return Ht(null,r,t,e)};a.allocUnsafe=function(r){return Ie(null,r)};a.allocUnsafeSlow=function(r){return Ie(null,r)};a.isBuffer=xr;a.compare=function(t,e){if(!I(t)||!I(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,o=0,s=Math.min(n,i);o<s;++o)if(t[o]!==e[o]){n=t[o],i=e[o];break}return n<i?-1:i<n?1:0};a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);var n;if(e===void 0)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=a.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var s=t[n];if(!I(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i};a.byteLength=Ge;a.prototype._isBuffer=!0;a.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)q(this,e,e+1);return this};a.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)q(this,e,e+3),q(this,e+1,e+2);return this};a.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)q(this,e,e+7),q(this,e+1,e+6),q(this,e+2,e+5),q(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?He(this,0,t):jt.apply(this,arguments)};a.prototype.equals=function(t){if(!I(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.compare=function(t,e,n,i,o){if(!I(t))throw new TypeError("Argument must be a Buffer");if(e===void 0&&(e=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),e<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===t)return 0;for(var s=o-i,h=n-e,l=Math.min(s,h),m=this.slice(i,o),w=t.slice(e,n),x=0;x<l;++x)if(m[x]!==w[x]){s=m[x],h=w[x];break}return s<h?-1:h<s?1:0};a.prototype.includes=function(t,e,n){return this.indexOf(t,e,n)!==-1};a.prototype.indexOf=function(t,e,n){return Je(this,t,e,n,!0)};a.prototype.lastIndexOf=function(t,e,n){return Je(this,t,e,n,!1)};a.prototype.write=function(t,e,n,i){if(e===void 0)i="utf8",n=this.length,e=0;else if(n===void 0&&typeof e=="string")i=e,n=this.length,e=0;else if(isFinite(e))e=e|0,isFinite(n)?(n=n|0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o=this.length-e;if((n===void 0||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var s=!1;;)switch(i){case"hex":return Kt(this,t,e,n);case"utf8":case"utf-8":return er(this,t,e,n);case"ascii":return qe(this,t,e,n);case"latin1":case"binary":return tr(this,t,e,n);case"base64":return rr(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return nr(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Fe=4096;a.prototype.slice=function(t,e){var n=this.length;t=~~t,e=e===void 0?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e<t&&(e=t);var i;if(a.TYPED_ARRAY_SUPPORT)i=this.subarray(t,e),i.__proto__=a.prototype;else{var o=e-t;i=new a(o,void 0);for(var s=0;s<o;++s)i[s]=this[s+t]}return i};a.prototype.readUIntLE=function(t,e,n){t=t|0,e=e|0,n||y(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return i};a.prototype.readUIntBE=function(t,e,n){t=t|0,e=e|0,n||y(t,e,this.length);for(var i=this[t+--e],o=1;e>0&&(o*=256);)i+=this[t+--e]*o;return i};a.prototype.readUInt8=function(t,e){return e||y(t,1,this.length),this[t]};a.prototype.readUInt16LE=function(t,e){return e||y(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUInt16BE=function(t,e){return e||y(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUInt32LE=function(t,e){return e||y(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUInt32BE=function(t,e){return e||y(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readIntLE=function(t,e,n){t=t|0,e=e|0,n||y(t,e,this.length);for(var i=this[t],o=1,s=0;++s<e&&(o*=256);)i+=this[t+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i};a.prototype.readIntBE=function(t,e,n){t=t|0,e=e|0,n||y(t,e,this.length);for(var i=e,o=1,s=this[t+--i];i>0&&(o*=256);)s+=this[t+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*e)),s};a.prototype.readInt8=function(t,e){return e||y(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,e){e||y(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n};a.prototype.readInt16BE=function(t,e){e||y(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n};a.prototype.readInt32LE=function(t,e){return e||y(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,e){return e||y(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readFloatLE=function(t,e){return e||y(t,4,this.length),Te(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||y(t,4,this.length),Te(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||y(t,8,this.length),Te(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||y(t,8,this.length),Te(this,t,!1,52,8)};a.prototype.writeUIntLE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;A(this,t,e,n,o,0)}var s=1,h=0;for(this[e]=t&255;++h<n&&(s*=256);)this[e+h]=t/s&255;return e+n};a.prototype.writeUIntBE=function(t,e,n,i){if(t=+t,e=e|0,n=n|0,!i){var o=Math.pow(2,8*n)-1;A(this,t,e,n,o,0)}var s=n-1,h=1;for(this[e+s]=t&255;--s>=0&&(h*=256);)this[e+s]=t/h&255;return e+n};a.prototype.writeUInt8=function(t,e,n){return t=+t,e=e|0,n||A(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=t&255,e+1};a.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=e|0,n||A(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):xe(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e|0,n||A(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):xe(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e|0,n||A(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255):ye(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e|0,n||A(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ye(this,t,e,!1),e+4};a.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*n-1);A(this,t,e,n,o-1,-o)}var s=0,h=1,l=0;for(this[e]=t&255;++s<n&&(h*=256);)t<0&&l===0&&this[e+s-1]!==0&&(l=1),this[e+s]=(t/h>>0)-l&255;return e+n};a.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e=e|0,!i){var o=Math.pow(2,8*n-1);A(this,t,e,n,o-1,-o)}var s=n-1,h=1,l=0;for(this[e+s]=t&255;--s>=0&&(h*=256);)t<0&&l===0&&this[e+s+1]!==0&&(l=1),this[e+s]=(t/h>>0)-l&255;return e+n};a.prototype.writeInt8=function(t,e,n){return t=+t,e=e|0,n||A(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=t&255,e+1};a.prototype.writeInt16LE=function(t,e,n){return t=+t,e=e|0,n||A(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):xe(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e|0,n||A(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):xe(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e|0,n||A(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):ye(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e|0,n||A(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255):ye(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,n){return Xe(this,t,e,!0,n)};a.prototype.writeFloatBE=function(t,e,n){return Xe(this,t,e,!1,n)};a.prototype.writeDoubleLE=function(t,e,n){return Ze(this,t,e,!0,n)};a.prototype.writeDoubleBE=function(t,e,n){return Ze(this,t,e,!1,n)};a.prototype.copy=function(t,e,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);var o=i-n,s;if(this===t&&n<e&&e<i)for(s=o-1;s>=0;--s)t[s+e]=this[s+n];else if(o<1e3||!a.TYPED_ARRAY_SUPPORT)for(s=0;s<o;++s)t[s+e]=this[s+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+o),e);return o};a.prototype.fill=function(t,e,n,i){if(typeof t=="string"){if(typeof e=="string"?(i=e,e=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),t.length===1){var o=t.charCodeAt(0);o<256&&(t=o)}if(i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!a.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else typeof t=="number"&&(t=t&255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e=e>>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var s;if(typeof t=="number")for(s=e;s<n;++s)this[s]=t;else{var h=I(t)?t:we(new a(t,i).toString()),l=h.length;for(s=0;s<n-e;++s)this[s+e]=h[s%l]}return this};cr=/[^+\/0-9A-Za-z-_]/g});var c=Le(()=>{"use strict";tt()});u();c();function ae(r){throw new Error("Unexpected value: "+JSON.stringify(r))}u();c();u();c();function gr(r){return Object.keys(r)}var ce={};wt(ce,{Access:()=>O,Array:()=>H,AstNode:()=>p,Attribute:()=>Q,Class:()=>B,ClassInstantiation:()=>k,ClassReference:()=>g,CodeBlock:()=>T,DataClass:()=>Z,Enum:()=>j,Field:()=>K,Map:()=>ee,Method:()=>M,MethodInvocation:()=>P,Parameter:()=>U,Trait:()=>X,Type:()=>_,TypeLiteral:()=>z,Writer:()=>F,array:()=>Ir,assignVariable:()=>Wr,attribute:()=>kr,classReference:()=>Cr,class_:()=>br,codeblock:()=>te,dataClass:()=>Br,enum_:()=>Ur,field:()=>Mr,instantiateClass:()=>ft,invokeMethod:()=>Pr,map:()=>$r,mergeArrays:()=>Gr,method:()=>Yr,parameter:()=>Or,string:()=>zr,ternary:()=>Fr,this_:()=>Jr,throwException:()=>Dr,trait:()=>Sr,variable:()=>Vr});u();c();u();c();u();c();var C=class{};u();c();u();c();var Y=class extends C{constructor(e){super();f(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var Tr=4,fe=class{constructor(){f(this,"buffer","");f(this,"indentLevel",0);f(this,"hasWrittenAnything",!1);f(this,"lastCharacterIsNewline",!1)}write(t){let e=t.length>0&&t.endsWith(`
2
+ `),n=e?t.substring(0,t.length-1):t,i=this.getIndentString(),o=n.replaceAll(`
3
+ `,`
4
+ ${i}`);this.isAtStartOfLine()&&(o=i+o),e&&(o+=`
5
+ `),this.writeInternal(o)}writeNoIndent(t){let e=this.indentLevel;this.indentLevel=0,this.write(t),this.indentLevel=e}writeNode(t){t.write(this)}writeNodeOrString(t){if(typeof t=="string"){this.write(t);return}this.writeNode(t)}writeNodeStatement(t){t.write(this),this.write(";"),this.writeNewLineIfLastLineNot()}writeTextStatement(t){new Y(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new Y(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}openBlock(t,e="{",n,i="}"){let o=t.filter(s=>s!==void 0).join(" ");o?this.write(`${o} ${e!=null?e:""}`):this.write(e!=null?e:"");try{this.indent(),n(),this.dedent()}finally{this.write(i!=null?i:"")}}writeLine(t=""){this.write(t),this.writeNewLineIfLastLineNot()}newLine(){this.writeInternal(`
6
+ `)}writeNewLineIfLastLineNot(){this.lastCharacterIsNewline||this.writeInternal(`
7
+ `)}indent(){this.indentLevel++}dedent(){this.indentLevel--}delimit({nodes:t,delimiter:e,writeFunction:n}){if(t.length>0){let i=t[0];i!=null&&n(i);for(let o=1;o<t.length;o++){this.write(e);let s=t[o];s!=null&&n(s)}}}toString(){return this.buffer}writeInternal(t){return t.length>0&&(this.hasWrittenAnything=!0,this.lastCharacterIsNewline=t.endsWith(`
8
+ `)),this.buffer+=t}isAtStartOfLine(){return this.lastCharacterIsNewline||!this.hasWrittenAnything}getIndentString(){return" ".repeat(this.indentLevel*Tr)}};u();c();function be(r){return(r==null?void 0:r.name)!=null}u();c();var ue=class extends C{constructor({condition:e,true_:n,false_:i}){super();f(this,"condition");f(this,"true_");f(this,"false_");this.condition=e,this.true_=n,this.false_=i}write(e){e.writeNode(this.condition),e.write(" ? "),e.writeNode(this.true_),e.write(" : "),e.writeNode(this.false_)}};u();c();u();c();var O={Public:"public",PublicReadonly:"public readonly",Protected:"protected",Private:"private"};u();c();u();c();u();c();u();c();var Ae="",rt="self";function nt(r){return{namespace:r.substring(0,r.lastIndexOf("\\")),name:r.substring(r.lastIndexOf("\\")+1)}}var F=class extends fe{constructor({namespace:e,rootNamespace:n,customConfig:i}){super();f(this,"namespace");f(this,"rootNamespace");f(this,"customConfig");f(this,"references",{});this.namespace=e,this.rootNamespace=n,this.customConfig=i}addReference(e){var s,h;if(e.namespace==null)return;if(Object.keys(this.references).filter(l=>{let m=nt(l);return m.namespace!==e.namespace&&m.name===e.name}).length>0){e.requireFullyQualified();return}let i=e.namespace===Ae?e.name:`${e.namespace}\\${e.name}`;((h=(s=this.references)[i])!=null?h:s[i]=[]).push(e)}toString(){let e=`namespace ${this.namespace};`,n=this.stringifyImports();return n.length>0?`${e}
9
+
10
+ ${n}
11
+
12
+ ${this.buffer}`:e+`
13
+
14
+ `+this.buffer}stringifyImports(){let e=Object.keys(this.references);return e.length===0?"":e.filter(n=>nt(n).namespace!==this.namespace).map(n=>`use ${n};`).join(`
15
+ `)}};var p=class extends C{toString(t){if(t==null)throw new Error("Internal error; AstNode.toString method called incorrectly.");let{namespace:e,rootNamespace:n,customConfig:i}=t,o=new F({namespace:e,rootNamespace:n,customConfig:i});return this.write(o),o.toString()}async toStringAsync({namespace:t,rootNamespace:e,customConfig:n}){let i=new F({namespace:t,rootNamespace:e,customConfig:n});return this.write(i),i.toString()}};var H=class extends p{constructor({entries:e}){super();f(this,"entries");this.entries=e!=null?e:[]}write(e){e.write("["),this.entries.forEach((n,i)=>{i>0&&e.write(", "),n.write(e)}),e.write("]")}};u();c();var Q=class extends p{constructor(e){var n;super();f(this,"reference");f(this,"arguments");this.reference=e.reference,this.arguments=(n=e.arguments)!=null?n:[]}write(e){e.addReference(this.reference),e.write(`${this.reference.name}`),this.arguments.length>0&&(e.write("("),this.arguments.forEach((n,i)=>{i>0&&e.write(","),typeof n=="string"?e.write(n):n.write(e)}),e.write(")"))}};u();c();u();c();var g=class extends p{constructor({name:e,namespace:n}){super();f(this,"name");f(this,"namespace");f(this,"fullyQualified");this.name=e,this.namespace=n,this.fullyQualified=!1}requireFullyQualified(){this.fullyQualified=!0}write(e){e.addReference(this);let n=this.fullyQualified?`\\${this.namespace}\\${this.name}`:this.name;e.write(`${n}`)}};u();c();u();c();function W(r){return r.startsWith("$")?r:`$${r}`}var N=class extends p{constructor({docs:e}={}){super();f(this,"docs");f(this,"tags",[]);this.docs=e}addTag(e){this.tags.push(pe(le({},e),{name:e.name!=null?W(e.name):void 0}))}write(e){e.writeLine("/**"),this.docs!=null&&(this.docs.split(`
16
+ `).forEach(n=>{e.writeLine(` * ${n}`)}),this.tags.length>0&&e.writeLine(" *"));for(let n of this.tags)this.writeTag({writer:e,tag:n});e.writeLine(" */")}writeTag({writer:e,tag:n}){let i=n.docs!=null?n.docs.split(`
17
+ `):void 0;i!=null&&i.length>1&&(i.forEach(o=>{e.writeLine(` * ${o}`)}),e.writeLine(" *")),e.write(` * @${n.tagType} `),n.type.write(e,{comment:!0}),n.name!=null&&e.write(` ${n.name}`),i!=null&&i.length===1&&e.write(` ${i[0]}`),e.newLine()}};u();c();function V(r){return Ar(r,[O.Public,O.PublicReadonly,O.Protected,O.Private])}function Ar(r,t){return t.reduce((e,n)=>[...e,...r.filter(i=>i.access===n)],[])}var B=class extends p{constructor({name:e,namespace:n,abstract:i,docs:o,parentClassReference:s,traits:h}){super();f(this,"name");f(this,"namespace");f(this,"abstract");f(this,"docs");f(this,"parentClassReference");f(this,"traits");f(this,"fields",[]);f(this,"methods",[]);f(this,"constructor_");this.name=e,this.namespace=n,this.abstract=i!=null?i:!1,this.docs=o,this.parentClassReference=s,this.traits=h!=null?h:[]}addConstructor(e){this.constructor_=e}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}addTrait(e){this.traits.push(e)}write(e){e.addReference(new g({name:this.name,namespace:this.namespace})),this.abstract&&e.write("abstract "),this.writeComment(e),e.write(`class ${this.name} `),this.parentClassReference!=null&&(e.write("extends "),this.parentClassReference.write(e)),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((n,i)=>{i>0&&e.write(","),e.writeNode(n)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:V(this.fields)}),(this.constructor!=null||this.methods.length>0)&&e.newLine(),this.constructor_!=null&&(this.writeConstructor({writer:e,constructor:this.constructor_}),this.methods.length>0&&e.newLine()),this.writeMethods({writer:e,methods:V(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new N({docs:this.docs}).write(e)}writeConstructor({writer:e,constructor:n}){var i;this.writeConstructorComment({writer:e,constructor:n}),n.access!=null&&e.write(`${n.access} `),e.write("function __construct("),e.indent(),n.parameters.forEach((o,s)=>{s===0&&e.newLine(),o.write(e),e.writeLine(",")}),e.dedent(),e.writeLine(")"),e.writeLine("{"),e.indent(),(i=n.body)==null||i.write(e),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeConstructorComment({writer:e,constructor:n}){if(n.parameters.length===0)return;let i=new N;for(let o of n.parameters)i.addTag(o.getCommentTag());i.write(e)}writeFields({writer:e,fields:n}){n.filter(i=>!i.inherited).forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};u();c();var X=class extends p{constructor({name:e,namespace:n,docs:i,traits:o}){super();f(this,"name");f(this,"namespace");f(this,"docs");f(this,"traits");f(this,"fields",[]);f(this,"methods",[]);this.name=e,this.namespace=n,this.docs=i,this.traits=o!=null?o:[]}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}write(e){this.writeComment(e),e.write(`trait ${this.name} `),e.newLine(),e.writeLine("{"),e.indent(),this.traits.length>0&&(e.write("use "),this.traits.forEach((n,i)=>{i>0&&e.write(","),e.writeNode(n)}),e.writeTextStatement(""),e.newLine()),this.writeFields({writer:e,fields:V(this.fields)}),this.fields.length>0&&this.methods.length>0&&e.newLine(),this.writeMethods({writer:e,methods:V(this.methods)}),e.dedent(),e.writeLine("}")}writeComment(e){let n=new N({docs:this.docs});for(let i of this.fields)n.addTag({tagType:"property",type:i.type,name:i.name});n.write(e)}writeFields({writer:e,fields:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}writeMethods({writer:e,methods:n}){n.forEach((i,o)=>{o>0&&e.newLine(),i.write(e),e.writeNewLineIfLastLineNot()})}};u();c();u();c();function oe({writer:r,arguments_:t,multiline:e}){if(t.length===0){r.write("()");return}if(e){Er({writer:r,arguments_:t});return}Nr({writer:r,arguments_:t})}function Er({writer:r,arguments_:t}){r.writeLine("("),r.indent();for(let e of t)it({writer:r,argument:e}),r.writeLine(",");r.dedent(),r.write(")")}function Nr({writer:r,arguments_:t}){r.write("("),t.forEach((e,n)=>{n>0&&r.write(", "),it({writer:r,argument:e})}),r.write(")")}function it({writer:r,argument:t}){be(t)?(r.write(`${t.name}: `),r.writeNodeOrString(t.assignment)):t.write(r)}var k=class extends p{constructor({classReference:e,arguments_:n,multiline:i}){super();f(this,"classReference");f(this,"arguments_");f(this,"multiline");this.classReference=e,this.arguments_=n,this.multiline=i!=null?i:!1}write(e){e.write("new "),e.writeNode(this.classReference),oe({writer:e,arguments_:this.arguments_,multiline:this.multiline})}};u();c();var T=class extends p{constructor(e){super();f(this,"arg");this.arg=e}write(e){return new Y(this.arg).write(e)}};u();c();u();c();u();c();var U=class extends p{constructor({name:e,type:n,docs:i,initializer:o,access:s,readonly_:h}){super();f(this,"name");f(this,"type");f(this,"docs");f(this,"initializer");f(this,"access");f(this,"readonly_");this.name=W(e),this.type=n,this.docs=i,this.initializer=o,this.access=s,this.readonly_=h!=null?h:!1}getCommentTag(){return{tagType:"param",type:this.type,name:this.name,docs:this.docs}}write(e){this.access!=null&&e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null?(e.write(" = "),this.initializer.write(e)):this.type.isOptional()&&e.write(" = null")}};u();c();var _=class r extends p{constructor(e){super();f(this,"internalType");this.internalType=e}write(e,{comment:n}={}){switch(this.internalType.type){case"int":e.write("int");break;case"string":e.write("string");break;case"bool":e.write("bool");break;case"float":e.write("float");break;case"date":e.addReference(ot),e.write("DateTime");break;case"dateTime":e.addReference(ot),e.write("DateTime");break;case"mixed":e.write("mixed");break;case"object":e.write("object");break;case"array":if(!n){e.write("array");break}e.write("array<"),this.internalType.value.write(e,{comment:n}),e.write(">");break;case"map":{if(!n){e.write("array");break}e.write("array<"),this.internalType.keyType.write(e,{comment:n}),e.write(", "),this.internalType.valueType.write(e,{comment:n}),e.write(">");break}case"null":{e.write("null");break}case"typeDict":{if(!n){e.write("array");break}if(this.internalType.multiline){e.writeLine("array{");for(let i of this.internalType.entries)e.write(" * "),this.writeTypeDictEntry({writer:e,entry:i,comment:n}),e.writeLine(",");e.write(" * }");break}e.write("array{"),this.internalType.entries.forEach((i,o)=>{o>0&&e.write(", "),this.writeTypeDictEntry({writer:e,entry:i,comment:n})}),e.write("}");break}case"union":{this.getUniqueTypes({types:this.internalType.types,comment:n,writer:e}).forEach((o,s)=>{s>0&&e.write("|"),o.write(e,{comment:n}),s++});break}case"optional":{let i=this.internalType.value.internalType.type==="mixed",o=this.internalType.value.internalType.type==="union";!o&&!i&&e.write("?"),this.internalType.value.write(e,{comment:n}),o&&(e.write("|"),e.writeNode(r.null()));break}case"reference":e.writeNode(this.internalType.value);break;case"enumString":n?(e.write("value-of<"),e.writeNode(this.internalType.value),e.write(">")):e.write("string");break;default:ae(this.internalType)}}toOptionalIfNotAlready(){return this.internalType.type==="optional"?this:r.optional(this)}underlyingTypeIfOptional(){if(this.internalType.type==="optional")return this.internalType.value}underlyingType(){var e;return(e=this.underlyingTypeIfOptional())!=null?e:this}isOptional(){return this.internalType.type==="optional"}static int(){return new this({type:"int"})}static string(){return new this({type:"string"})}static bool(){return new this({type:"bool"})}static float(){return new this({type:"float"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static mixed(){return new this({type:"mixed"})}static object(){return new this({type:"object"})}static array(e){return new this({type:"array",value:e})}static map(e,n){return new this({type:"map",keyType:e,valueType:n})}static typeDict(e,{multiline:n}={}){return new this({type:"typeDict",entries:e,multiline:n})}static union(e){return new this({type:"union",types:e})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static null(){return new this({type:"null"})}static reference(e){return new this({type:"reference",value:e})}static enumString(e){return new this({type:"enumString",value:e})}static isAlreadyOptional(e){return e.internalType.type==="optional"}writeTypeDictEntry({writer:e,entry:n,comment:i}){e.write(n.key),n.optional&&e.write("?"),e.write(": "),n.valueType.write(e,{comment:i})}getUniqueTypes({writer:e,types:n,comment:i}){let o=new Set;return n.filter(s=>{if(i)return!0;let h=s.toString({namespace:e.namespace,rootNamespace:e.rootNamespace,customConfig:e.customConfig});return o.has(h)?!1:(o.add(h),!0)})}},ot=new g({namespace:Ae,name:"DateTime"});u();c();function st(r){return r.startsWith("$")?r.slice(1):r}var at="values",Z=class extends p{constructor({name:e,namespace:n,abstract:i,docs:o,parentClassReference:s,traits:h}){super();f(this,"name");f(this,"namespace");f(this,"class_");this.name=e,this.namespace=n,this.class_=new B({name:e,namespace:n,abstract:i,docs:o,parentClassReference:s,traits:h})}addField(e){this.class_.addField(e)}addMethod(e){this.class_.addMethod(e)}addTrait(e){this.class_.addTrait(e)}write(e){let n=V(this.class_.fields).map(i=>pe(le({},i),{name:st(i.name)}));n.length>0&&this.class_.addConstructor({access:"public",parameters:this.getConstructorParameters({orderedFields:n}),body:ce.codeblock(i=>{for(let o of n)i.write(`$this->${o.name} = $${at}['${o.name}']`),o.type.isOptional()&&i.write(" ?? null"),i.write(";")})}),this.class_.write(e)}allFieldsAreOptional(){return this.class_.fields.every(e=>e.type.isOptional())}getConstructorParameters({orderedFields:e}){return[new U({name:at,type:_.typeDict(e.map(n=>({key:n.name,valueType:n.type,optional:n.type.isOptional()})),{multiline:!0}),initializer:this.allFieldsAreOptional()?new T("[]"):void 0})]}};u();c();u();c();var M=class extends p{constructor({name:e,access:n,parameters:i,throws:o,return_:s,body:h,docs:l,classReference:m}){super();f(this,"name");f(this,"access");f(this,"parameters");f(this,"throws");f(this,"return_");f(this,"body");f(this,"docs");f(this,"classReference");this.name=e,this.access=n,this.parameters=i,this.throws=o!=null?o:[],this.return_=s,this.body=h,this.docs=l,this.classReference=m}write(e){var n;this.writeComment(e),e.write(`${this.access} function ${this.name}(`),this.parameters.forEach((i,o)=>{o>0&&e.write(", "),i.write(e)}),e.write("): "),this.return_!=null?e.writeNodeOrString(this.return_):e.write("void"),e.writeLine(" {"),e.indent(),(n=this.body)==null||n.write(e),e.dedent(),e.writeLine("}")}writeComment(e){let n=new N({docs:this.docs});for(let i of this.parameters)n.addTag({tagType:"param",type:i.type,name:i.name,docs:i.docs});this.return_!=null&&this.return_!==rt&&n.addTag({tagType:"return",type:this.return_});for(let i of this.throws)n.addTag({tagType:"throws",type:_.reference(i)});e.writeNode(n)}};var j=class extends p{constructor({name:e,namespace:n,backing:i,docs:o,serializable:s}){super();f(this,"name");f(this,"namespace");f(this,"backing");f(this,"docs");f(this,"members",[]);f(this,"serializable");this.name=e,this.namespace=n,this.backing=i,this.docs=o,this.serializable=s!=null?s:!1}addMember(e){this.members.push(e)}write(e){this.writeComment(e),e.write("enum "),e.writeLine(`${this.name}`),this.backing!=null&&e.write(` : ${this.backing}`),this.serializable&&(e.addReference(new g({name:"JsonSerializable",namespace:""})),e.writeLine(" implements JsonSerializable")),e.writeLine(" {"),e.indent();for(let n of this.members)e.write(`case ${n.name}`),n.value!=null&&(typeof n.value=="string"?e.write(` = "${n.value}"`):e.write(` = ${n.value}`)),e.writeTextStatement("");this.serializable&&(e.newLine(),e.writeNode(new M({name:"jsonSerialize",return_:_.string(),access:"public",parameters:[],body:new T("return $this->value;")}))),e.writeNewLineIfLastLineNot(),e.dedent(),e.writeLine("}")}writeComment(e){if(this.docs==null)return;new N({docs:this.docs}).write(e)}};u();c();var K=class extends p{constructor({name:e,type:n,access:i,readonly_:o,initializer:s,docs:h,inlineDocs:l,attributes:m,inherited:w}){super();f(this,"name");f(this,"type");f(this,"access");f(this,"readonly_");f(this,"initializer");f(this,"docs");f(this,"inlineDocs");f(this,"attributes");f(this,"inherited");this.name=W(e),this.type=n,this.access=i,this.readonly_=o!=null?o:!1,this.initializer=s,this.docs=h,this.inlineDocs=l,this.attributes=m!=null?m:[],this.inherited=w!=null?w:!1}write(e){this.writeComment(e),this.writeAttributesIfPresent(e),e.write(`${this.access} `),this.readonly_&&e.write("readonly "),this.type.write(e),e.write(` ${this.name}`),this.initializer!=null&&(e.write(" = "),this.initializer.write(e)),e.write(";"),this.inlineDocs!=null&&e.write(` // ${this.inlineDocs}`),e.newLine()}writeComment(e){let n=new N;n.addTag({tagType:"var",type:this.type,name:this.name,docs:this.docs}),n.write(e)}writeAttributesIfPresent(e){this.attributes.length>0&&(e.write("#["),this.attributes.forEach((n,i)=>{i>0&&e.write(", "),n.write(e)}),e.writeLine("]"))}};u();c();var ee=class extends p{constructor({entries:e,multiline:n}){super();f(this,"entries");f(this,"multiline");this.entries=e!=null?e:[],this.multiline=n!=null?n:!1}write(e){if(this.multiline){this.writeMultiline(e);return}this.writeCompact(e)}writeMultiline(e){e.writeLine("["),e.indent();for(let{key:n,value:i}of this.entries)n.write(e),e.write(" => "),i.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeCompact(e){e.write("[");for(let[n,{key:i,value:o}]of this.entries.entries())n>0&&e.write(", "),i.write(e),e.write(" => "),o.write(e);e.write("]")}};u();c();var P=class extends p{constructor({method:e,arguments_:n,static_:i,multiline:o,on:s}){super();f(this,"method");f(this,"arguments_");f(this,"multiline");f(this,"static_");f(this,"on");this.method=e,this.arguments_=n,this.static_=i!=null?i:!1,this.multiline=o!=null?o:!1,this.on=s}write(e){this.on!=null&&(this.on.write(e),e.write(this.getMethodAccessor())),e.write(this.method),oe({writer:e,arguments_:this.arguments_,multiline:this.multiline})}getMethodAccessor(){return this.static_?"::":"->"}};u();c();u();c();var z=class r extends p{constructor(e){super();f(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"list":{this.writeList({writer:e,list:this.internalType});break}case"boolean":{e.write(this.internalType.value.toString());break}case"class":{this.writeClass({writer:e,class_:this.internalType});break}case"file":{e.writeNode(Lr({writer:e,value:this.internalType.value}));break}case"float":{e.write(this.internalType.value.toString());break}case"number":{e.write(this.internalType.value.toString());break}case"map":{this.writeMap({writer:e,map:this.internalType});break}case"reference":{e.writeNode(this.internalType.value);break}case"datetime":{e.writeNode(vr({writer:e,value:this.internalType.value}));break}case"string":{if(this.internalType.value.includes(`
18
+ `)){this.writeStringWithHeredoc({writer:e,value:this.internalType.value});break}e.write(`'${this.internalType.value.replaceAll("'","\\'")}'`);break}case"unknown":{this.writeUnknown({writer:e,value:this.internalType.value});break}case"null":{e.write("null");break}case"nop":break;default:ae(this.internalType)}}writeStringWithHeredoc({writer:e,value:n}){e.writeLine("<<<EOT"),e.writeNoIndent(n),e.newLine(),e.writeNoIndent("EOT")}writeClass({writer:e,class_:n}){e.writeNode(new k({classReference:n.reference,arguments_:[r.map({entries:n.fields.map(i=>({key:r.string(i.name),value:i.value}))})]}))}writeList({writer:e,list:n}){let i=Rr({values:n.values});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.write(e),e.writeLine(",");e.dedent(),e.write("]")}writeMap({writer:e,map:n}){let i=_r({entries:n.entries});if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let o of i)o.key.write(e),e.write(" => "),o.value.write(e),e.writeLine(",");e.dedent(),e.write("]")}static list({values:e}){return new this({type:"list",values:e})}static boolean(e){return new this({type:"boolean",value:e})}static class_({reference:e,fields:n}){return new this({type:"class",reference:e,fields:n})}static file(e){return new this({type:"file",value:e})}static float(e){return new this({type:"float",value:e})}static datetime(e){return new this({type:"datetime",value:e})}static number(e){return new this({type:"number",value:e})}static map({entries:e}){return new this({type:"map",entries:e})}static reference(e){return new this({type:"reference",value:e})}static string(e){return new this({type:"string",value:e})}static unknown(e){return new this({type:"unknown",value:e})}static null(){return new this({type:"null"})}static nop(){return new this({type:"nop"})}static isNop(e){return e.internalType.type==="nop"}writeUnknown({writer:e,value:n}){switch(typeof n){case"boolean":e.write(n.toString());return;case"string":e.write(n.includes('"')?`\`${n}\``:`"${n}"`);return;case"number":e.write(n.toString());return;case"object":if(n==null){e.write("null");return}if(Array.isArray(n)){this.writeUnknownArray({writer:e,value:n});return}this.writeUnknownMap({writer:e,value:n});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof n}`)}}writeUnknownArray({writer:e,value:n}){if(n.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let i of n)e.writeNode(r.unknown(i)),e.writeLine(",");e.dedent(),e.write("]")}writeUnknownMap({writer:e,value:n}){let i=Object.entries(n);if(i.length===0){e.write("[]");return}e.writeLine("["),e.indent();for(let[o,s]of i)e.write(`'${o}' => `),e.writeNode(r.unknown(s)),e.writeLine(",");e.dedent(),e.write("]")}};function vr({writer:r,value:t}){return new k({classReference:new g({name:"DateTime",namespace:""}),arguments_:[new T(`'${t}'`)]})}function Lr({writer:r,value:t}){return new P({on:new g({name:"File",namespace:`${r.rootNamespace}\\Utils`}),method:"createFromString",arguments_:[new T(`"${t}"`)]})}function _r({entries:r}){return r.filter(t=>!z.isNop(t.key)&&!z.isNop(t.value))}function Rr({values:r}){return r.filter(t=>!z.isNop(t))}u();c();var Ee=class extends p{constructor(e){super();f(this,"arrays");this.arrays=e}write(e){e.write("array_merge"),oe({writer:e,arguments_:this.arrays.map(n=>te(i=>{if(typeof n=="string"||n instanceof p){i.writeNodeOrString(n);return}i.writeNodeOrString(n.ref),n.fallback&&(i.write(" ?? "),i.writeNodeOrString(n.fallback))}))})}};function Ir(r){return new H(r)}function kr(r){return new Q(r)}function br(r){return new B(r)}function Sr(r){return new X(r)}function Cr(r){return new g(r)}function te(r){return new T(r)}function Br(r){return new Z(r)}function Ur(r){return new j(r)}function Mr(r){return new K(r)}function ft(r){return new k(r)}function Pr(r){return new P(r)}function Dr(r){return te(t=>{t.write("throw "),t.writeNode(ft(r))})}function $r(r){return new ee(r)}function Yr(r){return new M(r)}function Or(r){return new U(r)}function Fr(r){return new ue(r)}function Wr(r,t){return te(e=>{e.writeNodeOrString(r),e.write(" = "),e.writeNodeOrString(t)})}function Vr(r){return te(W(r))}function zr(r){return te(`"${r}"`)}function Gr(...r){return new Ee(r)}function Jr(){return new T(r=>{r.write("$this")})}export{le as a,pe as b,qr as c,Hr as d,Le as e,Qr as f,wt as g,Xr as h,Zr as i,f as j,u as k,a as l,c as m,ae as n,gr as o,ce as p};
19
+ /*! Bundled license information:
20
+
21
+ @esbuild-plugins/node-globals-polyfill/Buffer.js:
22
+ (*!
23
+ * The buffer module from node.js, for the browser.
24
+ *
25
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
26
+ * @license MIT
27
+ *)
28
+ */
@@ -1 +1 @@
1
- import{a as P,b as T,c as S,d as b,j as a,k as p,m as l,n as f,o as E}from"./chunk-ZFTBBCKC.js";p();l();p();l();var y=class{constructor(){a(this,"reporter");a(this,"snippet");a(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){(this.reporter==null||this.reporter.size()>e.errors.size())&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}};var R=class{constructor(e){a(this,"context");this.context=e}async generate(e){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t=new y;for(let n of r){let i=this.context.clone(),u=this.createSnippetGenerator(i);try{let o=await u.generateSnippet({endpoint:n,request:e});if(i.errors.empty())return{snippet:o,errors:void 0};t.update({context:i,snippet:o})}catch(o){t.err==null&&(t.err=o)}}return t.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t=new y;for(let n of r){let i=this.context.clone(),u=this.createSnippetGenerator(i);try{let o=u.generateSnippetSync({endpoint:n,request:e});if(i.errors.empty())return{snippet:o,errors:void 0};t.update({context:i,snippet:o})}catch(o){t.err==null&&(t.err=o)}}return t.getResponseOrThrow({endpoint:e.endpoint})}};p();l();var s={Critical:"CRITICAL",Warning:"WARNING"},g=class h{constructor(){a(this,"errors");a(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(T(P({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new h;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};p();l();p();l();p();l();var v=class{constructor(){a(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var w=class{constructor({ir:e,config:r}){a(this,"config");a(this,"errors");a(this,"_ir");a(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.errors=new g,this.httpEndpointReferenceParser=new v}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let u=e.find(m=>m.name.wireValue===n);if(u==null)throw this.newParameterNotRecognizedError(n);let o=this.isListTypeReference(u.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:u.name,typeReference:u.typeReference,value:o})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,u]of Object.entries(r)){this.errors.scope(i);try{let o=e.find(m=>m.name.wireValue===i);if(o==null){if(t)continue;this.errors.add({severity:s.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:o.name,typeReference:o.typeReference,value:u})}finally{this.errors.unscope()}}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:s.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:s.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:s.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:s.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:s.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:s.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:s.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let u=e.types[i];if(u==null){this.errors.add({severity:s.Critical,message:`No type found for discriminant value "${i}"`});return}let x=t,{[n]:o}=x,m=b(x,[S(n)]);return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:m}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocationOrThrow(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:f(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:f(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(E(t.urls));for(let i of E(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:s.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${E(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:f(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:f(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:f(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};p();l();var A={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();l();export{R as a,s as b,w as c,A as d};
1
+ import{a as P,b as T,c as S,d as b,j as a,k as p,m as l,n as f,o as E}from"./chunk-LHXTVBUM.js";p();l();p();l();var y=class{constructor(){a(this,"reporter");a(this,"snippet");a(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){(this.reporter==null||this.reporter.size()>e.errors.size())&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}};var R=class{constructor(e){a(this,"context");this.context=e}async generate(e){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t=new y;for(let n of r){let i=this.context.clone(),u=this.createSnippetGenerator(i);try{let o=await u.generateSnippet({endpoint:n,request:e});if(i.errors.empty())return{snippet:o,errors:void 0};t.update({context:i,snippet:o})}catch(o){t.err==null&&(t.err=o)}}return t.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e){let r=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(r.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let t=new y;for(let n of r){let i=this.context.clone(),u=this.createSnippetGenerator(i);try{let o=u.generateSnippetSync({endpoint:n,request:e});if(i.errors.empty())return{snippet:o,errors:void 0};t.update({context:i,snippet:o})}catch(o){t.err==null&&(t.err=o)}}return t.getResponseOrThrow({endpoint:e.endpoint})}};p();l();var s={Critical:"CRITICAL",Warning:"WARNING"},g=class h{constructor(){a(this,"errors");a(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(T(P({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new h;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};p();l();p();l();p();l();var v=class{constructor(){a(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH)\s(\/[a-zA-Z0-9\/{}_-]*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var w=class{constructor({ir:e,config:r}){a(this,"config");a(this,"errors");a(this,"_ir");a(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.errors=new g,this.httpEndpointReferenceParser=new v}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let u=e.find(m=>m.name.wireValue===n);if(u==null)throw this.newParameterNotRecognizedError(n);let o=this.isListTypeReference(u.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:u.name,typeReference:u.typeReference,value:o})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,u]of Object.entries(r)){this.errors.scope(i);try{let o=e.find(m=>m.name.wireValue===i);if(o==null){if(t)continue;this.errors.add({severity:s.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:o.name,typeReference:o.typeReference,value:u})}finally{this.errors.unscope()}}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:s.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:s.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:s.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:s.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:s.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:s.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:s.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let u=e.types[i];if(u==null){this.errors.add({severity:s.Critical,message:`No type found for discriminant value "${i}"`});return}let x=t,{[n]:o}=x,m=b(x,[S(n)]);return{singleDiscriminatedUnionType:u,discriminantValue:u.discriminantValue,value:m}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocationOrThrow(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:f(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:f(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:s.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(E(t.urls));for(let i of E(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:s.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${E(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:s.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:f(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:f(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:f(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};p();l();var A={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};p();l();export{R as a,s as b,w as c,A as d};
@@ -1,4 +1,4 @@
1
- import{a as S}from"./chunk-G6X3OBKW.js";import{c as R}from"./chunk-7HKG5U5F.js";import{a as A}from"./chunk-YELOIV6Y.js";import{j as n,k as r,m as t,p as g}from"./chunk-ZFTBBCKC.js";r();t();r();t();r();t();r();t();r();t();r();t();r();t();var ve=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,N=ve;var Ie=typeof self=="object"&&self&&self.Object===Object&&self,Oe=N||Ie||Function("return this")(),v=Oe;var Ee=v.Symbol,l=Ee;r();t();var I=Object.prototype,Te=I.hasOwnProperty,je=I.toString,c=l?l.toStringTag:void 0;function Me(e){var a=Te.call(e,c),o=e[c];try{e[c]=void 0;var u=!0}catch(d){}var f=je.call(e);return u&&(a?e[c]=o:delete e[c]),f}var O=Me;r();t();var we=Object.prototype,We=we.toString;function Fe(e){return We.call(e)}var E=Fe;var Le="[object Null]",ke="[object Undefined]",T=l?l.toStringTag:void 0;function Ue(e){return e==null?e===void 0?ke:Le:T&&T in Object(e)?O(e):E(e)}var j=Ue;r();t();function Pe(e){return e!=null&&typeof e=="object"}var M=Pe;var ze="[object Symbol]";function Be(e){return typeof e=="symbol"||M(e)&&j(e)==ze}var w=Be;r();t();r();t();function De(e,a){for(var o=-1,u=e==null?0:e.length,f=Array(u);++o<u;)f[o]=a(e[o],o,e);return f}var W=De;r();t();var Ze=Array.isArray,F=Ze;var qe=1/0,L=l?l.prototype:void 0,k=L?L.toString:void 0;function U(e){if(typeof e=="string")return e;if(F(e))return W(e,U)+"";if(w(e))return k?k.call(e):"";var a=e+"";return a=="0"&&1/e==-qe?"-0":a}var P=U;r();t();function Ge(e){return e==null?"":P(e)}var m=Ge;r();t();r();t();r();t();r();t();r();t();r();t();function He(e,a,o){var u=-1,f=e.length;a<0&&(a=-a>f?0:f+a),o=o>f?f:o,o<0&&(o+=f),f=a>o?0:o-a>>>0,a>>>=0;for(var d=Array(f);++u<f;)d[u]=e[u+a];return d}var z=He;function Ve(e,a,o){var u=e.length;return o=o===void 0?u:o,!a&&o>=u?e:z(e,a,o)}var B=Ve;r();t();var Je="\\ud800-\\udfff",_e="\\u0300-\\u036f",$e="\\ufe20-\\ufe2f",Ke="\\u20d0-\\u20ff",Ye=_e+$e+Ke,Qe="\\ufe0e\\ufe0f",Xe="\\u200d",er=RegExp("["+Xe+Je+Ye+Qe+"]");function rr(e){return er.test(e)}var b=rr;r();t();r();t();function tr(e){return e.split("")}var D=tr;r();t();var Z="\\ud800-\\udfff",or="\\u0300-\\u036f",ar="\\ufe20-\\ufe2f",fr="\\u20d0-\\u20ff",ur=or+ar+fr,sr="\\ufe0e\\ufe0f",pr="["+Z+"]",y="["+ur+"]",C="\\ud83c[\\udffb-\\udfff]",lr="(?:"+y+"|"+C+")",q="[^"+Z+"]",G="(?:\\ud83c[\\udde6-\\uddff]){2}",H="[\\ud800-\\udbff][\\udc00-\\udfff]",dr="\\u200d",V=lr+"?",J="["+sr+"]?",mr="(?:"+dr+"(?:"+[q,G,H].join("|")+")"+J+V+")*",nr=J+V+mr,ir="(?:"+[q+y+"?",y,G,H,pr].join("|")+")",xr=RegExp(C+"(?="+C+")|"+ir+nr,"g");function cr(e){return e.match(xr)||[]}var _=cr;function gr(e){return b(e)?_(e):D(e)}var $=gr;function br(e){return function(a){a=m(a);var o=b(a)?$(a):void 0,u=o?o[0]:a.charAt(0),f=o?B(o,1).join(""):a.slice(1);return u[e]()+f}}var K=br;var hr=K("toUpperCase"),i=hr;function yr(e){return i(m(e).toLowerCase())}var Y=yr;r();t();r();t();function Cr(e,a,o,u){var f=-1,d=e==null?0:e.length;for(u&&d&&(o=e[++f]);++f<d;)o=a(o,e[f],f,e);return o}var Q=Cr;r();t();r();t();r();t();function Rr(e){return function(a){return e==null?void 0:e[a]}}var X=Rr;var Sr={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Ar=X(Sr),ee=Ar;var Nr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vr="\\u0300-\\u036f",Ir="\\ufe20-\\ufe2f",Or="\\u20d0-\\u20ff",Er=vr+Ir+Or,Tr="["+Er+"]",jr=RegExp(Tr,"g");function Mr(e){return e=m(e),e&&e.replace(Nr,ee).replace(jr,"")}var re=Mr;r();t();r();t();var wr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Wr(e){return e.match(wr)||[]}var te=Wr;r();t();var Fr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Lr(e){return Fr.test(e)}var oe=Lr;r();t();var pe="\\ud800-\\udfff",kr="\\u0300-\\u036f",Ur="\\ufe20-\\ufe2f",Pr="\\u20d0-\\u20ff",zr=kr+Ur+Pr,le="\\u2700-\\u27bf",de="a-z\\xdf-\\xf6\\xf8-\\xff",Br="\\xac\\xb1\\xd7\\xf7",Dr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Zr="\\u2000-\\u206f",qr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",me="A-Z\\xc0-\\xd6\\xd8-\\xde",Gr="\\ufe0e\\ufe0f",ne=Br+Dr+Zr+qr,ie="['\u2019]",ae="["+ne+"]",Hr="["+zr+"]",xe="\\d+",Vr="["+le+"]",ce="["+de+"]",ge="[^"+pe+ne+xe+le+de+me+"]",Jr="\\ud83c[\\udffb-\\udfff]",_r="(?:"+Hr+"|"+Jr+")",$r="[^"+pe+"]",be="(?:\\ud83c[\\udde6-\\uddff]){2}",he="[\\ud800-\\udbff][\\udc00-\\udfff]",x="["+me+"]",Kr="\\u200d",fe="(?:"+ce+"|"+ge+")",Yr="(?:"+x+"|"+ge+")",ue="(?:"+ie+"(?:d|ll|m|re|s|t|ve))?",se="(?:"+ie+"(?:D|LL|M|RE|S|T|VE))?",ye=_r+"?",Ce="["+Gr+"]?",Qr="(?:"+Kr+"(?:"+[$r,be,he].join("|")+")"+Ce+ye+")*",Xr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",et="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",rt=Ce+ye+Qr,tt="(?:"+[Vr,be,he].join("|")+")"+rt,ot=RegExp([x+"?"+ce+"+"+ue+"(?="+[ae,x,"$"].join("|")+")",Yr+"+"+se+"(?="+[ae,x+fe,"$"].join("|")+")",x+"?"+fe+"+"+ue,x+"+"+se,et,Xr,xe,tt].join("|"),"g");function at(e){return e.match(ot)||[]}var Re=at;function ft(e,a,o){return e=m(e),a=o?void 0:a,a===void 0?oe(e)?Re(e):te(e):e.match(a)||[]}var Se=ft;var ut="['\u2019]",st=RegExp(ut,"g");function pt(e){return function(a){return Q(Se(re(a).replace(st,"")),e,"")}}var Ae=pt;var lt=Ae(function(e,a,o){return a=a.toLowerCase(),e+(o?Y(a):a)}),h=lt;var dt=["use","clone","list"],mt="Requests",nt="Types",Ne=class e extends R{constructor({ir:o,config:u}){var f;super({ir:o,config:u});n(this,"ir");n(this,"customConfig");n(this,"dynamicTypeLiteralMapper");n(this,"filePropertyMapper");n(this,"rootNamespace");this.ir=o,this.customConfig=u.customConfig!=null?u.customConfig:void 0,this.dynamicTypeLiteralMapper=new S({context:this}),this.filePropertyMapper=new A({context:this}),this.rootNamespace=it({organization:u.organization,namespaceOverride:(f=this.customConfig)==null?void 0:f.namespace})}clone(){return new e({ir:this.ir,config:this.config})}getParameterName(o){return this.prependUnderscoreIfNeeded(o.camelCase.unsafeName)}getPropertyName(o){return this.prependUnderscoreIfNeeded(o.camelCase.unsafeName)}getMethodName(o){let u=o.camelCase.unsafeName;return dt.includes(u)?u:o.camelCase.safeName}getClassName(o){return o.pascalCase.safeName}getRootClientClassName(){var o,u,f;return((o=this.customConfig)==null?void 0:o.clientName)!=null?this.customConfig.clientName:((u=this.customConfig)==null?void 0:u["client-class-name"])!=null?(f=this.customConfig)==null?void 0:f["client-class-name"]:this.getComputedClientName()}getEnvironmentsClassReference(){return g.classReference({name:"Environments",namespace:this.rootNamespace})}getRequestNamespace(o){return this.getNamespace(o,mt)}getTypesNamespace(o){return this.getNamespace(o,nt)}getNamespace(o,u){let f=o.allParts.map(d=>d.pascalCase.safeName);return f=u!=null?[...f,u]:f,[this.rootNamespace,...f].join("\\")}getEnvironmentClassAccessFromID(o){let u=this.resolveEnvironmentName(o);if(u!=null)return g.codeblock(f=>{f.writeNode(this.getEnvironmentClassReference(u)),f.write("::"),f.write(this.getClassName(u))})}getEnvironmentClassReference(o){return g.classReference({name:"Environments",namespace:this.rootNamespace})}prependUnderscoreIfNeeded(o){return/^[a-zA-Z_]/.test(o)?o:`_${o}`}getComputedClientName(){return`${this.getOrganizationPascalCase()}Client`}getOrganizationPascalCase(){return`${i(h(this.config.organization))}`}};function it({organization:e,namespaceOverride:a}){return a!=null?a:`${i(h(e))}`}export{Ne as a};
1
+ import{a as S}from"./chunk-JFJ3XGKL.js";import{c as R}from"./chunk-NXDI62IP.js";import{a as A}from"./chunk-HHDXN7HB.js";import{j as n,k as r,m as t,p as g}from"./chunk-LHXTVBUM.js";r();t();r();t();r();t();r();t();r();t();r();t();r();t();var ve=typeof globalThis=="object"&&globalThis&&globalThis.Object===Object&&globalThis,N=ve;var Ie=typeof self=="object"&&self&&self.Object===Object&&self,Oe=N||Ie||Function("return this")(),v=Oe;var Ee=v.Symbol,l=Ee;r();t();var I=Object.prototype,Te=I.hasOwnProperty,je=I.toString,c=l?l.toStringTag:void 0;function Me(e){var a=Te.call(e,c),o=e[c];try{e[c]=void 0;var u=!0}catch(d){}var f=je.call(e);return u&&(a?e[c]=o:delete e[c]),f}var O=Me;r();t();var we=Object.prototype,We=we.toString;function Fe(e){return We.call(e)}var E=Fe;var Le="[object Null]",ke="[object Undefined]",T=l?l.toStringTag:void 0;function Ue(e){return e==null?e===void 0?ke:Le:T&&T in Object(e)?O(e):E(e)}var j=Ue;r();t();function Pe(e){return e!=null&&typeof e=="object"}var M=Pe;var ze="[object Symbol]";function Be(e){return typeof e=="symbol"||M(e)&&j(e)==ze}var w=Be;r();t();r();t();function De(e,a){for(var o=-1,u=e==null?0:e.length,f=Array(u);++o<u;)f[o]=a(e[o],o,e);return f}var W=De;r();t();var Ze=Array.isArray,F=Ze;var qe=1/0,L=l?l.prototype:void 0,k=L?L.toString:void 0;function U(e){if(typeof e=="string")return e;if(F(e))return W(e,U)+"";if(w(e))return k?k.call(e):"";var a=e+"";return a=="0"&&1/e==-qe?"-0":a}var P=U;r();t();function Ge(e){return e==null?"":P(e)}var m=Ge;r();t();r();t();r();t();r();t();r();t();r();t();function He(e,a,o){var u=-1,f=e.length;a<0&&(a=-a>f?0:f+a),o=o>f?f:o,o<0&&(o+=f),f=a>o?0:o-a>>>0,a>>>=0;for(var d=Array(f);++u<f;)d[u]=e[u+a];return d}var z=He;function Ve(e,a,o){var u=e.length;return o=o===void 0?u:o,!a&&o>=u?e:z(e,a,o)}var B=Ve;r();t();var Je="\\ud800-\\udfff",_e="\\u0300-\\u036f",$e="\\ufe20-\\ufe2f",Ke="\\u20d0-\\u20ff",Ye=_e+$e+Ke,Qe="\\ufe0e\\ufe0f",Xe="\\u200d",er=RegExp("["+Xe+Je+Ye+Qe+"]");function rr(e){return er.test(e)}var b=rr;r();t();r();t();function tr(e){return e.split("")}var D=tr;r();t();var Z="\\ud800-\\udfff",or="\\u0300-\\u036f",ar="\\ufe20-\\ufe2f",fr="\\u20d0-\\u20ff",ur=or+ar+fr,sr="\\ufe0e\\ufe0f",pr="["+Z+"]",y="["+ur+"]",C="\\ud83c[\\udffb-\\udfff]",lr="(?:"+y+"|"+C+")",q="[^"+Z+"]",G="(?:\\ud83c[\\udde6-\\uddff]){2}",H="[\\ud800-\\udbff][\\udc00-\\udfff]",dr="\\u200d",V=lr+"?",J="["+sr+"]?",mr="(?:"+dr+"(?:"+[q,G,H].join("|")+")"+J+V+")*",nr=J+V+mr,ir="(?:"+[q+y+"?",y,G,H,pr].join("|")+")",xr=RegExp(C+"(?="+C+")|"+ir+nr,"g");function cr(e){return e.match(xr)||[]}var _=cr;function gr(e){return b(e)?_(e):D(e)}var $=gr;function br(e){return function(a){a=m(a);var o=b(a)?$(a):void 0,u=o?o[0]:a.charAt(0),f=o?B(o,1).join(""):a.slice(1);return u[e]()+f}}var K=br;var hr=K("toUpperCase"),i=hr;function yr(e){return i(m(e).toLowerCase())}var Y=yr;r();t();r();t();function Cr(e,a,o,u){var f=-1,d=e==null?0:e.length;for(u&&d&&(o=e[++f]);++f<d;)o=a(o,e[f],f,e);return o}var Q=Cr;r();t();r();t();r();t();function Rr(e){return function(a){return e==null?void 0:e[a]}}var X=Rr;var Sr={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Ar=X(Sr),ee=Ar;var Nr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vr="\\u0300-\\u036f",Ir="\\ufe20-\\ufe2f",Or="\\u20d0-\\u20ff",Er=vr+Ir+Or,Tr="["+Er+"]",jr=RegExp(Tr,"g");function Mr(e){return e=m(e),e&&e.replace(Nr,ee).replace(jr,"")}var re=Mr;r();t();r();t();var wr=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function Wr(e){return e.match(wr)||[]}var te=Wr;r();t();var Fr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function Lr(e){return Fr.test(e)}var oe=Lr;r();t();var pe="\\ud800-\\udfff",kr="\\u0300-\\u036f",Ur="\\ufe20-\\ufe2f",Pr="\\u20d0-\\u20ff",zr=kr+Ur+Pr,le="\\u2700-\\u27bf",de="a-z\\xdf-\\xf6\\xf8-\\xff",Br="\\xac\\xb1\\xd7\\xf7",Dr="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Zr="\\u2000-\\u206f",qr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",me="A-Z\\xc0-\\xd6\\xd8-\\xde",Gr="\\ufe0e\\ufe0f",ne=Br+Dr+Zr+qr,ie="['\u2019]",ae="["+ne+"]",Hr="["+zr+"]",xe="\\d+",Vr="["+le+"]",ce="["+de+"]",ge="[^"+pe+ne+xe+le+de+me+"]",Jr="\\ud83c[\\udffb-\\udfff]",_r="(?:"+Hr+"|"+Jr+")",$r="[^"+pe+"]",be="(?:\\ud83c[\\udde6-\\uddff]){2}",he="[\\ud800-\\udbff][\\udc00-\\udfff]",x="["+me+"]",Kr="\\u200d",fe="(?:"+ce+"|"+ge+")",Yr="(?:"+x+"|"+ge+")",ue="(?:"+ie+"(?:d|ll|m|re|s|t|ve))?",se="(?:"+ie+"(?:D|LL|M|RE|S|T|VE))?",ye=_r+"?",Ce="["+Gr+"]?",Qr="(?:"+Kr+"(?:"+[$r,be,he].join("|")+")"+Ce+ye+")*",Xr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",et="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",rt=Ce+ye+Qr,tt="(?:"+[Vr,be,he].join("|")+")"+rt,ot=RegExp([x+"?"+ce+"+"+ue+"(?="+[ae,x,"$"].join("|")+")",Yr+"+"+se+"(?="+[ae,x+fe,"$"].join("|")+")",x+"?"+fe+"+"+ue,x+"+"+se,et,Xr,xe,tt].join("|"),"g");function at(e){return e.match(ot)||[]}var Re=at;function ft(e,a,o){return e=m(e),a=o?void 0:a,a===void 0?oe(e)?Re(e):te(e):e.match(a)||[]}var Se=ft;var ut="['\u2019]",st=RegExp(ut,"g");function pt(e){return function(a){return Q(Se(re(a).replace(st,"")),e,"")}}var Ae=pt;var lt=Ae(function(e,a,o){return a=a.toLowerCase(),e+(o?Y(a):a)}),h=lt;var dt=["use","clone","list"],mt="Requests",nt="Types",Ne=class e extends R{constructor({ir:o,config:u}){var f;super({ir:o,config:u});n(this,"ir");n(this,"customConfig");n(this,"dynamicTypeLiteralMapper");n(this,"filePropertyMapper");n(this,"rootNamespace");this.ir=o,this.customConfig=u.customConfig!=null?u.customConfig:void 0,this.dynamicTypeLiteralMapper=new S({context:this}),this.filePropertyMapper=new A({context:this}),this.rootNamespace=it({organization:u.organization,namespaceOverride:(f=this.customConfig)==null?void 0:f.namespace})}clone(){return new e({ir:this.ir,config:this.config})}getParameterName(o){return this.prependUnderscoreIfNeeded(o.camelCase.unsafeName)}getPropertyName(o){return this.prependUnderscoreIfNeeded(o.camelCase.unsafeName)}getMethodName(o){let u=o.camelCase.unsafeName;return dt.includes(u)?u:o.camelCase.safeName}getClassName(o){return o.pascalCase.safeName}getRootClientClassName(){var o,u,f;return((o=this.customConfig)==null?void 0:o.clientName)!=null?this.customConfig.clientName:((u=this.customConfig)==null?void 0:u["client-class-name"])!=null?(f=this.customConfig)==null?void 0:f["client-class-name"]:this.getComputedClientName()}getEnvironmentsClassReference(){return g.classReference({name:"Environments",namespace:this.rootNamespace})}getRequestNamespace(o){return this.getNamespace(o,mt)}getTypesNamespace(o){return this.getNamespace(o,nt)}getNamespace(o,u){let f=o.allParts.map(d=>d.pascalCase.safeName);return f=u!=null?[...f,u]:f,[this.rootNamespace,...f].join("\\")}getEnvironmentClassAccessFromID(o){let u=this.resolveEnvironmentName(o);if(u!=null)return g.codeblock(f=>{f.writeNode(this.getEnvironmentClassReference(u)),f.write("::"),f.write(this.getClassName(u))})}getEnvironmentClassReference(o){return g.classReference({name:"Environments",namespace:this.rootNamespace})}prependUnderscoreIfNeeded(o){return/^[a-zA-Z_]/.test(o)?o:`_${o}`}getComputedClientName(){return`${this.getOrganizationPascalCase()}Client`}getOrganizationPascalCase(){return`${i(h(this.config.organization))}`}};function it({organization:e,namespaceOverride:a}){return a!=null?a:`${i(h(e))}`}export{Ne as a};
2
2
  /*! Bundled license information:
3
3
 
4
4
  lodash-es/lodash.js:
@@ -1 +1 @@
1
- import{a}from"../chunk-BGMLQMW7.js";import"../chunk-G6X3OBKW.js";import"../chunk-7HKG5U5F.js";import"../chunk-YELOIV6Y.js";import"../chunk-ZFTBBCKC.js";export{a as DynamicSnippetsGeneratorContext};
1
+ import{a}from"../chunk-ZDJ3DR2Z.js";import"../chunk-JFJ3XGKL.js";import"../chunk-NXDI62IP.js";import"../chunk-HHDXN7HB.js";import"../chunk-LHXTVBUM.js";export{a as DynamicSnippetsGeneratorContext};
@@ -1 +1 @@
1
- import{a}from"../chunk-G6X3OBKW.js";import"../chunk-7HKG5U5F.js";import"../chunk-ZFTBBCKC.js";export{a as DynamicTypeLiteralMapper};
1
+ import{a}from"../chunk-JFJ3XGKL.js";import"../chunk-NXDI62IP.js";import"../chunk-LHXTVBUM.js";export{a as DynamicTypeLiteralMapper};
@@ -1 +1 @@
1
- import{a}from"../chunk-YELOIV6Y.js";import"../chunk-ZFTBBCKC.js";export{a as FilePropertyMapper};
1
+ import{a}from"../chunk-HHDXN7HB.js";import"../chunk-LHXTVBUM.js";export{a as FilePropertyMapper};