@junobuild/cli 0.14.4 → 0.14.5-next-2026-04-05

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 (2) hide show
  1. package/dist/index.js +7 -8
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -765,8 +765,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
765
765
 
766
766
  /* eslint-disable */
767
767
  /* prettier-ignore */
768
+ // @ts-nocheck
768
769
  %IMPORT%
769
- // @ts-expect-error - generated JS file without type declarations
770
770
  import {idlFactory} from './satellite.factory.did.js';
771
771
  import {getSatelliteExtendedActor} from '@junobuild/%CORE_LIB%';
772
772
 
@@ -787,11 +787,10 @@ import {getSatelliteExtendedActor} from '@junobuild/%CORE_LIB%';
787
787
  return await %DID_METHOD_NAME%(%CALL_PARAMS%);
788
788
  }`,Sfr=`
789
789
  import type {_SERVICE as SatelliteActor%IMPORTS%} from './satellite.did';
790
- import type { Principal } from '@icp-sdk/core/principal';`,bfr=({methods:e,imports:t,transformerOptions:{coreLib:r,outputLanguage:n}})=>{let i=n==="js"?gfr:Tfr,s=e.map(xfr),a=s.map(l=>{let c=i;return Object.entries(l).map(([u,p])=>{c=c.replaceAll(`%${u}%`,p)}),c}).join(`
790
+ import type { Principal } from '@icp-sdk/core/principal';`,bfr=({methods:e,imports:t,transformerOptions:{coreLib:r,outputLanguage:n}})=>{let i=n==="js"?gfr:Tfr,s=e.map(xfr),a=s.map(c=>{let u=i;return Object.entries(c).map(([p,d])=>{u=u.replaceAll(`%${p}%`,d)}),u}).join(`
791
791
 
792
- `),o=Uqe.replace("%FUNCTION_NAMESPACE%",$qe).replace("%JS_FUNCTIONS%",s.map(({METHOD_NAME:l})=>l).join(`,
793
- `));return yfr.replace("%CORE_LIB%",r??"core").replace("%METHODS%",a).replace("%NAMESPACE%",o).replace("%IMPORT%",n==="js"?"":Sfr.replace("%IMPORTS%",t.length===0?"":`, ${t.join(", ")}`)).trim()},xfr=({name:e,returnType:t,paramsType:r})=>{let n=(o=>o.replace(/_./g,l=>l[1].toUpperCase()))(e),i=r.map((o,l)=>({param:`value${l}`,type:o})),s=`${i.map(({param:o})=>o).join(", ")}`,a=i.map(({param:o,type:l})=>`${o}: ${l}`).join(", ");return{METHOD_NAME:n,DID_METHOD_NAME:e,METHOD_RESULT:t,PARAMS:a,CALL_PARAMS:s}},qqe=async({inputFile:e,outputFile:t,transformerOptions:r})=>{let n=await mfr({inputFile:e}),i=bfr({...n,transformerOptions:r});await cfr(t,i,"utf-8")},_fr=e=>{if(e.some(s=>s.type!=="object"||s.properties===void 0))return null;let[t,...r]=e,n=t.properties;if(n===void 0)return null;let i=Object.entries(n).find(([s,a])=>typeof a!="boolean"&&a.const!==void 0)?.[0];return i===void 0?null:r.every(s=>s.properties?.[i]!==void 0&&typeof s.properties[i]!="boolean"&&s.properties[i].const!==void 0)?i:null},pce=({id:e,zodSchema:t})=>{let r=t.toJSONSchema({unrepresentable:"any",override:s=>{s.zodSchema._zod.def.type==="bigint"&&(s.jsonSchema.type="integer",s.jsonSchema.format="bigint"),s.jsonSchema.id===tce.Nat&&(s.jsonSchema.type="integer",s.jsonSchema.format="nat"),s.jsonSchema.id===mV.Principal&&(s.jsonSchema.format="principal"),s.jsonSchema.id===mV.Uint8Array&&(s.jsonSchema.format="uint8array")}}),n=ng({schema:r,rootDefs:r.$defs??{}}),i=t._zod.def.type==="optional"&&!("innerType"in t._zod.def&&t._zod.def.innerType instanceof Zw);return{id:e,schema:n,isTopLevelOptional:i}},ng=({schema:e,rootDefs:t})=>{if(e.format==="principal")return{kind:"principal"};if(e.format==="uint8array")return{kind:"uint8array"};if("$ref"in e){let r=e.$ref.replace("#/$defs/",""),n=t[r];if(n===void 0)throw new Error(`Unresolved $ref: ${e.$ref}`);return ng({schema:n,rootDefs:t})}switch(e.type){case"string":if(e.const!==void 0)return{kind:"variant",tags:[String(e.const)]};if(e.enum!==void 0){if(e.enum.some(r=>typeof r!="string"))throw new Error("Non-string enum values are not supported");return{kind:"variant",tags:e.enum}}return{kind:"text"};case"boolean":return{kind:"bool"};case"number":return{kind:"float64"};case"integer":return e.format==="nat"?{kind:"nat"}:e.format==="bigint"?{kind:"bigint"}:{kind:"int32"};case"null":throw new Error("null type is not supported");case"array":{if(e.prefixItems!==void 0){if(e.prefixItems.some(r=>typeof r=="boolean"))throw new Error("Boolean schema not supported.");return{kind:"indexedTuple",members:e.prefixItems.map(r=>ng({schema:r,rootDefs:t}))}}if(e.items===void 0)throw new Error("Array schema must have items defined");if(Array.isArray(e.items))throw new Error("Tuple-style array items not supported");if(typeof e.items=="boolean")throw new Error("Boolean schema not supported for array items");return{kind:"vec",inner:ng({schema:e.items,rootDefs:t})}}case"object":{if(e.properties===void 0&&e.additionalProperties!==void 0){if(typeof e.additionalProperties=="boolean")throw new Error("Boolean additionalProperties not supported");return{kind:"vec",inner:{kind:"tuple",members:[{kind:"text"},ng({schema:e.additionalProperties,rootDefs:t})]}}}if(e.properties===void 0)return{kind:"record",fields:[]};if(Object.keys(e.properties).length===0)return{kind:"record",fields:[]};let r=new Set(e.required??[]),n=Object.entries(e.properties);if(n.some(([i,s])=>typeof s=="boolean"))throw new Error("Boolean schema not supported.");return{kind:"record",fields:n.map(([i,s])=>{let a=ng({schema:s,rootDefs:t});return{name:i,type:r.has(i)?a:{kind:"opt",inner:a}}})}}}if(e.oneOf!==void 0){let r=e.oneOf.filter(({type:i})=>i!=="null");if(r.length===1)return{kind:"opt",inner:ng({schema:r[0],rootDefs:t})};let n=_fr(r);if(n!==null)return{kind:"discriminatedUnion",discriminator:n,members:r.map(i=>ng({schema:i,rootDefs:t}))};throw new Error("z.union of objects is not supported. Use z.discriminatedUnion instead.")}if(e.anyOf!==void 0){let r=e.anyOf.filter(i=>typeof i!="boolean");if(r.filter(i=>Object.keys(i).length===0).length>0)throw new Error("Unrepresentable type in union");if(r.every(i=>i.const!==void 0))return{kind:"variant",tags:r.map(i=>String(i.const))};let n=r.filter(i=>i.type!=="null");if(n.length===1)return{kind:"opt",inner:ng({schema:n[0],rootDefs:t})};throw new Error("z.union of objects is not supported. Use z.discriminatedUnion instead.")}if(e.allOf!==void 0){if(e.allOf.some(r=>typeof r=="boolean"))throw new Error("Boolean schema not supported in allOf");if(e.allOf.some(r=>typeof r!="boolean"&&(r.type!=="object"||r.properties===void 0)))throw new Error("allOf only supported for object types");return{kind:"record",fields:e.allOf.flatMap(r=>{let n=new Set(r.required??[]);return Object.entries(r.properties??{}).map(([i,s])=>{let a=ng({schema:s,rootDefs:t});return{name:i,type:n.has(i)?a:{kind:"opt",inner:a}}})})}}throw Object.keys(e).length===0?new Error("Unsupported type: unrepresentable schema (z.symbol, z.undefined, z.void, z.map, z.set, z.nan, z.custom are not supported)"):new Error(`Unsupported JSON Schema: ${JSON.stringify(e)}`)},iN=e=>{switch(e.kind){case"text":return"j.string()";case"bool":return"j.boolean()";case"float64":return"j.number()";case"int32":return"j.int()";case"bigint":return"j.bigint()";case"nat":return"j.nat()";case"principal":return"j.principal()";case"uint8array":return"j.uint8Array()";case"opt":return`j.optional(${iN(e.inner)})`;case"vec":return`j.array(${iN(e.inner)})`;case"tuple":case"indexedTuple":return`j.tuple([${e.members.map(iN).join(", ")}])`;case"record":return`j.strictObject({${e.fields.map(t=>`${t.name}: ${iN(t.type)}`).join(", ")}})`;case"variant":return`j.enum([${e.tags.map(t=>`'${t}'`).join(", ")}])`;case"discriminatedUnion":return`j.discriminatedUnion('${e.discriminator}', [${e.members.map(iN).join(", ")}])`}},vfr=({id:e,schema:t,isTopLevelOptional:r,suffix:n})=>{let i=`${_u(e)}${n}`,s=iN(r?{kind:"opt",inner:t}:t);return{baseName:i,code:`const ${i}Schema = ${s};`}},Iqe=({id:e,schema:t,suffix:r})=>{let n=pce({zodSchema:t,id:e});return vfr({...n,suffix:r})},Pfr=`// @ts-expect-error - generated JS file without type declarations
794
- import {idlFactory} from './satellite.factory.did.js';
792
+ `),o=s.map(({METHOD_NAME:c})=>c).join(`,
793
+ `),l=Uqe.replace("%FUNCTION_NAMESPACE%",$qe).replace("%JS_FUNCTIONS%",o);return yfr.replace("%CORE_LIB%",r??"core").replace("%METHODS%",a).replace("%NAMESPACE%",o.length===0?"":l).replace("%IMPORT%",n==="js"?"":Sfr.replace("%IMPORTS%",t.length===0?"":`, ${t.join(", ")}`)).trim()},xfr=({name:e,returnType:t,paramsType:r})=>{let n=(o=>o.replace(/_./g,l=>l[1].toUpperCase()))(e),i=r.map((o,l)=>({param:`value${l}`,type:o})),s=`${i.map(({param:o})=>o).join(", ")}`,a=i.map(({param:o,type:l})=>`${o}: ${l}`).join(", ");return{METHOD_NAME:n,DID_METHOD_NAME:e,METHOD_RESULT:t,PARAMS:a,CALL_PARAMS:s}},qqe=async({inputFile:e,outputFile:t,transformerOptions:r})=>{let n=await mfr({inputFile:e}),i=bfr({...n,transformerOptions:r});await cfr(t,i,"utf-8")},_fr=e=>{if(e.some(s=>s.type!=="object"||s.properties===void 0))return null;let[t,...r]=e,n=t.properties;if(n===void 0)return null;let i=Object.entries(n).find(([s,a])=>typeof a!="boolean"&&a.const!==void 0)?.[0];return i===void 0?null:r.every(s=>s.properties?.[i]!==void 0&&typeof s.properties[i]!="boolean"&&s.properties[i].const!==void 0)?i:null},pce=({id:e,zodSchema:t})=>{let r=t.toJSONSchema({unrepresentable:"any",override:s=>{s.zodSchema._zod.def.type==="bigint"&&(s.jsonSchema.type="integer",s.jsonSchema.format="bigint"),s.jsonSchema.id===tce.Nat&&(s.jsonSchema.type="integer",s.jsonSchema.format="nat"),s.jsonSchema.id===mV.Principal&&(s.jsonSchema.format="principal"),s.jsonSchema.id===mV.Uint8Array&&(s.jsonSchema.format="uint8array")}}),n=ng({schema:r,rootDefs:r.$defs??{}}),i=t._zod.def.type==="optional"&&!("innerType"in t._zod.def&&t._zod.def.innerType instanceof Zw);return{id:e,schema:n,isTopLevelOptional:i}},ng=({schema:e,rootDefs:t})=>{if(e.format==="principal")return{kind:"principal"};if(e.format==="uint8array")return{kind:"uint8array"};if("$ref"in e){let r=e.$ref.replace("#/$defs/",""),n=t[r];if(n===void 0)throw new Error(`Unresolved $ref: ${e.$ref}`);return ng({schema:n,rootDefs:t})}switch(e.type){case"string":if(e.const!==void 0)return{kind:"variant",tags:[String(e.const)]};if(e.enum!==void 0){if(e.enum.some(r=>typeof r!="string"))throw new Error("Non-string enum values are not supported");return{kind:"variant",tags:e.enum}}return{kind:"text"};case"boolean":return{kind:"bool"};case"number":return{kind:"float64"};case"integer":return e.format==="nat"?{kind:"nat"}:e.format==="bigint"?{kind:"bigint"}:{kind:"int32"};case"null":throw new Error("null type is not supported");case"array":{if(e.prefixItems!==void 0){if(e.prefixItems.some(r=>typeof r=="boolean"))throw new Error("Boolean schema not supported.");return{kind:"indexedTuple",members:e.prefixItems.map(r=>ng({schema:r,rootDefs:t}))}}if(e.items===void 0)throw new Error("Array schema must have items defined");if(Array.isArray(e.items))throw new Error("Tuple-style array items not supported");if(typeof e.items=="boolean")throw new Error("Boolean schema not supported for array items");return{kind:"vec",inner:ng({schema:e.items,rootDefs:t})}}case"object":{if(e.properties===void 0&&e.additionalProperties!==void 0){if(typeof e.additionalProperties=="boolean")throw new Error("Boolean additionalProperties not supported");return{kind:"vec",inner:{kind:"tuple",members:[{kind:"text"},ng({schema:e.additionalProperties,rootDefs:t})]}}}if(e.properties===void 0)return{kind:"record",fields:[]};if(Object.keys(e.properties).length===0)return{kind:"record",fields:[]};let r=new Set(e.required??[]),n=Object.entries(e.properties);if(n.some(([i,s])=>typeof s=="boolean"))throw new Error("Boolean schema not supported.");return{kind:"record",fields:n.map(([i,s])=>{let a=ng({schema:s,rootDefs:t});return{name:i,type:r.has(i)?a:{kind:"opt",inner:a}}})}}}if(e.oneOf!==void 0){let r=e.oneOf.filter(({type:i})=>i!=="null");if(r.length===1)return{kind:"opt",inner:ng({schema:r[0],rootDefs:t})};let n=_fr(r);if(n!==null)return{kind:"discriminatedUnion",discriminator:n,members:r.map(i=>ng({schema:i,rootDefs:t}))};throw new Error("z.union of objects is not supported. Use z.discriminatedUnion instead.")}if(e.anyOf!==void 0){let r=e.anyOf.filter(i=>typeof i!="boolean");if(r.filter(i=>Object.keys(i).length===0).length>0)throw new Error("Unrepresentable type in union");if(r.every(i=>i.const!==void 0))return{kind:"variant",tags:r.map(i=>String(i.const))};let n=r.filter(i=>i.type!=="null");if(n.length===1)return{kind:"opt",inner:ng({schema:n[0],rootDefs:t})};throw new Error("z.union of objects is not supported. Use z.discriminatedUnion instead.")}if(e.allOf!==void 0){if(e.allOf.some(r=>typeof r=="boolean"))throw new Error("Boolean schema not supported in allOf");if(e.allOf.some(r=>typeof r!="boolean"&&(r.type!=="object"||r.properties===void 0)))throw new Error("allOf only supported for object types");return{kind:"record",fields:e.allOf.flatMap(r=>{let n=new Set(r.required??[]);return Object.entries(r.properties??{}).map(([i,s])=>{let a=ng({schema:s,rootDefs:t});return{name:i,type:n.has(i)?a:{kind:"opt",inner:a}}})})}}throw Object.keys(e).length===0?new Error("Unsupported type: unrepresentable schema (z.symbol, z.undefined, z.void, z.map, z.set, z.nan, z.custom are not supported)"):new Error(`Unsupported JSON Schema: ${JSON.stringify(e)}`)},iN=e=>{switch(e.kind){case"text":return"j.string()";case"bool":return"j.boolean()";case"float64":return"j.number()";case"int32":return"j.int()";case"bigint":return"j.bigint()";case"nat":return"j.nat()";case"principal":return"j.principal()";case"uint8array":return"j.uint8Array()";case"opt":return`j.optional(${iN(e.inner)})`;case"vec":return`j.array(${iN(e.inner)})`;case"tuple":case"indexedTuple":return`j.tuple([${e.members.map(iN).join(", ")}])`;case"record":return`j.strictObject({${e.fields.map(t=>`${t.name}: ${iN(t.type)}`).join(", ")}})`;case"variant":return`j.enum([${e.tags.map(t=>`'${t}'`).join(", ")}])`;case"discriminatedUnion":return`j.discriminatedUnion('${e.discriminator}', [${e.members.map(iN).join(", ")}])`}},vfr=({id:e,schema:t,isTopLevelOptional:r,suffix:n})=>{let i=`${_u(e)}${n}`,s=iN(r?{kind:"opt",inner:t}:t);return{baseName:i,code:`const ${i}Schema = ${s};`}},Iqe=({id:e,schema:t,suffix:r})=>{let n=pce({zodSchema:t,id:e});return vfr({...n,suffix:r})},Pfr=`import {idlFactory} from './satellite.factory.did.js';
795
794
  import {getSatelliteExtendedActor} from '@junobuild/%CORE_LIB%';
