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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +18 -10
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -0
  3. package/cjs/DynamicSnippetsGenerator.d.cts +4 -4
  4. package/cjs/{DynamicSnippetsGeneratorContext-CpOvS1wA.d.cts → DynamicSnippetsGeneratorContext-BusKoNq4.d.cts} +10 -1
  5. package/cjs/EndpointSnippetGenerator.cjs +19 -11
  6. package/cjs/EndpointSnippetGenerator.cjs.map +1 -0
  7. package/cjs/EndpointSnippetGenerator.d.cts +15 -4
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +18 -10
  9. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -0
  10. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  11. package/cjs/context/DynamicTypeInstantiationMapper.cjs +19 -11
  12. package/cjs/context/DynamicTypeInstantiationMapper.cjs.map +1 -0
  13. package/cjs/context/DynamicTypeInstantiationMapper.d.cts +1 -1
  14. package/cjs/context/DynamicTypeMapper.cjs +18 -10
  15. package/cjs/context/DynamicTypeMapper.cjs.map +1 -0
  16. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  17. package/cjs/context/FilePropertyMapper.cjs +18 -10
  18. package/cjs/context/FilePropertyMapper.cjs.map +1 -0
  19. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  20. package/cjs/index.cjs +24 -28
  21. package/cjs/index.cjs.map +1 -0
  22. package/cjs/index.d.cts +2 -2
  23. package/esm/DynamicSnippetsGenerator.d.ts +4 -4
  24. package/esm/DynamicSnippetsGenerator.js +2 -1
  25. package/esm/DynamicSnippetsGenerator.js.map +1 -0
  26. package/esm/{DynamicSnippetsGeneratorContext-CpOvS1wA.d.ts → DynamicSnippetsGeneratorContext-BusKoNq4.d.ts} +10 -1
  27. package/esm/EndpointSnippetGenerator.d.ts +15 -4
  28. package/esm/EndpointSnippetGenerator.js +2 -1
  29. package/esm/EndpointSnippetGenerator.js.map +1 -0
  30. package/esm/chunk-2YRGTA73.js +2 -0
  31. package/esm/chunk-2YRGTA73.js.map +1 -0
  32. package/esm/chunk-BI26DLZ5.js +2 -0
  33. package/esm/chunk-BI26DLZ5.js.map +1 -0
  34. package/esm/chunk-D6NMQKNQ.js +2 -0
  35. package/esm/chunk-D6NMQKNQ.js.map +1 -0
  36. package/esm/chunk-FD44EP2P.js +2 -0
  37. package/esm/chunk-FD44EP2P.js.map +1 -0
  38. package/esm/chunk-GUJUKQKZ.js +37 -0
  39. package/esm/chunk-GUJUKQKZ.js.map +1 -0
  40. package/esm/chunk-Q6YO7G6Y.js +2 -0
  41. package/esm/chunk-Q6YO7G6Y.js.map +1 -0
  42. package/esm/chunk-UZEM7EUP.js +2 -0
  43. package/esm/chunk-UZEM7EUP.js.map +1 -0
  44. package/esm/chunk-VCNL2JWU.js +2 -0
  45. package/esm/chunk-VCNL2JWU.js.map +1 -0
  46. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  47. package/esm/context/DynamicSnippetsGeneratorContext.js +2 -1
  48. package/esm/context/DynamicSnippetsGeneratorContext.js.map +1 -0
  49. package/esm/context/DynamicTypeInstantiationMapper.d.ts +1 -1
  50. package/esm/context/DynamicTypeInstantiationMapper.js +2 -1
  51. package/esm/context/DynamicTypeInstantiationMapper.js.map +1 -0
  52. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  53. package/esm/context/DynamicTypeMapper.js +2 -1
  54. package/esm/context/DynamicTypeMapper.js.map +1 -0
  55. package/esm/context/FilePropertyMapper.d.ts +1 -1
  56. package/esm/context/FilePropertyMapper.js +2 -1
  57. package/esm/context/FilePropertyMapper.js.map +1 -0
  58. package/esm/index.d.ts +2 -2
  59. package/esm/index.js +2 -13
  60. package/esm/index.js.map +1 -0
  61. package/package.json +1 -1
  62. package/esm/chunk-55JFNSPF.js +0 -1
  63. package/esm/chunk-EQTG6W6V.js +0 -1
  64. package/esm/chunk-H7X5SHRQ.js +0 -1
  65. package/esm/chunk-IYOA724T.js +0 -1
  66. package/esm/chunk-LZIEHSJ7.js +0 -1
  67. package/esm/chunk-RX5QSNXP.js +0 -1
  68. package/esm/chunk-SX53R7DQ.js +0 -1
  69. package/esm/chunk-XL5OWIY6.js +0 -29
@@ -1 +0,0 @@
1
- import{b as c}from"./chunk-EQTG6W6V.js";import{j as p,k as l,m as d,n as s,q as i}from"./chunk-XL5OWIY6.js";l();d();var y=class{constructor({context:e}){p(this,"context");this.context=e}convert(e){if(e.value===null&&!this.context.isNullable(e.typeReference)&&this.context.errors.add({severity:c.Critical,message:"Expected non-null value, but got null"}),e.value==null)return i.TypeInstantiation.nop();switch(e.typeReference.type){case"list":return this.convertList({list:e.typeReference.value,value:e.value});case"literal":return i.TypeInstantiation.nop();case"map":return this.convertMap({map:e.typeReference,value:e.value});case"named":{let n=this.context.resolveNamedType({typeId:e.typeReference.value});return n==null?i.TypeInstantiation.nop():this.convertNamed({named:n,value:e.value,as:e.as})}case"nullable":return i.TypeInstantiation.optional(this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as}));case"optional":return i.TypeInstantiation.optional(this.convert({typeReference:e.typeReference.value,value:e.value,as:e.as}));case"primitive":return this.convertPrimitive({primitive:e.typeReference.value,value:e.value,as:e.as});case"set":return this.convertList({list:e.typeReference.value,value:e.value});case"unknown":return this.convertUnknown({value:e.value});default:s(e.typeReference)}}convertList({list:e,value:n}){return Array.isArray(n)?i.TypeInstantiation.slice({valueType:this.context.dynamicTypeMapper.convert({typeReference:e}),values:n.map((r,t)=>{this.context.errors.scope({index:t});try{return this.convert({typeReference:e,value:r})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:c.Critical,message:`Expected array but got: ${typeof n}`}),i.TypeInstantiation.nop())}convertMap({map:e,value:n}){return typeof n!="object"||n==null?(this.context.errors.add({severity:c.Critical,message:`Expected object but got: ${n==null?"null":typeof n}`}),i.TypeInstantiation.nop()):i.TypeInstantiation.map({keyType:this.context.dynamicTypeMapper.convert({typeReference:e.key}),valueType:this.context.dynamicTypeMapper.convert({typeReference:e.value}),entries:Object.entries(n).map(([r,t])=>{this.context.errors.scope(r);try{return{key:this.convert({typeReference:e.key,value:r,as:"key"}),value:this.convert({typeReference:e.value,value:t})}}finally{this.context.errors.unscope()}})})}convertNamed({named:e,value:n,as:r}){switch(e.type){case"alias":return this.convert({typeReference:e.typeReference,value:n,as:r});case"discriminatedUnion":return this.convertDiscriminatedUnion({discriminatedUnion:e,value:n});case"enum":return this.convertEnum({enum_:e,value:n});case"object":return this.convertObject({object_:e,value:n});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:e,value:n});default:s(e)}}convertDiscriminatedUnion({discriminatedUnion:e,value:n}){let r=this.context.getGoTypeReferenceFromDeclaration({declaration:e.declaration}),t=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:n});if(t==null)return i.TypeInstantiation.nop();let a=t.singleDiscriminatedUnionType,o=this.getBaseFields({discriminatedUnionTypeInstance:t,singleDiscriminatedUnionType:a});switch(a.type){case"samePropertiesAsObject":{let u=this.context.resolveNamedType({typeId:a.typeId});return u==null?i.TypeInstantiation.nop():i.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(a.discriminantValue.name),value:this.convertNamed({named:u,value:t.value})},...o]})}case"singleProperty":{let u=this.context.getRecord(t.value);if(u==null)return i.TypeInstantiation.nop();try{return this.context.errors.scope(a.discriminantValue.wireValue),i.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(a.discriminantValue.name),value:this.convert({typeReference:a.typeReference,value:u[a.discriminantValue.wireValue]})},...o]})}finally{this.context.errors.unscope()}}case"noProperties":return i.TypeInstantiation.structPointer({typeReference:r,fields:[{name:this.context.getTypeName(t.discriminantValue.name),value:i.TypeInstantiation.string(a.discriminantValue.wireValue)},...o]});default:s(a)}}getBaseFields({discriminatedUnionTypeInstance:e,singleDiscriminatedUnionType:n}){var t,a;return this.context.associateByWireValue({parameters:(t=n.properties)!=null?t:[],values:(a=this.context.getRecord(e.value))!=null?a:{},ignoreMissingParameters:!0}).map(o=>{this.context.errors.scope(o.name.wireValue);try{return{name:this.context.getTypeName(o.name.name),value:this.convert(o)}}finally{this.context.errors.unscope()}})}convertObject({object_:e,value:n}){var t;let r=this.context.associateByWireValue({parameters:e.properties,values:(t=this.context.getRecord(n))!=null?t:{}});return i.TypeInstantiation.structPointer({typeReference:i.typeReference({name:this.context.getTypeName(e.declaration.name),importPath:this.context.getImportPath(e.declaration.fernFilepath)}),fields:r.map(a=>{this.context.errors.scope(a.name.wireValue);try{return{name:this.context.getTypeName(a.name.name),value:this.convert(a)}}finally{this.context.errors.unscope()}})})}convertEnum({enum_:e,value:n}){let r=this.getEnumValueName({enum_:e,value:n});return r==null?i.TypeInstantiation.nop():i.TypeInstantiation.enum(i.typeReference({name:r,importPath:this.context.getImportPath(e.declaration.fernFilepath)}))}getEnumValueName({enum_:e,value:n}){if(typeof n!="string"){this.context.errors.add({severity:c.Critical,message:`Expected enum value string, got: ${typeof n}`});return}let r=e.values.find(t=>t.wireValue===n);if(r==null){this.context.errors.add({severity:c.Critical,message:`An enum value named "${n}" does not exist in this context`});return}return`${this.context.getTypeName(e.declaration.name)}${this.context.getTypeName(r.name)}`}convertUndiscriminatedUnion({undiscriminatedUnion:e,value:n}){let r=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:n});if(r==null)return i.TypeInstantiation.nop();let t=this.getUndiscriminatedUnionFieldName({typeReference:r.valueTypeReference});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.structPointer({typeReference:this.context.getGoTypeReferenceFromDeclaration({declaration:e.declaration}),fields:[{name:t,value:r.typeInstantiation}]})}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:e,value:n}){for(let r of e.types)try{let t=this.convert({typeReference:r,value:n});return{valueTypeReference:r,typeInstantiation:t}}catch(t){continue}this.context.errors.add({severity:c.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof n}" value`})}getUndiscriminatedUnionFieldName({typeReference:e}){switch(e.type){case"list":return this.getUndiscriminatedUnionFieldNameForList({list:e});case"literal":return this.getUndiscriminatedUnionFieldNameForLiteral({literal:e.value});case"map":return this.getUndiscriminatedUnionFieldNameForMap({map:e});case"named":{let n=this.context.resolveNamedType({typeId:e.value});return n==null?void 0:this.context.getTypeName(n.declaration.name)}case"optional":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"nullable":return this.getUndiscriminatedUnionFieldNameForOptional({typeReference:e});case"primitive":return this.getUndiscriminatedUnionFieldNameForPrimitive({primitive:e.value});case"set":return this.getUndiscriminatedUnionFieldNameForSet({set:e});case"unknown":return"Unknown";default:s(e)}}getUndiscriminatedUnionFieldNameForList({list:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e});if(n!=null)return`${n}List`}getUndiscriminatedUnionFieldNameForMap({map:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e.key});if(n==null)return;let r=this.getUndiscriminatedUnionFieldName({typeReference:e.value});if(r!=null)return`${n}${r}Map`}getUndiscriminatedUnionFieldNameForOptional({typeReference:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e});if(n!=null)return`${n}Optional`}getUndiscriminatedUnionFieldNameForSet({set:e}){let n=this.getUndiscriminatedUnionFieldName({typeReference:e});if(n!=null)return`${n}Set`}getUndiscriminatedUnionFieldNameForLiteral({literal:e}){switch(e.type){case"boolean":return e.value?"TrueLiteral":"FalseLiteral";case"string":return`${e.value}StringLiteral`;default:s(e)}}getUndiscriminatedUnionFieldNameForPrimitive({primitive:e}){switch(e){case"INTEGER":case"UINT":return"Integer";case"LONG":case"UINT_64":return"Long";case"FLOAT":case"DOUBLE":return"Double";case"BOOLEAN":return"Boolean";case"BIG_INTEGER":case"STRING":return"String";case"UUID":return"Uuid";case"DATE":return"Date";case"DATE_TIME":return"DateTime";case"BASE_64":return"Base64";default:s(e)}}convertUnknown({value:e}){return i.TypeInstantiation.any(e)}convertPrimitive({primitive:e,value:n,as:r}){switch(e){case"INTEGER":case"UINT":{let t=this.getValueAsNumber({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.int(t)}case"LONG":case"UINT_64":{let t=this.getValueAsNumber({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.int64(t)}case"FLOAT":case"DOUBLE":{let t=this.getValueAsNumber({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.float64(t)}case"BOOLEAN":{let t=this.getValueAsBoolean({value:n,as:r});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.bool(t)}case"STRING":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.string(t)}case"DATE":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.date(t)}case"DATE_TIME":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.dateTime(t)}case"UUID":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.uuid(t)}case"BASE_64":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.bytes(t)}case"BIG_INTEGER":{let t=this.context.getValueAsString({value:n});return t==null?i.TypeInstantiation.nop():i.TypeInstantiation.string(t)}default:s(e)}}getValueAsNumber({value:e,as:n}){let r=n==="key"&&typeof e=="string"?Number(e):e;return this.context.getValueAsNumber({value:r})}getValueAsBoolean({value:e,as:n}){let r=n==="key"?typeof e=="string"?e==="true":e==="false"?!1:e:e;return this.context.getValueAsBoolean({value:r})}};export{y as a};
@@ -1 +0,0 @@
1
- import{a as c}from"./chunk-IYOA724T.js";import{c as a}from"./chunk-EQTG6W6V.js";import{a as m}from"./chunk-RX5QSNXP.js";import{a as s}from"./chunk-55JFNSPF.js";import{j as r,k as i,m as o,p,q as n}from"./chunk-XL5OWIY6.js";i();o();var u=class f extends a{constructor({ir:e,config:t}){super({ir:e,config:t});r(this,"ir");r(this,"customConfig");r(this,"dynamicTypeMapper");r(this,"dynamicTypeInstantiationMapper");r(this,"filePropertyMapper");r(this,"rootImportPath");this.ir=e,this.customConfig=t.customConfig!=null?t.customConfig:void 0,this.dynamicTypeMapper=new m({context:this}),this.dynamicTypeInstantiationMapper=new c({context:this}),this.filePropertyMapper=new s({context:this}),this.rootImportPath=p({config:t,customConfig:this.customConfig})}clone(){return new f({ir:this.ir,config:this.config})}getMethodName(e){return e.pascalCase.unsafeName}getTypeName(e){return e.pascalCase.unsafeName}getImportPath(e){let t=e.packagePath.map(g=>g.pascalCase.unsafeName.toLowerCase());return[this.rootImportPath,...t].join("/")}getContextTypeReference(){return n.typeReference({name:"Context",importPath:"context"})}getContextTodoFunctionInvocation(){return n.invokeFunc({func:n.typeReference({name:"TODO",importPath:"context"}),arguments_:[]})}getIoReaderTypeReference(){return n.typeReference({name:"Reader",importPath:"io"})}getNewStringsReaderFunctionInvocation(e){return n.invokeFunc({func:n.typeReference({name:"NewReader",importPath:"strings"}),arguments_:[n.TypeInstantiation.string(e)]})}getClientConstructorName(){var e,t;return((e=this.customConfig)==null?void 0:e.clientConstructorName)!=null?this.customConfig.clientConstructorName:((t=this.customConfig)==null?void 0:t.exportedClientName)!=null?`New${this.customConfig.exportedClientName}`:`New${this.getClientName()}`}getClientName(){var e;return((e=this.customConfig)==null?void 0:e.clientName)!=null?this.customConfig.clientName:"Client"}getClientImportPath(){var e;return((e=this.customConfig)==null?void 0:e.packageLayout)==="flat"?this.rootImportPath:`${this.rootImportPath}/client`}getOptionImportPath(){return`${this.rootImportPath}/option`}getGoTypeReferenceFromDeclaration({declaration:e}){return n.typeReference({name:e.name.pascalCase.unsafeName,importPath:this.getImportPath(e.fernFilepath)})}getEnvironmentTypeReferenceFromID(e){let t=this.resolveEnvironmentName(e);if(t!=null)return this.getEnvironmentTypeReference(t)}getEnvironmentTypeReference(e){return n.typeReference({name:`Environments.${this.getTypeName(e)}`,importPath:this.rootImportPath})}};export{u as a};
@@ -1 +0,0 @@
1
- import{j as c,k as i,m as p,n,q as e}from"./chunk-XL5OWIY6.js";i();p();var a=class{constructor({context:t}){c(this,"context");this.context=t}convert(t){switch(t.typeReference.type){case"list":return e.Type.slice(this.convert({typeReference:t.typeReference}));case"literal":return this.convertLiteral({literal:t.typeReference.value});case"map":return e.Type.map(this.convert({typeReference:t.typeReference.key}),this.convert({typeReference:t.typeReference.value}));case"named":{let r=this.context.resolveNamedType({typeId:t.typeReference.value});return r==null?this.convertUnknown():this.convertNamed({named:r})}case"optional":return e.Type.optional(this.convert({typeReference:t.typeReference.value}));case"nullable":return e.Type.optional(this.convert({typeReference:t.typeReference.value}));case"primitive":return this.convertPrimitive({primitive:t.typeReference.value});case"set":return e.Type.slice(this.convert({typeReference:t.typeReference}));case"unknown":return this.convertUnknown();default:n(t.typeReference)}}convertLiteral({literal:t}){switch(t.type){case"boolean":return e.Type.bool();case"string":return e.Type.string()}}convertNamed({named:t}){let r=e.Type.reference(e.typeReference({name:this.context.getTypeName(t.declaration.name),importPath:this.context.getImportPath(t.declaration.fernFilepath)}));switch(t.type){case"alias":case"enum":return r;case"discriminatedUnion":case"object":case"undiscriminatedUnion":return e.Type.pointer(r);default:n(t)}}convertUnknown(){return e.Type.any()}convertPrimitive({primitive:t}){switch(t){case"INTEGER":return e.Type.int();case"UINT":return e.Type.int();case"LONG":return e.Type.int64();case"UINT_64":return e.Type.int64();case"FLOAT":return e.Type.float64();case"DOUBLE":return e.Type.float64();case"BOOLEAN":return e.Type.bool();case"STRING":return e.Type.string();case"DATE":return e.Type.date();case"DATE_TIME":return e.Type.dateTime();case"UUID":return e.Type.uuid();case"BASE_64":return e.Type.bytes();case"BIG_INTEGER":return e.Type.string();default:n(t)}}};export{a};
@@ -1 +0,0 @@
1
- import{a as p}from"./chunk-H7X5SHRQ.js";import{a as i}from"./chunk-LZIEHSJ7.js";import{a as o}from"./chunk-EQTG6W6V.js";import{j as r,k as t,m as n}from"./chunk-XL5OWIY6.js";t();n();var a=class extends o{constructor({ir:e,config:m,formatter:c}){super(new i({ir:e,config:m}));r(this,"formatter");this.formatter=c}async generate(e){return super.generate(e)}generateSync(e){return super.generateSync(e)}createSnippetGenerator(e){return new p({context:e,formatter:this.formatter})}};export{a};
@@ -1,29 +0,0 @@
1
- var Qe=Object.create;var X=Object.defineProperty,Xe=Object.defineProperties,qe=Object.getOwnPropertyDescriptor,Ke=Object.getOwnPropertyDescriptors,et=Object.getOwnPropertyNames,ie=Object.getOwnPropertySymbols,tt=Object.getPrototypeOf,we=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var me=(r,t,e)=>t in r?X(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$r=(r,t)=>{for(var e in t||(t={}))we.call(t,e)&&me(r,e,t[e]);if(ie)for(var e of ie(t))ve.call(t,e)&&me(r,e,t[e]);return r},Or=(r,t)=>Xe(r,Ke(t));var Wr=r=>typeof r=="symbol"?r:r+"",Vr=(r,t)=>{var e={};for(var n in r)we.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&ie)for(var n of ie(r))t.indexOf(n)<0&&ve.call(r,n)&&(e[n]=r[n]);return e};var de=(r,t)=>()=>(r&&(t=r(r=0)),t);var Gr=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),rt=(r,t)=>{for(var e in t)X(r,e,{get:t[e],enumerable:!0})},Ne=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of et(t))!we.call(r,i)&&i!==e&&X(r,i,{get:()=>t[i],enumerable:!(n=qe(t,i))||n.enumerable});return r};var Hr=(r,t,e)=>(e=r!=null?Qe(tt(r)):{},Ne(t||!r||!r.__esModule?X(e,"default",{value:r,enumerable:!0}):e,r)),Jr=r=>Ne(X({},"__esModule",{value:!0}),r);var c=(r,t,e)=>me(r,typeof t!="symbol"?t+"":t,e);function Re(){throw new Error("setTimeout has not been defined")}function _e(){throw new Error("clearTimeout has not been defined")}function ke(r){if(M===setTimeout)return setTimeout(r,0);if((M===Re||!M)&&setTimeout)return M=setTimeout,setTimeout(r,0);try{return M(r,0)}catch(t){try{return M.call(null,r,0)}catch(e){return M.call(this,r,0)}}}function nt(r){if(Y===clearTimeout)return clearTimeout(r);if((Y===_e||!Y)&&clearTimeout)return Y=clearTimeout,clearTimeout(r);try{return Y(r)}catch(t){try{return Y.call(null,r)}catch(e){return Y.call(this,r)}}}function it(){!Q||!D||(Q=!1,D.length?P=D.concat(P):oe=-1,P.length&&Se())}function Se(){if(!Q){var r=ke(it);Q=!0;for(var t=P.length;t;){for(D=P,P=[];++oe<t;)D&&D[oe].run();oe=-1,t=P.length}D=null,Q=!1,nt(r)}}function ot(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];P.push(new Le(r,t)),P.length===1&&!Q&&ke(Se)}function Le(r,t){this.fun=r,this.array=t}function C(){}function Et(r){throw new Error("process.binding is not supported")}function vt(){return"/"}function Nt(r){throw new Error("process.chdir is not supported")}function It(){return 0}function _t(r){var t=Rt.call(Z)*.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 St(){var r=new Date,t=r-kt;return t/1e3}var M,Y,P,Q,D,oe,st,at,ut,ft,ct,ht,pt,lt,mt,wt,dt,xt,yt,gt,Tt,At,Z,Rt,kt,m,Ie,u=de(()=>{"use strict";M=Re,Y=_e;typeof globalThis.setTimeout=="function"&&(M=setTimeout);typeof globalThis.clearTimeout=="function"&&(Y=clearTimeout);P=[],Q=!1,oe=-1;Le.prototype.run=function(){this.fun.apply(null,this.array)};st="browser",at="browser",ut=!0,ft={},ct=[],ht="",pt={},lt={},mt={};wt=C,dt=C,xt=C,yt=C,gt=C,Tt=C,At=C;Z=globalThis.performance||{},Rt=Z.now||Z.mozNow||Z.msNow||Z.oNow||Z.webkitNow||function(){return new Date().getTime()};kt=new Date;m={nextTick:ot,title:st,browser:ut,env:ft,argv:ct,version:ht,versions:pt,on:wt,addListener:dt,once:xt,off:yt,removeListener:gt,removeAllListeners:Tt,emit:At,binding:Et,cwd:vt,chdir:Nt,umask:It,hrtime:_t,platform:at,release:lt,config:mt,uptime:St},Ie={};Object.keys(Ie).forEach(r=>{let t=r.split("."),e=m;for(let n=0;n<t.length;n++){let i=t[n];n===t.length-1?e[i]=Ie[r]:e=e[i]||(e[i]={})}})});function Ue(){ye=!0;for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,e=r.length;t<e;++t)_[t]=r[t],E[r.charCodeAt(t)]=t;E[45]=62,E[95]=63}function Pt(r){ye||Ue();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 Lt(h*3/4-o),n=o>0?h-4:h;var p=0;for(t=0,e=0;t<n;t+=4,e+=3)i=E[r.charCodeAt(t)]<<18|E[r.charCodeAt(t+1)]<<12|E[r.charCodeAt(t+2)]<<6|E[r.charCodeAt(t+3)],s[p++]=i>>16&255,s[p++]=i>>8&255,s[p++]=i&255;return o===2?(i=E[r.charCodeAt(t)]<<2|E[r.charCodeAt(t+1)]>>4,s[p++]=i&255):o===1&&(i=E[r.charCodeAt(t)]<<10|E[r.charCodeAt(t+1)]<<4|E[r.charCodeAt(t+2)]>>2,s[p++]=i>>8&255,s[p++]=i&255),s}function bt(r){return _[r>>18&63]+_[r>>12&63]+_[r>>6&63]+_[r&63]}function Bt(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(bt(n));return i.join("")}function Pe(r){ye||Ue();for(var t,e=r.length,n=e%3,i="",o=[],s=16383,h=0,p=e-n;h<p;h+=s)o.push(Bt(r,h,h+s>p?p:h+s));return n===1?(t=r[e-1],i+=_[t>>2],i+=_[t<<4&63],i+="=="):n===2&&(t=(r[e-2]<<8)+r[e-1],i+=_[t>>10],i+=_[t>>4&63],i+=_[t<<2&63],i+="="),o.push(i),o.join("")}function se(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function b(r,t){if(se()<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 ge(this,r)}return Me(this,r,t,e)}function Me(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?Yt(r,t,e,n):typeof t=="string"?Mt(r,t,e):Dt(r,t)}function Ye(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 Ut(r,t,e,n){return Ye(t),t<=0?b(r,t):e!==void 0?typeof n=="string"?b(r,t).fill(e,n):b(r,t).fill(e):b(r,t)}function ge(r,t){if(Ye(t),r=b(r,t<0?0:Te(t)|0),!a.TYPED_ARRAY_SUPPORT)for(var e=0;e<t;++e)r[e]=0;return r}function Mt(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=De(t,e)|0;r=b(r,n);var i=r.write(t,e);return i!==n&&(r=r.slice(0,i)),r}function xe(r,t){var e=t.length<0?0:Te(t.length)|0;r=b(r,e);for(var n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Yt(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=xe(r,t),r}function Dt(r,t){if(k(t)){var e=Te(t.length)|0;return r=b(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"||rr(t.length)?b(r,0):xe(r,t);if(t.type==="Buffer"&&Array.isArray(t.data))return xe(r,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function Te(r){if(r>=se())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+se().toString(16)+" bytes");return r|0}function k(r){return!!(r!=null&&r._isBuffer)}function De(r,t){if(k(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 ae(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return Ge(r).length;default:if(n)return ae(r).length;t=(""+t).toLowerCase(),n=!0}}function Ct(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 zt(this,t,e);case"utf8":case"utf-8":return $e(this,t,e);case"ascii":return Jt(this,t,e);case"latin1":case"binary":return jt(this,t,e);case"base64":return Gt(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Zt(this,t,e);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}function F(r,t,e){var n=r[t];r[t]=r[e],r[e]=n}function Ce(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)),k(t))return t.length===0?-1:be(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):be(r,[t],e,n,i);throw new TypeError("val must be string, number or Buffer")}function be(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 p(A,z){return o===1?A[z]:A.readUInt16BE(z*o)}var w;if(i){var d=-1;for(w=e;w<s;w++)if(p(r,w)===p(t,d===-1?0:w-d)){if(d===-1&&(d=w),w-d+1===h)return d*o}else d!==-1&&(w-=w-d),d=-1}else for(e+h>s&&(e=s-h),w=e;w>=0;w--){for(var l=!0,I=0;I<h;I++)if(p(r,w+I)!==p(t,I)){l=!1;break}if(l)return w}return-1}function Ft(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 $t(r,t,e,n){return ce(ae(t,r.length-e),r,e,n)}function Fe(r,t,e,n){return ce(er(t),r,e,n)}function Ot(r,t,e,n){return Fe(r,t,e,n)}function Wt(r,t,e,n){return ce(Ge(t),r,e,n)}function Vt(r,t,e,n){return ce(tr(t,r.length-e),r,e,n)}function Gt(r,t,e){return t===0&&e===r.length?Pe(r):Pe(r.slice(t,e))}function $e(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 p,w,d,l;switch(h){case 1:o<128&&(s=o);break;case 2:p=r[i+1],(p&192)===128&&(l=(o&31)<<6|p&63,l>127&&(s=l));break;case 3:p=r[i+1],w=r[i+2],(p&192)===128&&(w&192)===128&&(l=(o&15)<<12|(p&63)<<6|w&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:p=r[i+1],w=r[i+2],d=r[i+3],(p&192)===128&&(w&192)===128&&(d&192)===128&&(l=(o&15)<<18|(p&63)<<12|(w&63)<<6|d&63,l>65535&&l<1114112&&(s=l))}}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 Ht(n)}function Ht(r){var t=r.length;if(t<=Be)return String.fromCharCode.apply(String,r);for(var e="",n=0;n<t;)e+=String.fromCharCode.apply(String,r.slice(n,n+=Be));return e}function Jt(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 jt(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 zt(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+=Kt(r[o]);return i}function Zt(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 g(r,t,e,n,i,o){if(!k(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 ue(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 fe(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 Oe(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 We(r,t,e,n,i){return i||Oe(r,t,e,4,34028234663852886e22,-34028234663852886e22),Je(r,t,e,n,23,4),e+4}function Ve(r,t,e,n,i){return i||Oe(r,t,e,8,17976931348623157e292,-17976931348623157e292),Je(r,t,e,n,52,8),e+8}function Xt(r){if(r=qt(r).replace(Qt,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function qt(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Kt(r){return r<16?"0"+r.toString(16):r.toString(16)}function ae(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 er(r){for(var t=[],e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function tr(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 Ge(r){return Pt(Xt(r))}function ce(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 rr(r){return r!==r}function nr(r){return r!=null&&(!!r._isBuffer||He(r)||ir(r))}function He(r){return!!r.constructor&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}function ir(r){return typeof r.readFloatLE=="function"&&typeof r.slice=="function"&&He(r.slice(0,0))}function he(r,t,e,n,i){var o,s,h=i*8-n-1,p=(1<<h)-1,w=p>>1,d=-7,l=e?i-1:0,I=e?-1:1,A=r[t+l];for(l+=I,o=A&(1<<-d)-1,A>>=-d,d+=h;d>0;o=o*256+r[t+l],l+=I,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=n;d>0;s=s*256+r[t+l],l+=I,d-=8);if(o===0)o=1-w;else{if(o===p)return s?NaN:(A?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-w}return(A?-1:1)*s*Math.pow(2,o-n)}function Je(r,t,e,n,i,o){var s,h,p,w=o*8-i-1,d=(1<<w)-1,l=d>>1,I=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:o-1,z=n?1:-1,Ze=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=d):(s=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-s))<1&&(s--,p*=2),s+l>=1?t+=I/p:t+=I*Math.pow(2,1-l),t*p>=2&&(s++,p/=2),s+l>=d?(h=0,s=d):s+l>=1?(h=(t*p-1)*Math.pow(2,i),s=s+l):(h=t*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;r[e+A]=h&255,A+=z,h/=256,i-=8);for(s=s<<i|h,w+=i;w>0;r[e+A]=s&255,A+=z,s/=256,w-=8);r[e+A-z]|=Ze*128}var _,E,Lt,ye,Be,Qt,je=de(()=>{"use strict";u();f();_=[],E=[],Lt=typeof Uint8Array!="undefined"?Uint8Array:Array,ye=!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 Me(null,r,t,e)};a.kMaxLength=se();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 Ut(null,r,t,e)};a.allocUnsafe=function(r){return ge(null,r)};a.allocUnsafeSlow=function(r){return ge(null,r)};a.isBuffer=nr;a.compare=function(t,e){if(!k(t)||!k(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(!k(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i};a.byteLength=De;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)F(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)F(this,e,e+3),F(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)F(this,e,e+7),F(this,e+1,e+6),F(this,e+2,e+5),F(this,e+3,e+4);return this};a.prototype.toString=function(){var t=this.length|0;return t===0?"":arguments.length===0?$e(this,0,t):Ct.apply(this,arguments)};a.prototype.equals=function(t){if(!k(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(!k(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,p=Math.min(s,h),w=this.slice(i,o),d=t.slice(e,n),l=0;l<p;++l)if(w[l]!==d[l]){s=w[l],h=d[l];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 Ce(this,t,e,n,!0)};a.prototype.lastIndexOf=function(t,e,n){return Ce(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 Ft(this,t,e,n);case"utf8":case"utf-8":return $t(this,t,e,n);case"ascii":return Fe(this,t,e,n);case"latin1":case"binary":return Ot(this,t,e,n);case"base64":return Wt(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vt(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)}};Be=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),he(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,e){return e||y(t,4,this.length),he(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,e){return e||y(t,8,this.length),he(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,e){return e||y(t,8,this.length),he(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;g(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;g(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||g(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||g(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ue(this,t,e,!0),e+2};a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=e|0,n||g(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ue(this,t,e,!1),e+2};a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=e|0,n||g(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):fe(this,t,e,!0),e+4};a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=e|0,n||g(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):fe(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);g(this,t,e,n,o-1,-o)}var s=0,h=1,p=0;for(this[e]=t&255;++s<n&&(h*=256);)t<0&&p===0&&this[e+s-1]!==0&&(p=1),this[e+s]=(t/h>>0)-p&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);g(this,t,e,n,o-1,-o)}var s=n-1,h=1,p=0;for(this[e+s]=t&255;--s>=0&&(h*=256);)t<0&&p===0&&this[e+s+1]!==0&&(p=1),this[e+s]=(t/h>>0)-p&255;return e+n};a.prototype.writeInt8=function(t,e,n){return t=+t,e=e|0,n||g(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||g(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t&255,this[e+1]=t>>>8):ue(this,t,e,!0),e+2};a.prototype.writeInt16BE=function(t,e,n){return t=+t,e=e|0,n||g(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=t&255):ue(this,t,e,!1),e+2};a.prototype.writeInt32LE=function(t,e,n){return t=+t,e=e|0,n||g(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):fe(this,t,e,!0),e+4};a.prototype.writeInt32BE=function(t,e,n){return t=+t,e=e|0,n||g(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):fe(this,t,e,!1),e+4};a.prototype.writeFloatLE=function(t,e,n){return We(this,t,e,!0,n)};a.prototype.writeFloatBE=function(t,e,n){return We(this,t,e,!1,n)};a.prototype.writeDoubleLE=function(t,e,n){return Ve(this,t,e,!0,n)};a.prototype.writeDoubleBE=function(t,e,n){return Ve(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=k(t)?t:ae(new a(t,i).toString()),p=h.length;for(s=0;s<n-e;++s)this[s+e]=h[s%p]}return this};Qt=/[^+\/0-9A-Za-z-_]/g});var f=de(()=>{"use strict";je()});u();f();function q(r){throw new Error("Unexpected value: "+JSON.stringify(r))}u();f();u();f();function or(r){return Object.keys(r)}u();f();u();f();u();f();function K(r,t){var n,i;let e=(n=r.split("/").pop())!=null?n:r;return t!=null&&t.stripExtension&&(i=e.split(".")[0])!=null?i:e}var sr="sdk";function ar({config:r,customConfig:t}){let e=fr({config:r}),n=ur({config:r,customConfig:t});return e!=null?hr({importPath:n,majorVersion:e}):n}function ur({config:r,customConfig:t}){var e,n,i;return(i=(n=t==null?void 0:t.importPath)!=null?n:(e=t==null?void 0:t.module)==null?void 0:e.path)!=null?i:r.output.mode.type==="github"?pr(r.output.mode.repoUrl,"https://"):sr}function fr({config:r}){let t=cr({config:r});if(!(t==null||t==="v0"||t==="v1"))return`${t}`}function cr({config:r}){let t=lr(r);if(t==null)return;let e=t.split(".");if(e[0]==null)return;let n=e[0];return n.startsWith("v")?n:`v${n}`}function hr({importPath:r,majorVersion:t}){return K(r)===t?r:`${r}/${t}`}function pr(r,t){return r.startsWith(t)?r.slice(t.length):r}function lr(r){var e;let t=(e=r==null?void 0:r.output)==null?void 0:e.mode;if(t!=null)return t.type==="github"||t.type==="publish"?t.version:void 0}var Ee={};rt(Ee,{AstNode:()=>x,CodeBlock:()=>L,Enum:()=>W,Field:()=>V,File:()=>G,Func:()=>H,FuncInvocation:()=>R,Method:()=>B,MethodInvocation:()=>U,Parameter:()=>J,Struct:()=>j,Type:()=>ne,TypeInstantiation:()=>N,TypeReference:()=>T,Writer:()=>O,codeblock:()=>Sr,enum_:()=>Lr,field:()=>Pr,file:()=>br,func:()=>Br,invokeFunc:()=>Ur,invokeMethod:()=>Mr,method:()=>Yr,parameter:()=>Dr,struct:()=>Cr,typeReference:()=>Fr});u();f();u();f();u();f();u();f();u();f();var $=class{};u();f();u();f();var S=class extends ${constructor(e){super();c(this,"value");this.value=e}write(e){typeof this.value=="string"?e.write(this.value):this.value(e)}};var mr=4,ee=class{constructor(){c(this,"buffer","");c(this,"indentLevel",0);c(this,"hasWrittenAnything",!1);c(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 S(t).write(this),this.write(";"),this.writeNewLineIfLastLineNot()}controlFlow(t,e){new S(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}endControlFlow(){this.dedent(),this.writeLine("}")}contiguousControlFlow(t,e){this.dedent(),this.write("} "),new S(t).write(this),this.write(" ("),this.writeNode(e),this.write(") {"),this.writeNewLineIfLastLineNot(),this.indent()}alternativeControlFlow(t){this.dedent(),this.write("} "),new S(t).write(this),this.write(" {"),this.writeNewLineIfLastLineNot(),this.indent()}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*mr)}};u();f();var pe=class{},te=class extends pe{async format(t){return t}formatSync(t){return t}};u();f();function Ae(r){return(r==null?void 0:r.name)!=null}u();f();u();f();u();f();var wr=/[^0-9a-zA-Z_]/g,O=class extends ee{constructor({packageName:e,rootImportPath:n,importPath:i,customConfig:o,formatter:s}){super();c(this,"packageName");c(this,"rootImportPath");c(this,"importPath");c(this,"customConfig");c(this,"formatter");c(this,"imports",{});this.packageName=e,this.rootImportPath=n,this.importPath=i,this.customConfig=o,this.formatter=s!=null?s:new te}addImport(e){let n=this.imports[e];if(n!=null)return n;let i=new Set(Object.values(this.imports)),o=this.getValidAlias(K(e));for(;i.has(o);)o="_"+o;return this.imports[e]=o,o}getValidAlias(e){let n=e.split("-");return n[0]==null?e:n[0].replace(wr,"")}};var re=class extends O{constructor({packageName:t,rootImportPath:e,importPath:n,customConfig:i,formatter:o}){super({packageName:t,rootImportPath:e,importPath:n,customConfig:i,formatter:o})}async toStringAsync(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.format(t)}catch(e){throw new Error(`Failed to format Go file: ${e}
9
- ${t}`)}return t}toString(){let t=this.getContent();if(this.formatter!=null)try{return this.formatter.formatSync(t)}catch(e){throw new Error(`Failed to format Go file: ${e}
10
- ${t}`)}return t}getContent(){let t=`package ${this.packageName}
11
-
12
- `,e=this.stringifyImports();return e.length>0?`${t}${e}
13
-
14
- ${this.buffer}`:t+this.buffer}stringifyImports(){let t=Object.entries(this.imports).filter(([e,n])=>e!==this.importPath).map(([e,n])=>` ${n} "${e}"`).join(`
15
- `);return t?`import (
16
- ${t}
17
- )`:""}};var x=class extends ${async toStringAsync({packageName:t,rootImportPath:e,importPath:n,customConfig:i,formatter:o}){let s=new re({packageName:t,rootImportPath:e,importPath:n,customConfig:i,formatter:o});return this.write(s),s.toStringAsync()}toString({packageName:t,rootImportPath:e,importPath:n,customConfig:i,formatter:o}){let s=new re({packageName:t,rootImportPath:e,importPath:n,customConfig:i,formatter:o});return this.write(s),s.toString()}};var L=class extends x{constructor(e){super();c(this,"arg");this.arg=e}write(e){return new S(this.arg).write(e)}};u();f();u();f();var v=class extends x{constructor({docs:e}={}){super();c(this,"docs");this.docs=e}write(e){this.docs!=null&&this.docs.split(`
18
- `).forEach(n=>{e.writeLine(`// ${n}`)})}};var W=class extends x{constructor({name:e,docs:n}){super();c(this,"name");c(this,"docs");c(this,"members",[]);this.name=e,this.docs=n}addMember(e){this.members.push(e)}write(e){e.writeNode(new v({docs:this.docs})),e.write(`type ${this.name} string`)}};u();f();var V=class extends x{constructor({name:e,type:n,docs:i}){super();c(this,"name");c(this,"type");c(this,"docs");this.name=e,this.type=n,this.docs=i}write(e){e.writeNode(new v({docs:this.docs})),e.write(`${this.name} `),this.type.write(e)}};u();f();var G=class extends x{constructor({nodes:e}={nodes:[]}){super();c(this,"nodes");this.nodes=e!=null?e:[]}add(...e){this.nodes.push(...e)}write(e){for(let n of this.nodes)n.write(e)}};u();f();u();f();var B=class extends x{constructor({name:e,parameters:n,return_:i,body:o,docs:s,typeReference:h}){super();c(this,"name");c(this,"parameters");c(this,"return_");c(this,"body");c(this,"docs");c(this,"typeReference");this.name=e,this.parameters=n,this.return_=i,this.body=o,this.docs=s,this.typeReference=h}write(e){var n;if(e.writeNode(new v({docs:this.docs})),e.write("func "),this.typeReference!=null&&this.writeReceiver({writer:e,typeReference:this.typeReference}),e.write(`${this.name}`),this.parameters.length===0)e.write("() ");else{e.writeLine("(");for(let i of this.parameters)e.writeNode(i),e.writeLine(",");e.write(")")}this.return_!=null&&(e.write("("),this.return_.forEach((i,o)=>{o>0&&e.write(", "),e.writeNode(i)}),e.write(")")),e.writeLine(" {"),e.indent(),(n=this.body)==null||n.write(e),e.dedent(),e.writeNewLineIfLastLineNot(),e.writeLine("}")}writeReceiver({writer:e,typeReference:n}){e.write(`(${this.getReceiverName(n.name)} `),n.write(e),e.write(") ")}getReceiverName(e){return e.charAt(0).toLowerCase()}};var H=class extends x{constructor({name:e,parameters:n,return_:i,body:o,docs:s}){super();c(this,"func");this.func=new B({name:e,parameters:n,return_:i,body:o,docs:s})}get name(){return this.func.name}get parameters(){return this.func.parameters}get return_(){return this.func.return_}get body(){return this.func.body}get docs(){return this.func.docs}write(e){e.writeNode(this.func)}};u();f();u();f();u();f();u();f();var T=class extends x{constructor({name:e,importPath:n}){super();c(this,"name");c(this,"importPath");this.name=e,this.importPath=n}write(e){if(e.importPath===this.importPath){e.write(this.name);return}let n=e.addImport(this.importPath);e.write(`${n}.${this.name}`)}};u();f();var U=class extends x{constructor({method:e,arguments_:n,on:i}){super();c(this,"on");c(this,"method");c(this,"arguments_");this.on=i,this.method=e,this.arguments_=n}write(e){this.on.write(e),e.write("."),e.write(this.method),le({writer:e,arguments_:this.arguments_})}};var dr=new Set(["bool","date","dateTime","float64","int","int64","string","uuid"]),ze=new Set(["any","bytes","map","slice"]),N=class r extends x{constructor(e){super();c(this,"internalType");this.internalType=e}write(e){switch(this.internalType.type){case"any":this.writeAny({writer:e,value:this.internalType.value});break;case"bool":e.write(this.internalType.value.toString());break;case"bytes":e.write(`[]byte("${this.internalType.value}")`);break;case"date":case"dateTime":e.writeNode(gr({writer:e,type:this.internalType}));break;case"enum":e.writeNode(this.internalType.typeReference);break;case"float64":e.write(this.internalType.value.toString());break;case"int":case"int64":e.write(this.internalType.value.toString());break;case"map":this.writeMap({writer:e,map:this.internalType});break;case"nil":e.write("nil");break;case"nop":break;case"optional":this.writeOptional({writer:e,type:this.internalType.value});break;case"reference":e.writeNode(this.internalType.value);break;case"slice":this.writeSlice({writer:e,slice:this.internalType});break;case"string":e.write(this.internalType.value.includes('"')||this.internalType.value.includes(`
19
- `)?`\`${this.internalType.value}\``:`"${this.internalType.value}"`);break;case"struct":this.writeStruct({writer:e,struct:this.internalType});break;case"uuid":e.writeNode(Tr({value:this.internalType.value}));break;default:q(this.internalType)}}static any(e){return new this({type:"any",value:e})}static bool(e){return new this({type:"bool",value:e})}static bytes(e){return new this({type:"bytes",value:e})}static date(e){return new this({type:"date",value:e})}static dateTime(e){return new this({type:"dateTime",value:e})}static enum(e){return new this({type:"enum",typeReference:e})}static float64(e){return new this({type:"float64",value:e})}static int(e){return new this({type:"int",value:e})}static int64(e){return new this({type:"int64",value:e})}static map({keyType:e,valueType:n,entries:i}){return new this({type:"map",keyType:e,valueType:n,entries:i})}static nil(){return new this({type:"nil"})}static nop(){return new this({type:"nop"})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static reference(e){return new this({type:"reference",value:e})}static slice({valueType:e,values:n}){return new this({type:"slice",valueType:e,values:n})}static string(e){return new this({type:"string",value:e})}static struct({typeReference:e,fields:n}){return new this({type:"struct",typeReference:e,fields:n})}static structPointer({typeReference:e,fields:n}){return new this({type:"optional",value:new this({type:"struct",typeReference:e,fields:n})})}static uuid(e){return new this({type:"uuid",value:e})}static isNop(e){return e.internalType.type==="optional"?this.isNop(e.internalType.value):e.internalType.type==="nop"}writeAny({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("nil");return}if(Array.isArray(n)){this.writeAnyArray({writer:e,value:n});return}this.writeAnyObject({writer:e,value:n});return;default:throw new Error(`Internal error; unsupported unknown type: ${typeof n}`)}}writeAnyArray({writer:e,value:n}){if(e.write("[]interface{}"),n.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let i of n)e.writeNode(r.any(i)),e.writeLine(",");e.dedent(),e.write("}")}writeAnyObject({writer:e,value:n}){e.write("map[string]interface{}");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.any(s)),e.writeLine(",");e.dedent(),e.write("}")}writeMap({writer:e,map:n}){e.write("map["),e.writeNode(n.keyType),e.write("]"),e.writeNode(n.valueType);let i=Ar({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("}")}writeOptional({writer:e,type:n}){if(dr.has(n.internalType.type)){e.writeNode(xr({writer:e,type:n}));return}if(ze.has(n.internalType.type)){n.write(e);return}if(n.internalType.type==="enum"){e.writeNode(new U({on:n.internalType.typeReference,method:"Ptr",arguments_:[]}));return}e.write("&"),n.write(e)}static isAlreadyOptional(e){return e.internalType.type==="optional"||ze.has(e.internalType.type)}writeSlice({writer:e,slice:n}){e.write("[]"),e.writeNode(n.valueType);let i=vr({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("}")}writeStruct({writer:e,struct:n}){e.writeNode(n.typeReference);let i=Er({fields:n.fields});if(i.length===0){e.write("{}");return}e.writeLine("{"),e.indent();for(let o of i)e.write(`${o.name}: `),o.value.write(e),e.writeLine(",");e.dedent(),e.write("}")}};function xr({writer:r,type:t}){return new R({func:new T({name:yr({type:t}),importPath:r.rootImportPath}),arguments_:[t]})}function yr({type:r}){switch(r.internalType.type){case"bool":return"Bool";case"date":case"dateTime":return"Time";case"float64":return"Float64";case"int":return"Int";case"int64":return"Int64";case"string":return"String";case"uuid":return"UUID";default:return""}}function gr({writer:r,type:t}){let e=t instanceof Date?"MustParseDate":"MustParseDateTime";return new R({func:new T({name:e,importPath:r.rootImportPath}),arguments_:[new L(`"${t.value}"`)]})}function Tr({value:r}){return new R({func:new T({name:"MustParse",importPath:"github.com/google/uuid"}),arguments_:[new L(`"${r}"`)]})}function Ar({entries:r}){return r.filter(t=>!N.isNop(t.key)&&!N.isNop(t.value))}function Er({fields:r}){return r.filter(t=>!N.isNop(t.value))}function vr({values:r}){return r.filter(t=>!N.isNop(t))}function le({writer:r,arguments_:t}){let e=Ir(t);if(e.length===0){r.write("()");return}r.writeLine("("),r.indent();for(let n of e)Nr({writer:r,argument:n}),r.writeLine(",");r.dedent(),r.write(")")}function Nr({writer:r,argument:t}){Ae(t)?r.writeNodeOrString(t.assignment):t.write(r)}function Ir(r){return r.filter(t=>!(t instanceof N&&N.isNop(t)))}var R=class extends x{constructor({func:e,arguments_:n}){super();c(this,"func");c(this,"arguments_");this.func=e,this.arguments_=n}write(e){e.writeNode(this.func),le({writer:e,arguments_:this.arguments_})}};u();f();var J=class extends x{constructor({name:e,type:n,docs:i}){super();c(this,"name");c(this,"type");c(this,"docs");this.name=e,this.type=n,this.docs=i}write(e){e.writeNode(new v({docs:this.docs})),e.write(`${this.name} `),this.type.write(e)}};u();f();var j=class extends x{constructor({name:e,importPath:n,docs:i}){super();c(this,"name");c(this,"importPath");c(this,"docs");c(this,"fields",[]);c(this,"methods",[]);this.name=e,this.importPath=n,this.docs=i}addField(e){this.fields.push(e)}addMethod(e){this.methods.push(e)}write(e){if(e.writeNode(new v({docs:this.docs})),e.write(`type ${this.name} struct {`),this.fields.length===0)e.writeLine("}");else{e.newLine(),e.indent();for(let n of this.fields)e.writeNode(n),e.newLine();e.dedent(),e.writeLine("}")}if(this.methods.length>0){e.newLine();for(let n of this.methods)e.writeNode(n),e.newLine()}}};u();f();var Rr=new Set(["any","bytes","map","slice"]),ne=class r extends x{constructor(e){super();c(this,"internalType");this.internalType=e}write(e,{comment:n}={}){switch(this.internalType.type){case"any":e.write("interface{}");break;case"bool":e.write("bool");break;case"bytes":e.write("[]byte");break;case"date":case"dateTime":e.writeNode(_r);break;case"float64":e.write("float64");break;case"int":e.write("int");break;case"int64":e.write("int64");break;case"map":{e.write("map["),this.internalType.keyType.write(e),e.write("]"),this.internalType.valueType.write(e);break}case"optional":{e.write("*"),this.internalType.value.write(e);break}case"reference":e.writeNode(this.internalType.value);break;case"slice":e.write("[]"),this.internalType.value.write(e);break;case"string":e.write("string");break;case"uuid":e.writeNode(kr);break;default:q(this.internalType)}}isOptional(){return this.internalType.type==="optional"}static any(){return new this({type:"any"})}static bool(){return new this({type:"bool"})}static bytes(){return new this({type:"bytes"})}static date(){return new this({type:"date"})}static dateTime(){return new this({type:"dateTime"})}static float64(){return new this({type:"float64"})}static int(){return new this({type:"int"})}static int64(){return new this({type:"int64"})}static map(e,n){return new this({type:"map",keyType:e,valueType:n})}static optional(e){return this.isAlreadyOptional(e)?e:new this({type:"optional",value:e})}static pointer(e){return r.optional(e)}static reference(e){return new this({type:"reference",value:e})}static slice(e){return new this({type:"slice",value:e})}static string(){return new this({type:"string"})}static uuid(){return new this({type:"uuid"})}static isAlreadyOptional(e){return e.internalType.type==="optional"||Rr.has(e.internalType.type)}},_r=new T({importPath:"time",name:"Time"}),kr=new T({importPath:"github.com/google/uuid",name:"UUID"});function Sr(r){return new L(r)}function Lr(r){return new W(r)}function Pr(r){return new V(r)}function br(r={}){return new G(r)}function Br(r){return new H(r)}function Ur(r){return new R(r)}function Mr(r){return new U(r)}function Yr(r){return new B(r)}function Dr(r){return new J(r)}function Cr(r){return new j(r)}function Fr(r){return new T(r)}u();f();export{$r as a,Or as b,Wr as c,Vr as d,de as e,Gr as f,rt as g,Hr as h,Jr as i,c as j,u as k,a as l,f as m,q as n,or as o,ar as p,Ee as q};
20
- /*! Bundled license information:
21
-
22
- @esbuild-plugins/node-globals-polyfill/Buffer.js:
23
- (*!
24
- * The buffer module from node.js, for the browser.
25
- *
26
- * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
27
- * @license MIT
28
- *)
29
- */