796
795
  import {schemaToIdl, schemaFromIdl} from '@junobuild/schema/utils';
797
796
  import {j} from '@junobuild/schema';`,Afr=`
@@ -830,7 +829,6 @@ const %JS_FUNCTION% = async () => {
830
829
  const {%RS_FUNCTION%} = await getSatelliteExtendedActor({idlFactory});
831
830
  await %RS_FUNCTION%();
832
831
  };`,Ifr=`import type {_SERVICE as SatelliteActor} from './satellite.did';
833
- // @ts-expect-error - generated JS file without type declarations
834
832
  import {idlFactory} from './satellite.factory.did.js';
835
833
  import {getSatelliteExtendedActor} from '@junobuild/%CORE_LIB%';
836
834
  import {schemaToIdl, schemaFromIdl} from '@junobuild/schema/utils';
@@ -874,6 +872,7 @@ const %JS_FUNCTION% = async (): Promise<void> => {
874
872
 
875
873
  /* eslint-disable */
876
874
  /* prettier-ignore */
875
+ // @ts-nocheck
877
876
 
878
877
  %IMPORTS%
879
878
 
@@ -882,7 +881,7 @@ const %JS_FUNCTION% = async (): Promise<void> => {
882
881
  %NAMESPACE%`,Ffr=({functions:e,transformerOptions:{coreLib:t,outputLanguage:r}})=>{let n=e.map(([a,o])=>Bfr({jsFnName:a,fn:o,outputLanguage:r})).join(`
883
882
 
884
883
  `).trim(),i=e.map(([a,o])=>a).join(`,
885
- `),s=Uqe.replace("%FUNCTION_NAMESPACE%",$qe).replace("%JS_FUNCTIONS%",i);return Rfr.replace("%IMPORTS%",r==="js"?Pfr:Ifr).replace("%CORE_LIB%",t??"core").replace("%FUNCTIONS%",n).replace("%NAMESPACE%",s)},Bfr=({fn:e,jsFnName:t,outputLanguage:r})=>{let n=`App${_u(t)}`,i="args"in e?Iqe({id:n,schema:e.args,suffix:"Args"}):void 0,s="result"in e?Iqe({id:n,schema:e.result,suffix:"Result"}):void 0,a=sr(i)&&sr(s)?r==="js"?Afr:Dfr:sr(i)?r==="js"?Ofr:Cfr:sr(s)?r==="js"?wfr:kfr:r==="js"?Nfr:Lfr,o=`${"App".toLowerCase()}_${wy(t)}`;return a.replace("%JS_FUNCTION%",t).replaceAll("%RS_FUNCTION%",o).replaceAll("%ARGS_SCHEMA%",i?.baseName?`${i.baseName}Schema`:"").replaceAll("%ARGS_ZOD%",i?.code??"").replaceAll("%RESULT_SCHEMA%",s?.baseName?`${s.baseName}Schema`:"").replaceAll("%RESULT_ZOD%",s?.code??"").trim()},Kqe=async({functions:e,outputFile:t,transformerOptions:r})=>{let n=Ffr({functions:e,transformerOptions:r});await Efr(t,n,"utf-8")},P1=e=>{switch(e.kind){case"text":return"text";case"bool":return"bool";case"float64":return"float64";case"int32":return"int32";case"bigint":return"nat64";case"nat":return"nat";case"principal":return"principal";case"uint8array":return"blob";case"opt":return`opt ${P1(e.inner)}`;case"vec":return`vec ${P1(e.inner)}`;case"record":return e.fields.length===0?"record {}":`record { ${e.fields.map(t=>`${wy(t.name)} : ${P1(t.type)}`).join("; ")} }`;case"tuple":return`record { ${e.members.map(P1).join("; ")} }`;case"indexedTuple":return`record { ${e.members.map((t,r)=>`${r} : ${P1(t)}`).join("; ")} }`;case"variant":return`variant { ${e.tags.join("; ")} }`;case"discriminatedUnion":return`variant { ${e.members.map(t=>{let r=t.kind==="record"&&t.fields.find(s=>s.name===e.discriminator)?.type.kind==="variant"?(t.fields.find(s=>s.name===e.discriminator)?.type).tags[0]:void 0,n=t.kind==="record"?{kind:"record",fields:t.fields.filter(s=>s.name!==e.discriminator)}:t,i=P1(n);return r!==void 0?`${r} : ${i}`:i}).join("; ")} }`}},Mfr=({id:e,schema:t,isTopLevelOptional:r,suffix:n})=>{let i=`${_u(e)}${n}`;return{baseName:i,code:`type ${i} = ${P1(r?{kind:"opt",inner:t}:t)};`}},Dqe=({id:e,schema:t,suffix:r})=>{let n=pce({zodSchema:t,id:e});return Mfr({...n,suffix:r})},jfr={};lfr(jfr,{Bool:()=>pKe,BoolClass:()=>eKe,CandidDecodeError:()=>lh,ConstructType:()=>Zx,Empty:()=>cKe,EmptyClass:()=>dce,FixedIntClass:()=>N1,FixedNatClass:()=>Hx,Float32:()=>yKe,Float64:()=>TKe,FloatClass:()=>hce,Func:()=>kKe,FuncClass:()=>DR,Int:()=>mKe,Int16:()=>SKe,Int32:()=>bKe,Int64:()=>xKe,Int8:()=>gKe,IntClass:()=>fce,Nat:()=>hKe,Nat16:()=>_Ke,Nat32:()=>vKe,Nat64:()=>PKe,Nat8:()=>EKe,NatClass:()=>mce,Null:()=>dKe,NullClass:()=>NR,Opt:()=>NKe,OptClass:()=>lN,PrimitiveType:()=>ch,Principal:()=>AKe,PrincipalClass:()=>lKe,Rec:()=>CKe,RecClass:()=>ig,Record:()=>IKe,RecordClass:()=>IR,Reserved:()=>uKe,ReservedClass:()=>Gx,Service:()=>LKe,ServiceClass:()=>xV,Text:()=>fKe,TextClass:()=>tKe,Tuple:()=>OKe,TupleClass:()=>iKe,Type:()=>_V,Unknown:()=>gmr,UnknownClass:()=>Qqe,Variant:()=>DKe,VariantClass:()=>bV,Vec:()=>wKe,VecClass:()=>SV,Visitor:()=>hmr,decode:()=>Tmr,encode:()=>ymr,resetSubtypeCache:()=>uce,subtype:()=>Tce});var gV="abcdefghijklmnopqrstuvwxyz234567",oN=Object.create(null);for(let e=0;e<gV.length;e++)oN[gV[e]]=e;oN[0]=oN.o;oN[1]=oN.i;function Vfr(e){let t=0,r=0,n="";function i(s){return t<0?r|=s>>-t:r=s<<t&248,t>3?(t-=8,1):(t<4&&(n+=gV[r>>3],t+=5),0)}for(let s=0;s<e.length;)s+=i(e[s]);return n+(t<0?gV[r>>3]:"")}function $fr(e){let t=0,r=0,n=new Uint8Array(e.length*4/3|0),i=0;function s(a){let o=oN[a.toLowerCase()];if(o===void 0)throw new Error(`Invalid character: ${JSON.stringify(a)}`);o<<=3,r|=o>>>t,t+=5,t>=8&&(n[i++]=r,t-=8,t>0?r=o<<5-t&255:r=0)}for(let a of e)s(a);return n.slice(0,i)}var Ufr=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function qfr(e){let t=-1;for(let r=0;r<e.length;r++){let n=(e[r]^t)&255;t=Ufr[n]^t>>>8}return(t^-1)>>>0}function Kfr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function EV(e,...t){if(!Kfr(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Cqe(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Yfr(e,t){EV(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function oce(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ice(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function rg(e,t){return e<<32-t|e>>>t}var Yqe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",zfr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Jfr(e){if(EV(e),Yqe)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=zfr[e[r]];return t}var dS={_0:48,_9:57,A:65,F:70,a:97,f:102};function kqe(e){if(e>=dS._0&&e<=dS._9)return e-dS._0;if(e>=dS.A&&e<=dS.F)return e-(dS.A-10);if(e>=dS.a&&e<=dS.f)return e-(dS.a-10)}function Wfr(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Yqe)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let i=0,s=0;i<r;i++,s+=2){let a=kqe(e.charCodeAt(s)),o=kqe(e.charCodeAt(s+1));if(a===void 0||o===void 0){let l=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}n[i]=a*16+o}return n}function Xfr(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function zqe(e){return typeof e=="string"&&(e=Xfr(e)),EV(e),e}var Hfr=class{};function Gfr(e){let t=n=>e().update(zqe(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Zfr(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),a=Number(r>>i&s),o=Number(r&s),l=n?4:0,c=n?0:4;e.setUint32(t+l,a,n),e.setUint32(t+c,o,n)}function Qfr(e,t,r){return e&t^~e&r}function emr(e,t,r){return e&t^e&r^t&r}var tmr=class extends Hfr{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=ice(this.buffer)}update(e){Cqe(this),e=zqe(e),EV(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let s=0;s<i;){let a=Math.min(n-this.pos,i-s);if(a===n){let o=ice(e);for(;n<=i-s;s+=n)this.process(o,s);continue}r.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Cqe(this),Yfr(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:s}=this;t[s++]=128,oce(this.buffer.subarray(s)),this.padOffset>n-s&&(this.process(r,0),s=0);for(let u=s;u<n;u++)t[u]=0;Zfr(r,n-8,BigInt(this.length*8),i),this.process(r,0);let a=ice(e),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=o/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,c[u],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:a}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=a,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},zx=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Jx=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),rmr=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Wx=new Uint32Array(64),nmr=class extends tmr{constructor(e=32){super(64,e,8,!1),this.A=zx[0]|0,this.B=zx[1]|0,this.C=zx[2]|0,this.D=zx[3]|0,this.E=zx[4]|0,this.F=zx[5]|0,this.G=zx[6]|0,this.H=zx[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:a,H:o}=this;return[e,t,r,n,i,s,a,o]}set(e,t,r,n,i,s,a,o){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=s|0,this.G=a|0,this.H=o|0}process(e,t){for(let u=0;u<16;u++,t+=4)Wx[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){let p=Wx[u-15],d=Wx[u-2],f=rg(p,7)^rg(p,18)^p>>>3,m=rg(d,17)^rg(d,19)^d>>>10;Wx[u]=m+Wx[u-7]+f+Wx[u-16]|0}let{A:r,B:n,C:i,D:s,E:a,F:o,G:l,H:c}=this;for(let u=0;u<64;u++){let p=rg(a,6)^rg(a,11)^rg(a,25),d=c+p+Qfr(a,o,l)+rmr[u]+Wx[u]|0,f=(rg(r,2)^rg(r,13)^rg(r,22))+emr(r,n,i)|0;c=l,l=o,o=a,a=s+d|0,s=i,i=n,n=r,r=d+f|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,o=o+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,s,a,o,l,c)}roundClean(){oce(Wx)}destroy(){this.set(0,0,0,0,0,0,0,0),oce(this.buffer)}},imr=class extends nmr{constructor(){super(28),this.A=Jx[0]|0,this.B=Jx[1]|0,this.C=Jx[2]|0,this.D=Jx[3]|0,this.E=Jx[4]|0,this.F=Jx[5]|0,this.G=Jx[6]|0,this.H=Jx[7]|0}},smr=Gfr(()=>new imr),hV="__principal__",amr=2,Lqe=4,omr="aaaaa-aa",lmr=class sN{static anonymous(){return new this(new Uint8Array([Lqe]))}static managementCanister(){return this.fromText(omr)}static selfAuthenticating(t){let r=smr(t);return new this(new Uint8Array([...r,amr]))}static from(t){if(typeof t=="string")return sN.fromText(t);if(Object.getPrototypeOf(t)===Uint8Array.prototype)return new sN(t);if(sN.isPrincipal(t))return new sN(t._arr);throw new Error(`Impossible to convert ${JSON.stringify(t)} to Principal.`)}static fromHex(t){return new this(Wfr(t))}static fromText(t){let r=t;if(t.includes(hV)){let a=JSON.parse(t);hV in a&&(r=a[hV])}let n=r.toLowerCase().replace(/-/g,""),i=$fr(n);i=i.slice(4,i.length);let s=new this(i);if(s.toText()!==r)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${r}" may not be a valid Principal ID).`);return s}static fromUint8Array(t){return new this(t)}static isPrincipal(t){return t instanceof sN||typeof t=="object"&&t!==null&&"_isPrincipal"in t&&t._isPrincipal===!0&&"_arr"in t&&t._arr instanceof Uint8Array}constructor(t){this._arr=t,this._isPrincipal=!0}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===Lqe}toUint8Array(){return this._arr}toHex(){return Jfr(this._arr).toUpperCase()}toText(){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,qfr(this._arr));let r=new Uint8Array(t),n=new Uint8Array([...r,...this._arr]),i=Vfr(n).match(/.{1,5}/g);if(!i)throw new Error;return i.join("-")}toString(){return this.toText()}toJSON(){return{[hV]:this.toText()}}compareTo(t){for(let r=0;r<Math.min(this._arr.length,t._arr.length);r++){if(this._arr[r]<t._arr[r])return"lt";if(this._arr[r]>t._arr[r])return"gt"}return this._arr.length<t._arr.length?"lt":this._arr.length>t._arr.length?"gt":"eq"}ltEq(t){let r=this.compareTo(t);return r=="lt"||r=="eq"}gtEq(t){let r=this.compareTo(t);return r=="gt"||r=="eq"}};function io(...e){let t=new Uint8Array(e.reduce((n,i)=>n+i.byteLength,0)),r=0;for(let n of e)t.set(n,r),r+=n.byteLength;return t}var CR=class{save(){return this._view}restore(e){if(!(e instanceof Uint8Array))throw new Error("Checkpoint must be a Uint8Array");this._view=e}constructor(e,t=e?.byteLength||0){if(e&&!(e instanceof Uint8Array))try{e=Jqe(e)}catch{throw new Error("Buffer must be a Uint8Array")}if(t<0||!Number.isInteger(t))throw new Error("Length must be a non-negative integer");if(e&&t>e.byteLength)throw new Error("Length cannot exceed buffer length");this._buffer=e||new Uint8Array(0),this._view=new Uint8Array(this._buffer.buffer,0,t)}get buffer(){return this._view.slice()}get byteLength(){return this._view.byteLength}read(e){let t=this._view.subarray(0,e);return this._view=this._view.subarray(e),t.slice()}readUint8(){if(this._view.byteLength===0)return;let e=this._view[0];return this._view=this._view.subarray(1),e}write(e){if(!(e instanceof Uint8Array))throw new Error("Buffer must be a Uint8Array");let t=this._view.byteLength;this._view.byteOffset+this._view.byteLength+e.byteLength>=this._buffer.byteLength?this.alloc(e.byteLength):this._view=new Uint8Array(this._buffer.buffer,this._view.byteOffset,this._view.byteLength+e.byteLength),this._view.set(e,t)}get end(){return this._view.byteLength===0}alloc(e){if(e<=0||!Number.isInteger(e))throw new Error("Amount must be a positive integer");let t=new Uint8Array((this._buffer.byteLength+e)*1.2|0),r=new Uint8Array(t.buffer,0,this._view.byteLength+e);r.set(this._view),this._buffer=t,this._view=r}};function Jqe(e){if(!e)throw new Error("Input cannot be null or undefined");return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):Array.isArray(e)?new Uint8Array(e):"buffer"in e?Jqe(e.buffer):new Uint8Array(e)}function cmr(e){if(!(e instanceof Uint8Array))throw new Error("Input must be a Uint8Array");return new DataView(e.buffer,e.byteOffset,e.byteLength)}function umr(e){let t=new TextEncoder().encode(e),r=0;for(let n of t)r=(r*223+n)%2**32;return r}function Bf(e){if(/^_\d+_$/.test(e)||/^_0x[0-9a-fA-F]+_$/.test(e)){let t=+e.slice(1,-1);if(Number.isSafeInteger(t)&&t>=0&&t<2**32)return t}return umr(e)}function Wqe(e){let t=BigInt(e);if(e<=0)throw new RangeError("Input must be positive");return t.toString(2).length-1}function lce(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}function Xqe(){throw new Error("unexpected end of buffer")}function O1(e,t){return e.byteLength<t&&Xqe(),e.read(t)}function w1(e){let t=e.readUint8();return t===void 0&&Xqe(),t}function Pu(e){if(typeof e=="number"&&(e=BigInt(e)),e<BigInt(0))throw new Error("Cannot leb encode negative values.");let t=(e===BigInt(0)?0:Wqe(e))+1,r=new CR(new Uint8Array(t),0);for(;;){let n=Number(e&BigInt(127));if(e/=BigInt(128),e===BigInt(0)){r.write(new Uint8Array([n]));break}else r.write(new Uint8Array([n|128]))}return r.buffer}function ap(e){let t=BigInt(1),r=BigInt(0),n;do n=w1(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}function Au(e){typeof e=="number"&&(e=BigInt(e));let t=e<BigInt(0);t&&(e=-e-BigInt(1));let r=(e===BigInt(0)?0:Wqe(e))+1,n=new CR(new Uint8Array(r),0);for(;;){let s=i(e);if(e/=BigInt(128),t&&e===BigInt(0)&&(s&64)!==0||!t&&e===BigInt(0)&&(s&64)===0){n.write(new Uint8Array([s]));break}else n.write(new Uint8Array([s|128]))}function i(s){let a=s%BigInt(128);return Number(t?BigInt(128)-a-BigInt(1):a)}return n.buffer}function Xx(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if((t[r]&64)===0)return ap(e);break}let n=new Uint8Array(O1(e,r+1)),i=BigInt(0);for(let s=n.byteLength-1;s>=0;s--)i=i*BigInt(128)+BigInt(128-(n[s]&127)-1);return-i-BigInt(1)}function pmr(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Hqe(e,t)}function Hqe(e,t){e=BigInt(e);let r=new CR(new Uint8Array(Math.min(1,t)),0),n=0,i=BigInt(256),s=BigInt(0),a=Number(e%i);for(r.write(new Uint8Array([a]));++n<t;)e<0&&s===BigInt(0)&&a!==0&&(s=BigInt(1)),a=Number((e/i-s)%BigInt(256)),r.write(new Uint8Array([a])),i*=BigInt(256);return r.buffer}function Gqe(e,t){if(t<=0||!Number.isInteger(t))throw new Error("Byte length must be a positive integer");let r=BigInt(w1(e)),n=BigInt(1),i=0;for(;++i<t;){n*=BigInt(256);let s=BigInt(w1(e));r=r+n*s}return r}function dmr(e,t){if(t<=0||!Number.isInteger(t))throw new Error("Byte length must be a positive integer");let r=Gqe(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}var lh=class Zqe extends Error{constructor(t){super(t),this.name="CandidDecodeError",Object.setPrototypeOf(this,Zqe.prototype)}},no;(function(e){e[e.Null=-1]="Null",e[e.Bool=-2]="Bool",e[e.Nat=-3]="Nat",e[e.Int=-4]="Int",e[e.Float32=-13]="Float32",e[e.Float64=-14]="Float64",e[e.Text=-15]="Text",e[e.Reserved=-16]="Reserved",e[e.Empty=-17]="Empty",e[e.Opt=-18]="Opt",e[e.Vector=-19]="Vector",e[e.Record=-20]="Record",e[e.Variant=-21]="Variant",e[e.Func=-22]="Func",e[e.Service=-23]="Service",e[e.Principal=-24]="Principal"})(no||(no={}));var yV="DIDL",fmr=new TextEncoder().encode(yV),Rqe=400;function wR(e,t,r){return e.map((n,i)=>r(n,t[i]))}var mmr=class{constructor(){this._typs=[],this._idx=new Map,this._idxRefCount=new Map}has(e){return this._idx.has(e.name)}add(e,t){let r=this._typs.length;this._idx.set(e.name,r),this._idxRefCount.set(r,1),this._typs.push(t)}merge(e,t){let r=this._idx.get(e.name),n=this._idx.get(t);if(r===void 0)throw new Error(`Missing type index for ${e}`);if(n===void 0)throw new Error(`Missing type index for ${t}`);this._typs[r]=this._typs[n];let i=this._getIdxRefCount(r),s=this._getIdxRefCount(n);this._idxRefCount.set(r,i+s),this._idx.set(t,r),this._idxRefCount.set(n,0),this._compactFromEnd()}_getIdxRefCount(e){return this._idxRefCount.get(e)||0}_compactFromEnd(){for(;this._typs.length>0;){let e=this._typs.length-1;if(this._getIdxRefCount(e)>0)break;this._typs.pop(),this._idxRefCount.delete(e)}}encode(){let e=Pu(this._typs.length),t=io(...this._typs);return io(e,t)}indexOf(e){if(!this._idx.has(e))throw new Error(`Missing type index for ${e}`);return Au(this._idx.get(e)||0)}},hmr=class{visitType(e,t){throw new Error("Not implemented")}visitPrimitive(e,t){return this.visitType(e,t)}visitEmpty(e,t){return this.visitPrimitive(e,t)}visitBool(e,t){return this.visitPrimitive(e,t)}visitNull(e,t){return this.visitPrimitive(e,t)}visitReserved(e,t){return this.visitPrimitive(e,t)}visitText(e,t){return this.visitPrimitive(e,t)}visitNumber(e,t){return this.visitPrimitive(e,t)}visitInt(e,t){return this.visitNumber(e,t)}visitNat(e,t){return this.visitNumber(e,t)}visitFloat(e,t){return this.visitPrimitive(e,t)}visitFixedInt(e,t){return this.visitNumber(e,t)}visitFixedNat(e,t){return this.visitNumber(e,t)}visitPrincipal(e,t){return this.visitPrimitive(e,t)}visitConstruct(e,t){return this.visitType(e,t)}visitVec(e,t,r){return this.visitConstruct(e,r)}visitOpt(e,t,r){return this.visitConstruct(e,r)}visitRecord(e,t,r){return this.visitConstruct(e,r)}visitTuple(e,t,r){let n=t.map((i,s)=>[`_${s}_`,i]);return this.visitRecord(e,n,r)}visitVariant(e,t,r){return this.visitConstruct(e,r)}visitRec(e,t,r){return this.visitConstruct(t,r)}visitFunc(e,t){return this.visitConstruct(e,t)}visitService(e,t){return this.visitConstruct(e,t)}},Ts;(function(e){e.EmptyClass="__IDL_EmptyClass__",e.UnknownClass="__IDL_UnknownClass__",e.BoolClass="__IDL_BoolClass__",e.NullClass="__IDL_NullClass__",e.ReservedClass="__IDL_ReservedClass__",e.TextClass="__IDL_TextClass__",e.IntClass="__IDL_IntClass__",e.NatClass="__IDL_NatClass__",e.FloatClass="__IDL_FloatClass__",e.FixedIntClass="__IDL_FixedIntClass__",e.FixedNatClass="__IDL_FixedNatClass__",e.VecClass="__IDL_VecClass__",e.OptClass="__IDL_OptClass__",e.RecordClass="__IDL_RecordClass__",e.TupleClass="__IDL_TupleClass__",e.VariantClass="__IDL_VariantClass__",e.RecClass="__IDL_RecClass__",e.PrincipalClass="__IDL_PrincipalClass__",e.FuncClass="__IDL_FuncClass__",e.ServiceClass="__IDL_ServiceClass__"})(Ts||(Ts={}));var _V=class{display(){return this.name}valueToString(e){return qc(e)}buildTypeTable(e){e.has(this)||this._buildTypeTableImpl(e)}},ch=class extends _V{checkType(e){if(this.name!==e.name)throw new Error(`type mismatch: type on the wire ${e.name}, expect type ${this.name}`);return e}_buildTypeTableImpl(e){}},Zx=class extends _V{checkType(e){if(e instanceof ig){let t=e.getType();if(typeof t>"u")throw new lh("Type mismatch: cannot decode from uninitialized recursive type");return t}throw new Error(`type mismatch: type on the wire ${e.name}, expect type ${this.name}`)}encodeType(e){return e.indexOf(this.name)}},dce=class extends ch{get typeName(){return Ts.EmptyClass}static[Symbol.hasInstance](e){return e.typeName===Ts.EmptyClass}accept(e,t){return e.visitEmpty(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return Au(no.Empty)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},Qqe=class extends _V{get typeName(){return Ts.UnknownClass}static[Symbol.hasInstance](e){return e.typeName===Ts.UnknownClass}checkType(e){throw new Error("Method not implemented for unknown.")}accept(e,t){throw e.visitType(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(){throw new Error("Unknown cannot appear as a function argument")}valueToString(){throw new Error("Unknown cannot appear as a value")}encodeType(){throw new Error("Unknown cannot be serialized")}decodeValue(e,t){let r=t.decodeValue(e,t);Object(r)!==r&&(r=Object(r));let n;return t instanceof ig?n=()=>t.getType():n=()=>t,Object.defineProperty(r,"type",{value:n,writable:!0,enumerable:!1,configurable:!0}),r}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}},eKe=class extends ch{get typeName(){return Ts.BoolClass}static[Symbol.hasInstance](e){return e.typeName===Ts.BoolClass}accept(e,t){return e.visitBool(this,t)}covariant(e){if(typeof e=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){return new Uint8Array([e?1:0])}encodeType(){return Au(no.Bool)}decodeValue(e,t){switch(this.checkType(t),w1(e)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},NR=class extends ch{get typeName(){return Ts.NullClass}static[Symbol.hasInstance](e){return e.typeName===Ts.NullClass}accept(e,t){return e.visitNull(this,t)}covariant(e){if(e===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(){return new Uint8Array(0)}encodeType(){return Au(no.Null)}decodeValue(e,t){return this.checkType(t),null}get name(){return"null"}},Gx=class extends ch{get typeName(){return Ts.ReservedClass}static[Symbol.hasInstance](e){return e.typeName===Ts.ReservedClass}accept(e,t){return e.visitReserved(this,t)}covariant(e){return!0}encodeValue(){return new Uint8Array(0)}encodeType(){return Au(no.Reserved)}decodeValue(e,t){return t.name!==this.name&&t.decodeValue(e,t),null}get name(){return"reserved"}},tKe=class extends ch{get typeName(){return Ts.TextClass}static[Symbol.hasInstance](e){return e.typeName===Ts.TextClass}accept(e,t){return e.visitText(this,t)}covariant(e){if(typeof e=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){let t=new TextEncoder().encode(e),r=Pu(t.byteLength);return io(r,t)}encodeType(){return Au(no.Text)}decodeValue(e,t){this.checkType(t);let r=ap(e),n=O1(e,Number(r));return new TextDecoder("utf8",{fatal:!0}).decode(n)}get name(){return"text"}valueToString(e){return`"${e}"`}},fce=class extends ch{get typeName(){return Ts.IntClass}static[Symbol.hasInstance](e){return e.typeName===Ts.IntClass}accept(e,t){return e.visitInt(this,t)}covariant(e){if(typeof e=="bigint"||Number.isInteger(e))return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){return Au(e)}encodeType(){return Au(no.Int)}decodeValue(e,t){return this.checkType(t),Xx(e)}get name(){return"int"}valueToString(e){return e.toString()}},mce=class extends ch{get typeName(){return Ts.NatClass}static[Symbol.hasInstance](e){return e.typeName===Ts.NatClass}accept(e,t){return e.visitNat(this,t)}covariant(e){if(typeof e=="bigint"&&e>=BigInt(0)||Number.isInteger(e)&&e>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){return Pu(e)}encodeType(){return Au(no.Nat)}decodeValue(e,t){return this.checkType(t),ap(e)}get name(){return"nat"}valueToString(e){return e.toString()}},hce=class extends ch{get typeName(){return Ts.FloatClass}static[Symbol.hasInstance](e){return e.typeName===Ts.FloatClass}constructor(e){if(super(),this._bits=e,e!==32&&e!==64)throw new Error("not a valid float type")}accept(e,t){return e.visitFloat(this,t)}covariant(e){if(typeof e=="number"||e instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){let t=new ArrayBuffer(this._bits/8),r=new DataView(t);return this._bits===32?r.setFloat32(0,e,!0):r.setFloat64(0,e,!0),new Uint8Array(t)}encodeType(){let e=this._bits===32?no.Float32:no.Float64;return Au(e)}decodeValue(e,t){this.checkType(t);let r=O1(e,this._bits/8),n=cmr(r);return this._bits===32?n.getFloat32(0,!0):n.getFloat64(0,!0)}get name(){return`float${this._bits}`}valueToString(e){return e.toString()}},N1=class extends ch{get typeName(){return Ts.FixedIntClass}static[Symbol.hasInstance](e){return e.typeName===Ts.FixedIntClass}constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedInt(this,t)}covariant(e){let t=lce(this._bits-1)*BigInt(-1),r=lce(this._bits-1)-BigInt(1);if(typeof e=="bigint"){if(e>=t&&e<=r)return!0}else if(Number.isInteger(e)){let n=BigInt(e);if(n>=t&&n<=r)return!0}throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){return Hqe(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return Au(-9-e)}decodeValue(e,t){this.checkType(t);let r=dmr(e,this._bits/8);return this._bits<=32?Number(r):r}get name(){return`int${this._bits}`}valueToString(e){return e.toString()}},Hx=class extends ch{get typeName(){return Ts.FixedNatClass}static[Symbol.hasInstance](e){return e.typeName===Ts.FixedNatClass}constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedNat(this,t)}covariant(e){let t=lce(this._bits);if(typeof e=="bigint"&&e>=BigInt(0)){if(e<t)return!0}else if(Number.isInteger(e)&&e>=0&&BigInt(e)<t)return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){return pmr(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return Au(-5-e)}decodeValue(e,t){this.checkType(t);let r=Gqe(e,this._bits/8);return this._bits<=32?Number(r):r}get name(){return`nat${this._bits}`}valueToString(e){return e.toString()}},SV=class rKe extends Zx{get typeName(){return Ts.VecClass}static[Symbol.hasInstance](t){return t.typeName===Ts.VecClass}constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof Hx&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof Hx?this._type._bits:this._type instanceof N1?this._type._bits:0;if(ArrayBuffer.isView(t)&&r==t.BYTES_PER_ELEMENT*8||Array.isArray(t)&&t.every((n,i)=>{try{return this._type.covariant(n)}catch(s){throw new Error(`Invalid ${this.display()} argument:
884
+ `),s=Uqe.replace("%FUNCTION_NAMESPACE%",$qe).replace("%JS_FUNCTIONS%",i);return Rfr.replace("%IMPORTS%",r==="js"?Pfr:Ifr).replace("%CORE_LIB%",t??"core").replace("%FUNCTIONS%",n).replace("%NAMESPACE%",i.length===0?"":s).trim()},Bfr=({fn:e,jsFnName:t,outputLanguage:r})=>{let n=`App${_u(t)}`,i="args"in e?Iqe({id:n,schema:e.args,suffix:"Args"}):void 0,s="result"in e?Iqe({id:n,schema:e.result,suffix:"Result"}):void 0,a=sr(i)&&sr(s)?r==="js"?Afr:Dfr:sr(i)?r==="js"?Ofr:Cfr:sr(s)?r==="js"?wfr:kfr:r==="js"?Nfr:Lfr,o=`${"App".toLowerCase()}_${wy(t)}`;return a.replace("%JS_FUNCTION%",t).replaceAll("%RS_FUNCTION%",o).replaceAll("%ARGS_SCHEMA%",i?.baseName?`${i.baseName}Schema`:"").replaceAll("%ARGS_ZOD%",i?.code??"").replaceAll("%RESULT_SCHEMA%",s?.baseName?`${s.baseName}Schema`:"").replaceAll("%RESULT_ZOD%",s?.code??"").trim()},Kqe=async({functions:e,outputFile:t,transformerOptions:r})=>{let n=Ffr({functions:e,transformerOptions:r});await Efr(t,n,"utf-8")},P1=e=>{switch(e.kind){case"text":return"text";case"bool":return"bool";case"float64":return"float64";case"int32":return"int32";case"bigint":return"nat64";case"nat":return"nat";case"principal":return"principal";case"uint8array":return"blob";case"opt":return`opt ${P1(e.inner)}`;case"vec":return`vec ${P1(e.inner)}`;case"record":return e.fields.length===0?"record {}":`record { ${e.fields.map(t=>`${wy(t.name)} : ${P1(t.type)}`).join("; ")} }`;case"tuple":return`record { ${e.members.map(P1).join("; ")} }`;case"indexedTuple":return`record { ${e.members.map((t,r)=>`${r} : ${P1(t)}`).join("; ")} }`;case"variant":return`variant { ${e.tags.join("; ")} }`;case"discriminatedUnion":return`variant { ${e.members.map(t=>{let r=t.kind==="record"&&t.fields.find(s=>s.name===e.discriminator)?.type.kind==="variant"?(t.fields.find(s=>s.name===e.discriminator)?.type).tags[0]:void 0,n=t.kind==="record"?{kind:"record",fields:t.fields.filter(s=>s.name!==e.discriminator)}:t,i=P1(n);return r!==void 0?`${r} : ${i}`:i}).join("; ")} }`}},Mfr=({id:e,schema:t,isTopLevelOptional:r,suffix:n})=>{let i=`${_u(e)}${n}`;return{baseName:i,code:`type ${i} = ${P1(r?{kind:"opt",inner:t}:t)};`}},Dqe=({id:e,schema:t,suffix:r})=>{let n=pce({zodSchema:t,id:e});return Mfr({...n,suffix:r})},jfr={};lfr(jfr,{Bool:()=>pKe,BoolClass:()=>eKe,CandidDecodeError:()=>lh,ConstructType:()=>Zx,Empty:()=>cKe,EmptyClass:()=>dce,FixedIntClass:()=>N1,FixedNatClass:()=>Hx,Float32:()=>yKe,Float64:()=>TKe,FloatClass:()=>hce,Func:()=>kKe,FuncClass:()=>DR,Int:()=>mKe,Int16:()=>SKe,Int32:()=>bKe,Int64:()=>xKe,Int8:()=>gKe,IntClass:()=>fce,Nat:()=>hKe,Nat16:()=>_Ke,Nat32:()=>vKe,Nat64:()=>PKe,Nat8:()=>EKe,NatClass:()=>mce,Null:()=>dKe,NullClass:()=>NR,Opt:()=>NKe,OptClass:()=>lN,PrimitiveType:()=>ch,Principal:()=>AKe,PrincipalClass:()=>lKe,Rec:()=>CKe,RecClass:()=>ig,Record:()=>IKe,RecordClass:()=>IR,Reserved:()=>uKe,ReservedClass:()=>Gx,Service:()=>LKe,ServiceClass:()=>xV,Text:()=>fKe,TextClass:()=>tKe,Tuple:()=>OKe,TupleClass:()=>iKe,Type:()=>_V,Unknown:()=>gmr,UnknownClass:()=>Qqe,Variant:()=>DKe,VariantClass:()=>bV,Vec:()=>wKe,VecClass:()=>SV,Visitor:()=>hmr,decode:()=>Tmr,encode:()=>ymr,resetSubtypeCache:()=>uce,subtype:()=>Tce});var gV="abcdefghijklmnopqrstuvwxyz234567",oN=Object.create(null);for(let e=0;e<gV.length;e++)oN[gV[e]]=e;oN[0]=oN.o;oN[1]=oN.i;function Vfr(e){let t=0,r=0,n="";function i(s){return t<0?r|=s>>-t:r=s<<t&248,t>3?(t-=8,1):(t<4&&(n+=gV[r>>3],t+=5),0)}for(let s=0;s<e.length;)s+=i(e[s]);return n+(t<0?gV[r>>3]:"")}function $fr(e){let t=0,r=0,n=new Uint8Array(e.length*4/3|0),i=0;function s(a){let o=oN[a.toLowerCase()];if(o===void 0)throw new Error(`Invalid character: ${JSON.stringify(a)}`);o<<=3,r|=o>>>t,t+=5,t>=8&&(n[i++]=r,t-=8,t>0?r=o<<5-t&255:r=0)}for(let a of e)s(a);return n.slice(0,i)}var Ufr=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function qfr(e){let t=-1;for(let r=0;r<e.length;r++){let n=(e[r]^t)&255;t=Ufr[n]^t>>>8}return(t^-1)>>>0}function Kfr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function EV(e,...t){if(!Kfr(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Cqe(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Yfr(e,t){EV(e);let r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function oce(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ice(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function rg(e,t){return e<<32-t|e>>>t}var Yqe=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",zfr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Jfr(e){if(EV(e),Yqe)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=zfr[e[r]];return t}var dS={_0:48,_9:57,A:65,F:70,a:97,f:102};function kqe(e){if(e>=dS._0&&e<=dS._9)return e-dS._0;if(e>=dS.A&&e<=dS.F)return e-(dS.A-10);if(e>=dS.a&&e<=dS.f)return e-(dS.a-10)}function Wfr(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Yqe)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let i=0,s=0;i<r;i++,s+=2){let a=kqe(e.charCodeAt(s)),o=kqe(e.charCodeAt(s+1));if(a===void 0||o===void 0){let l=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}n[i]=a*16+o}return n}function Xfr(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function zqe(e){return typeof e=="string"&&(e=Xfr(e)),EV(e),e}var Hfr=class{};function Gfr(e){let t=n=>e().update(zqe(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Zfr(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),a=Number(r>>i&s),o=Number(r&s),l=n?4:0,c=n?0:4;e.setUint32(t+l,a,n),e.setUint32(t+c,o,n)}function Qfr(e,t,r){return e&t^~e&r}function emr(e,t,r){return e&t^e&r^t&r}var tmr=class extends Hfr{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=ice(this.buffer)}update(e){Cqe(this),e=zqe(e),EV(e);let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let s=0;s<i;){let a=Math.min(n-this.pos,i-s);if(a===n){let o=ice(e);for(;n<=i-s;s+=n)this.process(o,s);continue}r.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Cqe(this),Yfr(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:s}=this;t[s++]=128,oce(this.buffer.subarray(s)),this.padOffset>n-s&&(this.process(r,0),s=0);for(let u=s;u<n;u++)t[u]=0;Zfr(r,n-8,BigInt(this.length*8),i),this.process(r,0);let a=ice(e),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let l=o/4,c=this.get();if(l>c.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,c[u],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:a}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=a,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}},zx=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Jx=Uint32Array.from([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]),rmr=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Wx=new Uint32Array(64),nmr=class extends tmr{constructor(e=32){super(64,e,8,!1),this.A=zx[0]|0,this.B=zx[1]|0,this.C=zx[2]|0,this.D=zx[3]|0,this.E=zx[4]|0,this.F=zx[5]|0,this.G=zx[6]|0,this.H=zx[7]|0}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:a,H:o}=this;return[e,t,r,n,i,s,a,o]}set(e,t,r,n,i,s,a,o){this.A=e|0,this.B=t|0,this.C=r|0,this.D=n|0,this.E=i|0,this.F=s|0,this.G=a|0,this.H=o|0}process(e,t){for(let u=0;u<16;u++,t+=4)Wx[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){let p=Wx[u-15],d=Wx[u-2],f=rg(p,7)^rg(p,18)^p>>>3,m=rg(d,17)^rg(d,19)^d>>>10;Wx[u]=m+Wx[u-7]+f+Wx[u-16]|0}let{A:r,B:n,C:i,D:s,E:a,F:o,G:l,H:c}=this;for(let u=0;u<64;u++){let p=rg(a,6)^rg(a,11)^rg(a,25),d=c+p+Qfr(a,o,l)+rmr[u]+Wx[u]|0,f=(rg(r,2)^rg(r,13)^rg(r,22))+emr(r,n,i)|0;c=l,l=o,o=a,a=s+d|0,s=i,i=n,n=r,r=d+f|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,a=a+this.E|0,o=o+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,s,a,o,l,c)}roundClean(){oce(Wx)}destroy(){this.set(0,0,0,0,0,0,0,0),oce(this.buffer)}},imr=class extends nmr{constructor(){super(28),this.A=Jx[0]|0,this.B=Jx[1]|0,this.C=Jx[2]|0,this.D=Jx[3]|0,this.E=Jx[4]|0,this.F=Jx[5]|0,this.G=Jx[6]|0,this.H=Jx[7]|0}},smr=Gfr(()=>new imr),hV="__principal__",amr=2,Lqe=4,omr="aaaaa-aa",lmr=class sN{static anonymous(){return new this(new Uint8Array([Lqe]))}static managementCanister(){return this.fromText(omr)}static selfAuthenticating(t){let r=smr(t);return new this(new Uint8Array([...r,amr]))}static from(t){if(typeof t=="string")return sN.fromText(t);if(Object.getPrototypeOf(t)===Uint8Array.prototype)return new sN(t);if(sN.isPrincipal(t))return new sN(t._arr);throw new Error(`Impossible to convert ${JSON.stringify(t)} to Principal.`)}static fromHex(t){return new this(Wfr(t))}static fromText(t){let r=t;if(t.includes(hV)){let a=JSON.parse(t);hV in a&&(r=a[hV])}let n=r.toLowerCase().replace(/-/g,""),i=$fr(n);i=i.slice(4,i.length);let s=new this(i);if(s.toText()!==r)throw new Error(`Principal "${s.toText()}" does not have a valid checksum (original value "${r}" may not be a valid Principal ID).`);return s}static fromUint8Array(t){return new this(t)}static isPrincipal(t){return t instanceof sN||typeof t=="object"&&t!==null&&"_isPrincipal"in t&&t._isPrincipal===!0&&"_arr"in t&&t._arr instanceof Uint8Array}constructor(t){this._arr=t,this._isPrincipal=!0}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===Lqe}toUint8Array(){return this._arr}toHex(){return Jfr(this._arr).toUpperCase()}toText(){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,qfr(this._arr));let r=new Uint8Array(t),n=new Uint8Array([...r,...this._arr]),i=Vfr(n).match(/.{1,5}/g);if(!i)throw new Error;return i.join("-")}toString(){return this.toText()}toJSON(){return{[hV]:this.toText()}}compareTo(t){for(let r=0;r<Math.min(this._arr.length,t._arr.length);r++){if(this._arr[r]<t._arr[r])return"lt";if(this._arr[r]>t._arr[r])return"gt"}return this._arr.length<t._arr.length?"lt":this._arr.length>t._arr.length?"gt":"eq"}ltEq(t){let r=this.compareTo(t);return r=="lt"||r=="eq"}gtEq(t){let r=this.compareTo(t);return r=="gt"||r=="eq"}};function io(...e){let t=new Uint8Array(e.reduce((n,i)=>n+i.byteLength,0)),r=0;for(let n of e)t.set(n,r),r+=n.byteLength;return t}var CR=class{save(){return this._view}restore(e){if(!(e instanceof Uint8Array))throw new Error("Checkpoint must be a Uint8Array");this._view=e}constructor(e,t=e?.byteLength||0){if(e&&!(e instanceof Uint8Array))try{e=Jqe(e)}catch{throw new Error("Buffer must be a Uint8Array")}if(t<0||!Number.isInteger(t))throw new Error("Length must be a non-negative integer");if(e&&t>e.byteLength)throw new Error("Length cannot exceed buffer length");this._buffer=e||new Uint8Array(0),this._view=new Uint8Array(this._buffer.buffer,0,t)}get buffer(){return this._view.slice()}get byteLength(){return this._view.byteLength}read(e){let t=this._view.subarray(0,e);return this._view=this._view.subarray(e),t.slice()}readUint8(){if(this._view.byteLength===0)return;let e=this._view[0];return this._view=this._view.subarray(1),e}write(e){if(!(e instanceof Uint8Array))throw new Error("Buffer must be a Uint8Array");let t=this._view.byteLength;this._view.byteOffset+this._view.byteLength+e.byteLength>=this._buffer.byteLength?this.alloc(e.byteLength):this._view=new Uint8Array(this._buffer.buffer,this._view.byteOffset,this._view.byteLength+e.byteLength),this._view.set(e,t)}get end(){return this._view.byteLength===0}alloc(e){if(e<=0||!Number.isInteger(e))throw new Error("Amount must be a positive integer");let t=new Uint8Array((this._buffer.byteLength+e)*1.2|0),r=new Uint8Array(t.buffer,0,this._view.byteLength+e);r.set(this._view),this._buffer=t,this._view=r}};function Jqe(e){if(!e)throw new Error("Input cannot be null or undefined");return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):Array.isArray(e)?new Uint8Array(e):"buffer"in e?Jqe(e.buffer):new Uint8Array(e)}function cmr(e){if(!(e instanceof Uint8Array))throw new Error("Input must be a Uint8Array");return new DataView(e.buffer,e.byteOffset,e.byteLength)}function umr(e){let t=new TextEncoder().encode(e),r=0;for(let n of t)r=(r*223+n)%2**32;return r}function Bf(e){if(/^_\d+_$/.test(e)||/^_0x[0-9a-fA-F]+_$/.test(e)){let t=+e.slice(1,-1);if(Number.isSafeInteger(t)&&t>=0&&t<2**32)return t}return umr(e)}function Wqe(e){let t=BigInt(e);if(e<=0)throw new RangeError("Input must be positive");return t.toString(2).length-1}function lce(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}function Xqe(){throw new Error("unexpected end of buffer")}function O1(e,t){return e.byteLength<t&&Xqe(),e.read(t)}function w1(e){let t=e.readUint8();return t===void 0&&Xqe(),t}function Pu(e){if(typeof e=="number"&&(e=BigInt(e)),e<BigInt(0))throw new Error("Cannot leb encode negative values.");let t=(e===BigInt(0)?0:Wqe(e))+1,r=new CR(new Uint8Array(t),0);for(;;){let n=Number(e&BigInt(127));if(e/=BigInt(128),e===BigInt(0)){r.write(new Uint8Array([n]));break}else r.write(new Uint8Array([n|128]))}return r.buffer}function ap(e){let t=BigInt(1),r=BigInt(0),n;do n=w1(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}function Au(e){typeof e=="number"&&(e=BigInt(e));let t=e<BigInt(0);t&&(e=-e-BigInt(1));let r=(e===BigInt(0)?0:Wqe(e))+1,n=new CR(new Uint8Array(r),0);for(;;){let s=i(e);if(e/=BigInt(128),t&&e===BigInt(0)&&(s&64)!==0||!t&&e===BigInt(0)&&(s&64)===0){n.write(new Uint8Array([s]));break}else n.write(new Uint8Array([s|128]))}function i(s){let a=s%BigInt(128);return Number(t?BigInt(128)-a-BigInt(1):a)}return n.buffer}function Xx(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if((t[r]&64)===0)return ap(e);break}let n=new Uint8Array(O1(e,r+1)),i=BigInt(0);for(let s=n.byteLength-1;s>=0;s--)i=i*BigInt(128)+BigInt(128-(n[s]&127)-1);return-i-BigInt(1)}function pmr(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Hqe(e,t)}function Hqe(e,t){e=BigInt(e);let r=new CR(new Uint8Array(Math.min(1,t)),0),n=0,i=BigInt(256),s=BigInt(0),a=Number(e%i);for(r.write(new Uint8Array([a]));++n<t;)e<0&&s===BigInt(0)&&a!==0&&(s=BigInt(1)),a=Number((e/i-s)%BigInt(256)),r.write(new Uint8Array([a])),i*=BigInt(256);return r.buffer}function Gqe(e,t){if(t<=0||!Number.isInteger(t))throw new Error("Byte length must be a positive integer");let r=BigInt(w1(e)),n=BigInt(1),i=0;for(;++i<t;){n*=BigInt(256);let s=BigInt(w1(e));r=r+n*s}return r}function dmr(e,t){if(t<=0||!Number.isInteger(t))throw new Error("Byte length must be a positive integer");let r=Gqe(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}var lh=class Zqe extends Error{constructor(t){super(t),this.name="CandidDecodeError",Object.setPrototypeOf(this,Zqe.prototype)}},no;(function(e){e[e.Null=-1]="Null",e[e.Bool=-2]="Bool",e[e.Nat=-3]="Nat",e[e.Int=-4]="Int",e[e.Float32=-13]="Float32",e[e.Float64=-14]="Float64",e[e.Text=-15]="Text",e[e.Reserved=-16]="Reserved",e[e.Empty=-17]="Empty",e[e.Opt=-18]="Opt",e[e.Vector=-19]="Vector",e[e.Record=-20]="Record",e[e.Variant=-21]="Variant",e[e.Func=-22]="Func",e[e.Service=-23]="Service",e[e.Principal=-24]="Principal"})(no||(no={}));var yV="DIDL",fmr=new TextEncoder().encode(yV),Rqe=400;function wR(e,t,r){return e.map((n,i)=>r(n,t[i]))}var mmr=class{constructor(){this._typs=[],this._idx=new Map,this._idxRefCount=new Map}has(e){return this._idx.has(e.name)}add(e,t){let r=this._typs.length;this._idx.set(e.name,r),this._idxRefCount.set(r,1),this._typs.push(t)}merge(e,t){let r=this._idx.get(e.name),n=this._idx.get(t);if(r===void 0)throw new Error(`Missing type index for ${e}`);if(n===void 0)throw new Error(`Missing type index for ${t}`);this._typs[r]=this._typs[n];let i=this._getIdxRefCount(r),s=this._getIdxRefCount(n);this._idxRefCount.set(r,i+s),this._idx.set(t,r),this._idxRefCount.set(n,0),this._compactFromEnd()}_getIdxRefCount(e){return this._idxRefCount.get(e)||0}_compactFromEnd(){for(;this._typs.length>0;){let e=this._typs.length-1;if(this._getIdxRefCount(e)>0)break;this._typs.pop(),this._idxRefCount.delete(e)}}encode(){let e=Pu(this._typs.length),t=io(...this._typs);return io(e,t)}indexOf(e){if(!this._idx.has(e))throw new Error(`Missing type index for ${e}`);return Au(this._idx.get(e)||0)}},hmr=class{visitType(e,t){throw new Error("Not implemented")}visitPrimitive(e,t){return this.visitType(e,t)}visitEmpty(e,t){return this.visitPrimitive(e,t)}visitBool(e,t){return this.visitPrimitive(e,t)}visitNull(e,t){return this.visitPrimitive(e,t)}visitReserved(e,t){return this.visitPrimitive(e,t)}visitText(e,t){return this.visitPrimitive(e,t)}visitNumber(e,t){return this.visitPrimitive(e,t)}visitInt(e,t){return this.visitNumber(e,t)}visitNat(e,t){return this.visitNumber(e,t)}visitFloat(e,t){return this.visitPrimitive(e,t)}visitFixedInt(e,t){return this.visitNumber(e,t)}visitFixedNat(e,t){return this.visitNumber(e,t)}visitPrincipal(e,t){return this.visitPrimitive(e,t)}visitConstruct(e,t){return this.visitType(e,t)}visitVec(e,t,r){return this.visitConstruct(e,r)}visitOpt(e,t,r){return this.visitConstruct(e,r)}visitRecord(e,t,r){return this.visitConstruct(e,r)}visitTuple(e,t,r){let n=t.map((i,s)=>[`_${s}_`,i]);return this.visitRecord(e,n,r)}visitVariant(e,t,r){return this.visitConstruct(e,r)}visitRec(e,t,r){return this.visitConstruct(t,r)}visitFunc(e,t){return this.visitConstruct(e,t)}visitService(e,t){return this.visitConstruct(e,t)}},Ts;(function(e){e.EmptyClass="__IDL_EmptyClass__",e.UnknownClass="__IDL_UnknownClass__",e.BoolClass="__IDL_BoolClass__",e.NullClass="__IDL_NullClass__",e.ReservedClass="__IDL_ReservedClass__",e.TextClass="__IDL_TextClass__",e.IntClass="__IDL_IntClass__",e.NatClass="__IDL_NatClass__",e.FloatClass="__IDL_FloatClass__",e.FixedIntClass="__IDL_FixedIntClass__",e.FixedNatClass="__IDL_FixedNatClass__",e.VecClass="__IDL_VecClass__",e.OptClass="__IDL_OptClass__",e.RecordClass="__IDL_RecordClass__",e.TupleClass="__IDL_TupleClass__",e.VariantClass="__IDL_VariantClass__",e.RecClass="__IDL_RecClass__",e.PrincipalClass="__IDL_PrincipalClass__",e.FuncClass="__IDL_FuncClass__",e.ServiceClass="__IDL_ServiceClass__"})(Ts||(Ts={}));var _V=class{display(){return this.name}valueToString(e){return qc(e)}buildTypeTable(e){e.has(this)||this._buildTypeTableImpl(e)}},ch=class extends _V{checkType(e){if(this.name!==e.name)throw new Error(`type mismatch: type on the wire ${e.name}, expect type ${this.name}`);return e}_buildTypeTableImpl(e){}},Zx=class extends _V{checkType(e){if(e instanceof ig){let t=e.getType();if(typeof t>"u")throw new lh("Type mismatch: cannot decode from uninitialized recursive type");return t}throw new Error(`type mismatch: type on the wire ${e.name}, expect type ${this.name}`)}encodeType(e){return e.indexOf(this.name)}},dce=class extends ch{get typeName(){return Ts.EmptyClass}static[Symbol.hasInstance](e){return e.typeName===Ts.EmptyClass}accept(e,t){return e.visitEmpty(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return Au(no.Empty)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},Qqe=class extends _V{get typeName(){return Ts.UnknownClass}static[Symbol.hasInstance](e){return e.typeName===Ts.UnknownClass}checkType(e){throw new Error("Method not implemented for unknown.")}accept(e,t){throw e.visitType(this,t)}covariant(e){throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(){throw new Error("Unknown cannot appear as a function argument")}valueToString(){throw new Error("Unknown cannot appear as a value")}encodeType(){throw new Error("Unknown cannot be serialized")}decodeValue(e,t){let r=t.decodeValue(e,t);Object(r)!==r&&(r=Object(r));let n;return t instanceof ig?n=()=>t.getType():n=()=>t,Object.defineProperty(r,"type",{value:n,writable:!0,enumerable:!1,configurable:!0}),r}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}},eKe=class extends ch{get typeName(){return Ts.BoolClass}static[Symbol.hasInstance](e){return e.typeName===Ts.BoolClass}accept(e,t){return e.visitBool(this,t)}covariant(e){if(typeof e=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){return new Uint8Array([e?1:0])}encodeType(){return Au(no.Bool)}decodeValue(e,t){switch(this.checkType(t),w1(e)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},NR=class extends ch{get typeName(){return Ts.NullClass}static[Symbol.hasInstance](e){return e.typeName===Ts.NullClass}accept(e,t){return e.visitNull(this,t)}covariant(e){if(e===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(){return new Uint8Array(0)}encodeType(){return Au(no.Null)}decodeValue(e,t){return this.checkType(t),null}get name(){return"null"}},Gx=class extends ch{get typeName(){return Ts.ReservedClass}static[Symbol.hasInstance](e){return e.typeName===Ts.ReservedClass}accept(e,t){return e.visitReserved(this,t)}covariant(e){return!0}encodeValue(){return new Uint8Array(0)}encodeType(){return Au(no.Reserved)}decodeValue(e,t){return t.name!==this.name&&t.decodeValue(e,t),null}get name(){return"reserved"}},tKe=class extends ch{get typeName(){return Ts.TextClass}static[Symbol.hasInstance](e){return e.typeName===Ts.TextClass}accept(e,t){return e.visitText(this,t)}covariant(e){if(typeof e=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){let t=new TextEncoder().encode(e),r=Pu(t.byteLength);return io(r,t)}encodeType(){return Au(no.Text)}decodeValue(e,t){this.checkType(t);let r=ap(e),n=O1(e,Number(r));return new TextDecoder("utf8",{fatal:!0}).decode(n)}get name(){return"text"}valueToString(e){return`"${e}"`}},fce=class extends ch{get typeName(){return Ts.IntClass}static[Symbol.hasInstance](e){return e.typeName===Ts.IntClass}accept(e,t){return e.visitInt(this,t)}covariant(e){if(typeof e=="bigint"||Number.isInteger(e))return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){return Au(e)}encodeType(){return Au(no.Int)}decodeValue(e,t){return this.checkType(t),Xx(e)}get name(){return"int"}valueToString(e){return e.toString()}},mce=class extends ch{get typeName(){return Ts.NatClass}static[Symbol.hasInstance](e){return e.typeName===Ts.NatClass}accept(e,t){return e.visitNat(this,t)}covariant(e){if(typeof e=="bigint"&&e>=BigInt(0)||Number.isInteger(e)&&e>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){return Pu(e)}encodeType(){return Au(no.Nat)}decodeValue(e,t){return this.checkType(t),ap(e)}get name(){return"nat"}valueToString(e){return e.toString()}},hce=class extends ch{get typeName(){return Ts.FloatClass}static[Symbol.hasInstance](e){return e.typeName===Ts.FloatClass}constructor(e){if(super(),this._bits=e,e!==32&&e!==64)throw new Error("not a valid float type")}accept(e,t){return e.visitFloat(this,t)}covariant(e){if(typeof e=="number"||e instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){let t=new ArrayBuffer(this._bits/8),r=new DataView(t);return this._bits===32?r.setFloat32(0,e,!0):r.setFloat64(0,e,!0),new Uint8Array(t)}encodeType(){let e=this._bits===32?no.Float32:no.Float64;return Au(e)}decodeValue(e,t){this.checkType(t);let r=O1(e,this._bits/8),n=cmr(r);return this._bits===32?n.getFloat32(0,!0):n.getFloat64(0,!0)}get name(){return`float${this._bits}`}valueToString(e){return e.toString()}},N1=class extends ch{get typeName(){return Ts.FixedIntClass}static[Symbol.hasInstance](e){return e.typeName===Ts.FixedIntClass}constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedInt(this,t)}covariant(e){let t=lce(this._bits-1)*BigInt(-1),r=lce(this._bits-1)-BigInt(1);if(typeof e=="bigint"){if(e>=t&&e<=r)return!0}else if(Number.isInteger(e)){let n=BigInt(e);if(n>=t&&n<=r)return!0}throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){return Hqe(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return Au(-9-e)}decodeValue(e,t){this.checkType(t);let r=dmr(e,this._bits/8);return this._bits<=32?Number(r):r}get name(){return`int${this._bits}`}valueToString(e){return e.toString()}},Hx=class extends ch{get typeName(){return Ts.FixedNatClass}static[Symbol.hasInstance](e){return e.typeName===Ts.FixedNatClass}constructor(e){super(),this._bits=e}accept(e,t){return e.visitFixedNat(this,t)}covariant(e){let t=lce(this._bits);if(typeof e=="bigint"&&e>=BigInt(0)){if(e<t)return!0}else if(Number.isInteger(e)&&e>=0&&BigInt(e)<t)return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(e)}`)}encodeValue(e){return pmr(e,this._bits/8)}encodeType(){let e=Math.log2(this._bits)-3;return Au(-5-e)}decodeValue(e,t){this.checkType(t);let r=Gqe(e,this._bits/8);return this._bits<=32?Number(r):r}get name(){return`nat${this._bits}`}valueToString(e){return e.toString()}},SV=class rKe extends Zx{get typeName(){return Ts.VecClass}static[Symbol.hasInstance](t){return t.typeName===Ts.VecClass}constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof Hx&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof Hx?this._type._bits:this._type instanceof N1?this._type._bits:0;if(ArrayBuffer.isView(t)&&r==t.BYTES_PER_ELEMENT*8||Array.isArray(t)&&t.every((n,i)=>{try{return this._type.covariant(n)}catch(s){throw new Error(`Invalid ${this.display()} argument:
886
885
 
887
886
  index ${i} -> ${s.message}`,{cause:s})}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${qc(t)}`)}encodeValue(t){let r=Pu(t.length);if(this._blobOptimization)return io(r,new Uint8Array(t));if(ArrayBuffer.isView(t)){if(t instanceof Int16Array||t instanceof Uint16Array){let i=new DataView(new ArrayBuffer(t.length*2));for(let s=0;s<t.length;s++)t instanceof Int16Array?i.setInt16(s*2,t[s],!0):i.setUint16(s*2,t[s],!0);return io(r,new Uint8Array(i.buffer))}if(t instanceof Int32Array||t instanceof Uint32Array){let i=new DataView(new ArrayBuffer(t.length*4));for(let s=0;s<t.length;s++)t instanceof Int32Array?i.setInt32(s*4,t[s],!0):i.setUint32(s*4,t[s],!0);return io(r,new Uint8Array(i.buffer))}if(t instanceof BigInt64Array||t instanceof BigUint64Array){let i=new DataView(new ArrayBuffer(t.length*8));for(let s=0;s<t.length;s++)t instanceof BigInt64Array?i.setBigInt64(s*8,t[s],!0):i.setBigUint64(s*8,t[s],!0);return io(r,new Uint8Array(i.buffer))}return io(r,new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}let n=new CR(new Uint8Array(r.byteLength+t.length),0);n.write(r);for(let i of t){let s=this._type.encodeValue(i);n.write(new Uint8Array(s))}return n.buffer}_buildTypeTableImpl(t){this._type.buildTypeTable(t);let r=Au(no.Vector),n=this._type.encodeType(t);t.add(this,io(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof rKe))throw new lh(`Expected type '${this.display()}', but received non-vector type '${n.display()}'`);let i=Number(ap(t));if(this._type instanceof Hx){if(this._type._bits==8)return new Uint8Array(t.read(i));if(this._type._bits==16){let a=t.read(i*2);return new Uint16Array(a.buffer,a.byteOffset,i)}if(this._type._bits==32){let a=t.read(i*4);return new Uint32Array(a.buffer,a.byteOffset,i)}if(this._type._bits==64)return new BigUint64Array(t.read(i*8).buffer)}if(this._type instanceof N1){if(this._type._bits==8)return new Int8Array(t.read(i));if(this._type._bits==16){let a=t.read(i*2),o=new DataView(a.buffer,a.byteOffset,a.byteLength),l=new Int16Array(i);for(let c=0;c<i;c++)l[c]=o.getInt16(c*2,!0);return l}if(this._type._bits==32){let a=t.read(i*4),o=new DataView(a.buffer,a.byteOffset,a.byteLength),l=new Int32Array(i);for(let c=0;c<i;c++)l[c]=o.getInt32(c*4,!0);return l}if(this._type._bits==64){let a=t.read(i*8),o=new DataView(a.buffer,a.byteOffset,a.byteLength),l=new BigInt64Array(i);for(let c=0;c<i;c++)l[c]=o.getBigInt64(c*8,!0);return l}}let s=[];for(let a=0;a<i;a++)s.push(this._type.decodeValue(t,n._type));return s}get name(){return`vec ${this._type.name}`}display(){return`vec ${this._type.display()}`}valueToString(t){return`vec {${t.map(r=>this._type.valueToString(r)).join("; ")}}`}},lN=class cce extends Zx{get typeName(){return Ts.OptClass}static[Symbol.hasInstance](t){return t.typeName===Ts.OptClass}constructor(t){super(),this._type=t}accept(t,r){return t.visitOpt(this,this._type,r)}covariant(t){try{if(Array.isArray(t)&&(t.length===0||t.length===1&&this._type.covariant(t[0])))return!0}catch(r){throw new Error(`Invalid ${this.display()} argument: ${qc(t)}
888
887
 
@@ -1053,7 +1052,7 @@ Done. The ${jc(t)} ${(0,Vm.green)(r)} has been configured for your terminal. \u2
1053
1052
  ${(0,Fo.yellow)("--source-path")} Optional path to the TypeScript or JavaScript entry file.`,m8=`${Nea}
1054
1053
  ${Iea}`,Q3e=`${(0,Fo.yellow)("--container-url")} Override a custom container URL. If not provided, defaults to production or the local container in development mode.`,Ao=`${m8}
1055
1054
  ${Q3e}
1056
- ${(0,Fo.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,tZ=`The option ${(0,Fo.yellow)("--keep-staged")} only applies when ${(0,Fo.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var In=e=>Li({args:e,options:["-d","--doc"]})?"doc":"cli";var hc=ir(cr(),1);var lv="0.14.4";var Cea=` __ __ __ __ _ ____
1055
+ ${(0,Fo.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,tZ=`The option ${(0,Fo.yellow)("--keep-staged")} only applies when ${(0,Fo.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var In=e=>Li({args:e,options:["-d","--doc"]})?"doc":"cli";var hc=ir(cr(),1);var lv="0.14.5-next-2026-04-05";var Cea=` __ __ __ __ _ ____
1057
1056
  __) || | || \\| |/ \\
1058
1057
  \\___/ \\___/ |_|\\__|\\____/`,wn=`${Cea} CLI ${(0,hc.grey)(`v${lv}`)}`,e6t=`Juno CLI ${(0,hc.grey)(`v${lv}`)}`,h8=`
1059
1058
  ${wn}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/cli",
3
- "version": "0.14.4",
3
+ "version": "0.14.5-next-2026-04-05",
4
4
  "description": "The Juno command-line interface",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",
@@ -38,7 +38,7 @@
38
38
  "@junobuild/config": "^2.15.1",
39
39
  "@junobuild/config-loader": "^0.4.10",
40
40
  "@junobuild/core": "^5.3.1",
41
- "@junobuild/functions-tools": "^0.6.2",
41
+ "@junobuild/functions-tools": "^0.6.3",
42
42
  "@junobuild/ic-client": "^8.1.2",
43
43
  "@junobuild/schema": "^1.2.1",
44
44
  "@junobuild/storage": "^2.4.1",
@@ -91,4 +91,4 @@
91
91
  "engines": {
92
92
  "node": ">=20"
93
93
  }
94
- }
94
+ }