@junobuild/admin 0.0.58-next-2024-11-25.3 → 0.0.58-next-2024-11-26
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.
- package/dist/browser/index.js +5 -5
- package/dist/browser/index.js.map +4 -4
- package/dist/node/index.mjs +4 -4
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/handlers/upgrade.handlers.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/services/mission-control.upgrade.services.d.ts +10 -10
- package/dist/types/services/orbiter.upgrade.services.d.ts +11 -13
- package/dist/types/services/satellite.upgrade.services.d.ts +14 -15
- package/dist/types/types/upgrade.types.d.ts +7 -0
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { createRequire as topLevelCreateRequire } from 'module';
|
|
2
2
|
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
-
var hn=Object.create;var St=Object.defineProperty;var yn=Object.getOwnPropertyDescriptor;var _n=Object.getOwnPropertyNames;var gn=Object.getPrototypeOf,Tn=Object.prototype.hasOwnProperty;var Rt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var bn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _n(t))!Tn.call(e,o)&&o!==r&&St(e,o,{get:()=>t[o],enumerable:!(n=yn(t,o))||n.enumerable});return e};var Vt=(e,t,r)=>(r=e!=null?hn(gn(e)):{},bn(t||!e||!e.__esModule?St(r,"default",{value:e,enumerable:!0}):r,e));var Ce=Z(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.bufFromBufLike=k.uint8ToBuf=k.PipeArrayBuffer=k.fromHexString=k.toHexString=k.concat=void 0;function Un(...e){let t=new Uint8Array(e.reduce((n,o)=>n+o.byteLength,0)),r=0;for(let n of e)t.set(new Uint8Array(n),r),r+=n.byteLength;return t}k.concat=Un;function $n(e){return new Uint8Array(e).reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}k.toHexString=$n;function qn(e){var t;return new Uint8Array(((t=e.match(/.{1,2}/g))!==null&&t!==void 0?t:[]).map(r=>parseInt(r,16)))}k.fromHexString=qn;var et=class{constructor(t,r=t?.byteLength||0){this._buffer=Pe(t||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return Pe(this._view.slice())}get byteLength(){return this._view.byteLength}read(t){let r=this._view.subarray(0,t);return this._view=this._view.subarray(t),r.slice().buffer}readUint8(){let t=this._view[0];return this._view=this._view.subarray(1),t}write(t){let r=new Uint8Array(t),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+r.byteLength>=this._buffer.byteLength?this.alloc(r.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+r.byteLength),this._view.set(r,n)}get end(){return this._view.byteLength===0}alloc(t){let r=new ArrayBuffer((this._buffer.byteLength+t)*1.2|0),n=new Uint8Array(r,0,this._view.byteLength+t);n.set(this._view),this._buffer=r,this._view=n}};k.PipeArrayBuffer=et;function Ne(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).buffer}k.uint8ToBuf=Ne;function Pe(e){return e instanceof Uint8Array?Ne(e):e instanceof ArrayBuffer?e:Array.isArray(e)?Ne(new Uint8Array(e)):"buffer"in e?Pe(e.buffer):Ne(new Uint8Array(e))}k.bufFromBufLike=Pe});var tt=Z(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.idlLabelToId=void 0;function jn(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function zn(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 jn(e)}Se.idlLabelToId=zn});var nt=Z(v=>{"use strict";Object.defineProperty(v,"__esModule",{value:!0});v.readIntLE=v.readUIntLE=v.writeIntLE=v.writeUIntLE=v.slebDecode=v.slebEncode=v.lebDecode=v.lebEncode=v.safeReadUint8=v.safeRead=void 0;var rt=Ce();function Lt(){throw new Error("unexpected end of buffer")}function er(e,t){return e.byteLength<t&&Lt(),e.read(t)}v.safeRead=er;function Re(e){let t=e.readUint8();return t===void 0&&Lt(),t}v.safeReadUint8=Re;function Hn(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:Math.ceil(Math.log2(Number(e))))+1,r=new rt.PipeArrayBuffer(new ArrayBuffer(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}v.lebEncode=Hn;function tr(e){let t=BigInt(1),r=BigInt(0),n;do n=Re(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}v.lebDecode=tr;function Kn(e){typeof e=="number"&&(e=BigInt(e));let t=e<BigInt(0);t&&(e=-e-BigInt(1));let r=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,n=new rt.PipeArrayBuffer(new ArrayBuffer(r),0);for(;;){let i=o(e);if(e/=BigInt(128),t&&e===BigInt(0)&&i&64||!t&&e===BigInt(0)&&!(i&64)){n.write(new Uint8Array([i]));break}else n.write(new Uint8Array([i|128]))}function o(i){let a=i%BigInt(128);return Number(t?BigInt(128)-a-BigInt(1):a)}return n.buffer}v.slebEncode=Kn;function Wn(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return tr(e);break}let n=new Uint8Array(er(e,r+1)),o=BigInt(0);for(let i=n.byteLength-1;i>=0;i--)o=o*BigInt(128)+BigInt(128-(n[i]&127)-1);return-o-BigInt(1)}v.slebDecode=Wn;function Gn(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return rr(e,t)}v.writeUIntLE=Gn;function rr(e,t){e=BigInt(e);let r=new rt.PipeArrayBuffer(new ArrayBuffer(Math.min(1,t)),0),n=0,o=BigInt(256),i=BigInt(0),a=Number(e%o);for(r.write(new Uint8Array([a]));++n<t;)e<0&&i===BigInt(0)&&a!==0&&(i=BigInt(1)),a=Number((e/o-i)%BigInt(256)),r.write(new Uint8Array([a])),o*=BigInt(256);return r.buffer}v.writeIntLE=rr;function nr(e,t){let r=BigInt(Re(e)),n=BigInt(1),o=0;for(;++o<t;){n*=BigInt(256);let i=BigInt(Re(e));r=r+n*i}return r}v.readUIntLE=nr;function Jn(e,t){let r=nr(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}v.readIntLE=Jn});var or=Z(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.iexp2=ie.ilog2=void 0;function Xn(e){let t=BigInt(e);if(e<=0)throw new RangeError("Input must be positive");return t.toString(2).length-1}ie.ilog2=Xn;function Zn(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}ie.iexp2=Zn});var ct=Z(s=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});s.Variant=s.Record=s.Opt=s.Vec=s.Tuple=s.Principal=s.Nat64=s.Nat32=s.Nat16=s.Nat8=s.Int64=s.Int32=s.Int16=s.Int8=s.Float64=s.Float32=s.Nat=s.Int=s.Text=s.Null=s.Bool=s.Unknown=s.Reserved=s.Empty=s.decode=s.encode=s.ServiceClass=s.FuncClass=s.PrincipalClass=s.RecClass=s.VariantClass=s.TupleClass=s.RecordClass=s.OptClass=s.VecClass=s.FixedNatClass=s.FixedIntClass=s.FloatClass=s.NatClass=s.IntClass=s.TextClass=s.ReservedClass=s.NullClass=s.BoolClass=s.UnknownClass=s.EmptyClass=s.ConstructType=s.PrimitiveType=s.Type=s.Visitor=void 0;s.Service=s.Func=s.Rec=void 0;var Yn=Rt("@dfinity/principal"),h=Ce(),z=tt(),c=nt(),ot=or(),Ve="DIDL",ir=400;function fe(e,t,r){return e.map((n,o)=>r(n,t[o]))}var it=class{constructor(){this._typs=[],this._idx=new Map}has(t){return this._idx.has(t.name)}add(t,r){let n=this._typs.length;this._idx.set(t.name,n),this._typs.push(r)}merge(t,r){let n=this._idx.get(t.name),o=this._idx.get(r);if(n===void 0)throw new Error("Missing type index for "+t);if(o===void 0)throw new Error("Missing type index for "+r);this._typs[n]=this._typs[o],this._typs.splice(o,1),this._idx.delete(r)}encode(){let t=(0,c.lebEncode)(this._typs.length),r=(0,h.concat)(...this._typs);return(0,h.concat)(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return(0,c.slebEncode)(this._idx.get(t)||0)}},st=class{visitType(t,r){throw new Error("Not implemented")}visitPrimitive(t,r){return this.visitType(t,r)}visitEmpty(t,r){return this.visitPrimitive(t,r)}visitBool(t,r){return this.visitPrimitive(t,r)}visitNull(t,r){return this.visitPrimitive(t,r)}visitReserved(t,r){return this.visitPrimitive(t,r)}visitText(t,r){return this.visitPrimitive(t,r)}visitNumber(t,r){return this.visitPrimitive(t,r)}visitInt(t,r){return this.visitNumber(t,r)}visitNat(t,r){return this.visitNumber(t,r)}visitFloat(t,r){return this.visitPrimitive(t,r)}visitFixedInt(t,r){return this.visitNumber(t,r)}visitFixedNat(t,r){return this.visitNumber(t,r)}visitPrincipal(t,r){return this.visitPrimitive(t,r)}visitConstruct(t,r){return this.visitType(t,r)}visitVec(t,r,n){return this.visitConstruct(t,n)}visitOpt(t,r,n){return this.visitConstruct(t,n)}visitRecord(t,r,n){return this.visitConstruct(t,n)}visitTuple(t,r,n){let o=r.map((i,a)=>[`_${a}_`,i]);return this.visitRecord(t,o,n)}visitVariant(t,r,n){return this.visitConstruct(t,n)}visitRec(t,r,n){return this.visitConstruct(r,n)}visitFunc(t,r){return this.visitConstruct(t,r)}visitService(t,r){return this.visitConstruct(t,r)}};s.Visitor=st;var se=class{display(){return this.name}valueToString(t){return S(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}};s.Type=se;var U=class extends se{checkType(t){if(this.name!==t.name)throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`);return t}_buildTypeTableImpl(t){}};s.PrimitiveType=U;var K=class extends se{checkType(t){if(t instanceof Q){let r=t.getType();if(typeof r>"u")throw new Error("type mismatch with uninitialized type");return r}throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`)}encodeType(t){return t.indexOf(this.name)}};s.ConstructType=K;var Ae=class extends U{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return(0,c.slebEncode)(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}};s.EmptyClass=Ae;var Oe=class extends se{checkType(t){throw new Error("Method not implemented for unknown.")}accept(t,r){throw t.visitType(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}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(t,r){let n=r.decodeValue(t,r);Object(n)!==n&&(n=Object(n));let o;return r instanceof Q?o=()=>r.getType():o=()=>r,Object.defineProperty(n,"type",{value:o,writable:!0,enumerable:!1,configurable:!0}),n}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}};s.UnknownClass=Oe;var Fe=class extends U{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return(0,c.slebEncode)(-2)}decodeValue(t,r){switch(this.checkType(r),(0,c.safeReadUint8)(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}};s.BoolClass=Fe;var Ee=class extends U{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return(0,c.slebEncode)(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}};s.NullClass=Ee;var ae=class extends U{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return(0,c.slebEncode)(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}};s.ReservedClass=ae;var Me=class extends U{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=(0,c.lebEncode)(r.byteLength);return(0,h.concat)(n,r)}encodeType(){return(0,c.slebEncode)(-15)}decodeValue(t,r){this.checkType(r);let n=(0,c.lebDecode)(t),o=(0,c.safeRead)(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}};s.TextClass=Me;var Be=class extends U{accept(t,r){return t.visitInt(this,r)}covariant(t){if(typeof t=="bigint"||Number.isInteger(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return(0,c.slebEncode)(t)}encodeType(){return(0,c.slebEncode)(-4)}decodeValue(t,r){return this.checkType(r),(0,c.slebDecode)(t)}get name(){return"int"}valueToString(t){return t.toString()}};s.IntClass=Be;var ke=class extends U{accept(t,r){return t.visitNat(this,r)}covariant(t){if(typeof t=="bigint"&&t>=BigInt(0)||Number.isInteger(t)&&t>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return(0,c.lebEncode)(t)}encodeType(){return(0,c.slebEncode)(-3)}decodeValue(t,r){return this.checkType(r),(0,c.lebDecode)(t)}get name(){return"nat"}valueToString(t){return t.toString()}};s.NatClass=ke;var he=class extends U{constructor(t){if(super(),this._bits=t,t!==32&&t!==64)throw new Error("not a valid float type")}accept(t,r){return t.visitFloat(this,r)}covariant(t){if(typeof t=="number"||t instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){let r=new ArrayBuffer(this._bits/8),n=new DataView(r);return this._bits===32?n.setFloat32(0,t,!0):n.setFloat64(0,t,!0),r}encodeType(){let t=this._bits===32?-13:-14;return(0,c.slebEncode)(t)}decodeValue(t,r){this.checkType(r);let n=(0,c.safeRead)(t,this._bits/8),o=new DataView(n);return this._bits===32?o.getFloat32(0,!0):o.getFloat64(0,!0)}get name(){return"float"+this._bits}valueToString(t){return t.toString()}};s.FloatClass=he;var Y=class extends U{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=(0,ot.iexp2)(this._bits-1)*BigInt(-1),n=(0,ot.iexp2)(this._bits-1)-BigInt(1),o=!1;if(typeof t=="bigint")o=t>=r&&t<=n;else if(Number.isInteger(t)){let i=BigInt(t);o=i>=r&&i<=n}else o=!1;if(o)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return(0,c.writeIntLE)(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return(0,c.slebEncode)(-9-t)}decodeValue(t,r){this.checkType(r);let n=(0,c.readIntLE)(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}};s.FixedIntClass=Y;var H=class extends U{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=(0,ot.iexp2)(this._bits),n=!1;if(typeof t=="bigint"&&t>=BigInt(0)?n=t<r:Number.isInteger(t)&&t>=0?n=BigInt(t)<r:n=!1,n)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return(0,c.writeUIntLE)(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return(0,c.slebEncode)(-5-t)}decodeValue(t,r){this.checkType(r);let n=(0,c.readUIntLE)(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}};s.FixedNatClass=H;var Ue=class e extends K{constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof H&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof H?this._type._bits:this._type instanceof Y?this._type._bits:0;if(ArrayBuffer.isView(t)&&r==t.BYTES_PER_ELEMENT*8||Array.isArray(t)&&t.every((n,o)=>{try{return this._type.covariant(n)}catch(i){throw new Error(`Invalid ${this.display()} argument:
|
|
3
|
+
var yn=Object.create;var St=Object.defineProperty;var _n=Object.getOwnPropertyDescriptor;var gn=Object.getOwnPropertyNames;var Tn=Object.getPrototypeOf,bn=Object.prototype.hasOwnProperty;var Rt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Z=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var xn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of gn(t))!bn.call(e,o)&&o!==r&&St(e,o,{get:()=>t[o],enumerable:!(n=_n(t,o))||n.enumerable});return e};var Vt=(e,t,r)=>(r=e!=null?yn(Tn(e)):{},xn(t||!e||!e.__esModule?St(r,"default",{value:e,enumerable:!0}):r,e));var Ce=Z(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.bufFromBufLike=k.uint8ToBuf=k.PipeArrayBuffer=k.fromHexString=k.toHexString=k.concat=void 0;function $n(...e){let t=new Uint8Array(e.reduce((n,o)=>n+o.byteLength,0)),r=0;for(let n of e)t.set(new Uint8Array(n),r),r+=n.byteLength;return t}k.concat=$n;function qn(e){return new Uint8Array(e).reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}k.toHexString=qn;function jn(e){var t;return new Uint8Array(((t=e.match(/.{1,2}/g))!==null&&t!==void 0?t:[]).map(r=>parseInt(r,16)))}k.fromHexString=jn;var et=class{constructor(t,r=t?.byteLength||0){this._buffer=Ne(t||new ArrayBuffer(0)),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return Ne(this._view.slice())}get byteLength(){return this._view.byteLength}read(t){let r=this._view.subarray(0,t);return this._view=this._view.subarray(t),r.slice().buffer}readUint8(){let t=this._view[0];return this._view=this._view.subarray(1),t}write(t){let r=new Uint8Array(t),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+r.byteLength>=this._buffer.byteLength?this.alloc(r.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+r.byteLength),this._view.set(r,n)}get end(){return this._view.byteLength===0}alloc(t){let r=new ArrayBuffer((this._buffer.byteLength+t)*1.2|0),n=new Uint8Array(r,0,this._view.byteLength+t);n.set(this._view),this._buffer=r,this._view=n}};k.PipeArrayBuffer=et;function Pe(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).buffer}k.uint8ToBuf=Pe;function Ne(e){return e instanceof Uint8Array?Pe(e):e instanceof ArrayBuffer?e:Array.isArray(e)?Pe(new Uint8Array(e)):"buffer"in e?Ne(e.buffer):Pe(new Uint8Array(e))}k.bufFromBufLike=Ne});var tt=Z(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.idlLabelToId=void 0;function zn(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function Hn(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 zn(e)}Se.idlLabelToId=Hn});var nt=Z(v=>{"use strict";Object.defineProperty(v,"__esModule",{value:!0});v.readIntLE=v.readUIntLE=v.writeIntLE=v.writeUIntLE=v.slebDecode=v.slebEncode=v.lebDecode=v.lebEncode=v.safeReadUint8=v.safeRead=void 0;var rt=Ce();function er(){throw new Error("unexpected end of buffer")}function tr(e,t){return e.byteLength<t&&er(),e.read(t)}v.safeRead=tr;function Re(e){let t=e.readUint8();return t===void 0&&er(),t}v.safeReadUint8=Re;function Kn(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:Math.ceil(Math.log2(Number(e))))+1,r=new rt.PipeArrayBuffer(new ArrayBuffer(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}v.lebEncode=Kn;function rr(e){let t=BigInt(1),r=BigInt(0),n;do n=Re(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}v.lebDecode=rr;function Wn(e){typeof e=="number"&&(e=BigInt(e));let t=e<BigInt(0);t&&(e=-e-BigInt(1));let r=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,n=new rt.PipeArrayBuffer(new ArrayBuffer(r),0);for(;;){let i=o(e);if(e/=BigInt(128),t&&e===BigInt(0)&&i&64||!t&&e===BigInt(0)&&!(i&64)){n.write(new Uint8Array([i]));break}else n.write(new Uint8Array([i|128]))}function o(i){let a=i%BigInt(128);return Number(t?BigInt(128)-a-BigInt(1):a)}return n.buffer}v.slebEncode=Wn;function Gn(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return rr(e);break}let n=new Uint8Array(tr(e,r+1)),o=BigInt(0);for(let i=n.byteLength-1;i>=0;i--)o=o*BigInt(128)+BigInt(128-(n[i]&127)-1);return-o-BigInt(1)}v.slebDecode=Gn;function Jn(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return nr(e,t)}v.writeUIntLE=Jn;function nr(e,t){e=BigInt(e);let r=new rt.PipeArrayBuffer(new ArrayBuffer(Math.min(1,t)),0),n=0,o=BigInt(256),i=BigInt(0),a=Number(e%o);for(r.write(new Uint8Array([a]));++n<t;)e<0&&i===BigInt(0)&&a!==0&&(i=BigInt(1)),a=Number((e/o-i)%BigInt(256)),r.write(new Uint8Array([a])),o*=BigInt(256);return r.buffer}v.writeIntLE=nr;function or(e,t){let r=BigInt(Re(e)),n=BigInt(1),o=0;for(;++o<t;){n*=BigInt(256);let i=BigInt(Re(e));r=r+n*i}return r}v.readUIntLE=or;function Xn(e,t){let r=or(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}v.readIntLE=Xn});var ir=Z(ie=>{"use strict";Object.defineProperty(ie,"__esModule",{value:!0});ie.iexp2=ie.ilog2=void 0;function Zn(e){let t=BigInt(e);if(e<=0)throw new RangeError("Input must be positive");return t.toString(2).length-1}ie.ilog2=Zn;function Yn(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}ie.iexp2=Yn});var ct=Z(s=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});s.Variant=s.Record=s.Opt=s.Vec=s.Tuple=s.Principal=s.Nat64=s.Nat32=s.Nat16=s.Nat8=s.Int64=s.Int32=s.Int16=s.Int8=s.Float64=s.Float32=s.Nat=s.Int=s.Text=s.Null=s.Bool=s.Unknown=s.Reserved=s.Empty=s.decode=s.encode=s.ServiceClass=s.FuncClass=s.PrincipalClass=s.RecClass=s.VariantClass=s.TupleClass=s.RecordClass=s.OptClass=s.VecClass=s.FixedNatClass=s.FixedIntClass=s.FloatClass=s.NatClass=s.IntClass=s.TextClass=s.ReservedClass=s.NullClass=s.BoolClass=s.UnknownClass=s.EmptyClass=s.ConstructType=s.PrimitiveType=s.Type=s.Visitor=void 0;s.Service=s.Func=s.Rec=void 0;var Qn=Rt("@dfinity/principal"),h=Ce(),z=tt(),c=nt(),ot=ir(),Ve="DIDL",sr=400;function fe(e,t,r){return e.map((n,o)=>r(n,t[o]))}var it=class{constructor(){this._typs=[],this._idx=new Map}has(t){return this._idx.has(t.name)}add(t,r){let n=this._typs.length;this._idx.set(t.name,n),this._typs.push(r)}merge(t,r){let n=this._idx.get(t.name),o=this._idx.get(r);if(n===void 0)throw new Error("Missing type index for "+t);if(o===void 0)throw new Error("Missing type index for "+r);this._typs[n]=this._typs[o],this._typs.splice(o,1),this._idx.delete(r)}encode(){let t=(0,c.lebEncode)(this._typs.length),r=(0,h.concat)(...this._typs);return(0,h.concat)(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return(0,c.slebEncode)(this._idx.get(t)||0)}},st=class{visitType(t,r){throw new Error("Not implemented")}visitPrimitive(t,r){return this.visitType(t,r)}visitEmpty(t,r){return this.visitPrimitive(t,r)}visitBool(t,r){return this.visitPrimitive(t,r)}visitNull(t,r){return this.visitPrimitive(t,r)}visitReserved(t,r){return this.visitPrimitive(t,r)}visitText(t,r){return this.visitPrimitive(t,r)}visitNumber(t,r){return this.visitPrimitive(t,r)}visitInt(t,r){return this.visitNumber(t,r)}visitNat(t,r){return this.visitNumber(t,r)}visitFloat(t,r){return this.visitPrimitive(t,r)}visitFixedInt(t,r){return this.visitNumber(t,r)}visitFixedNat(t,r){return this.visitNumber(t,r)}visitPrincipal(t,r){return this.visitPrimitive(t,r)}visitConstruct(t,r){return this.visitType(t,r)}visitVec(t,r,n){return this.visitConstruct(t,n)}visitOpt(t,r,n){return this.visitConstruct(t,n)}visitRecord(t,r,n){return this.visitConstruct(t,n)}visitTuple(t,r,n){let o=r.map((i,a)=>[`_${a}_`,i]);return this.visitRecord(t,o,n)}visitVariant(t,r,n){return this.visitConstruct(t,n)}visitRec(t,r,n){return this.visitConstruct(r,n)}visitFunc(t,r){return this.visitConstruct(t,r)}visitService(t,r){return this.visitConstruct(t,r)}};s.Visitor=st;var se=class{display(){return this.name}valueToString(t){return S(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}};s.Type=se;var U=class extends se{checkType(t){if(this.name!==t.name)throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`);return t}_buildTypeTableImpl(t){}};s.PrimitiveType=U;var K=class extends se{checkType(t){if(t instanceof Q){let r=t.getType();if(typeof r>"u")throw new Error("type mismatch with uninitialized type");return r}throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`)}encodeType(t){return t.indexOf(this.name)}};s.ConstructType=K;var Ae=class extends U{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return(0,c.slebEncode)(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}};s.EmptyClass=Ae;var Oe=class extends se{checkType(t){throw new Error("Method not implemented for unknown.")}accept(t,r){throw t.visitType(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}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(t,r){let n=r.decodeValue(t,r);Object(n)!==n&&(n=Object(n));let o;return r instanceof Q?o=()=>r.getType():o=()=>r,Object.defineProperty(n,"type",{value:o,writable:!0,enumerable:!1,configurable:!0}),n}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}};s.UnknownClass=Oe;var Fe=class extends U{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return(0,c.slebEncode)(-2)}decodeValue(t,r){switch(this.checkType(r),(0,c.safeReadUint8)(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}};s.BoolClass=Fe;var Ee=class extends U{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return(0,c.slebEncode)(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}};s.NullClass=Ee;var ae=class extends U{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return(0,c.slebEncode)(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}};s.ReservedClass=ae;var Me=class extends U{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=(0,c.lebEncode)(r.byteLength);return(0,h.concat)(n,r)}encodeType(){return(0,c.slebEncode)(-15)}decodeValue(t,r){this.checkType(r);let n=(0,c.lebDecode)(t),o=(0,c.safeRead)(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}};s.TextClass=Me;var Be=class extends U{accept(t,r){return t.visitInt(this,r)}covariant(t){if(typeof t=="bigint"||Number.isInteger(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return(0,c.slebEncode)(t)}encodeType(){return(0,c.slebEncode)(-4)}decodeValue(t,r){return this.checkType(r),(0,c.slebDecode)(t)}get name(){return"int"}valueToString(t){return t.toString()}};s.IntClass=Be;var ke=class extends U{accept(t,r){return t.visitNat(this,r)}covariant(t){if(typeof t=="bigint"&&t>=BigInt(0)||Number.isInteger(t)&&t>=0)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return(0,c.lebEncode)(t)}encodeType(){return(0,c.slebEncode)(-3)}decodeValue(t,r){return this.checkType(r),(0,c.lebDecode)(t)}get name(){return"nat"}valueToString(t){return t.toString()}};s.NatClass=ke;var he=class extends U{constructor(t){if(super(),this._bits=t,t!==32&&t!==64)throw new Error("not a valid float type")}accept(t,r){return t.visitFloat(this,r)}covariant(t){if(typeof t=="number"||t instanceof Number)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){let r=new ArrayBuffer(this._bits/8),n=new DataView(r);return this._bits===32?n.setFloat32(0,t,!0):n.setFloat64(0,t,!0),r}encodeType(){let t=this._bits===32?-13:-14;return(0,c.slebEncode)(t)}decodeValue(t,r){this.checkType(r);let n=(0,c.safeRead)(t,this._bits/8),o=new DataView(n);return this._bits===32?o.getFloat32(0,!0):o.getFloat64(0,!0)}get name(){return"float"+this._bits}valueToString(t){return t.toString()}};s.FloatClass=he;var Y=class extends U{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=(0,ot.iexp2)(this._bits-1)*BigInt(-1),n=(0,ot.iexp2)(this._bits-1)-BigInt(1),o=!1;if(typeof t=="bigint")o=t>=r&&t<=n;else if(Number.isInteger(t)){let i=BigInt(t);o=i>=r&&i<=n}else o=!1;if(o)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return(0,c.writeIntLE)(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return(0,c.slebEncode)(-9-t)}decodeValue(t,r){this.checkType(r);let n=(0,c.readIntLE)(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}};s.FixedIntClass=Y;var H=class extends U{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=(0,ot.iexp2)(this._bits),n=!1;if(typeof t=="bigint"&&t>=BigInt(0)?n=t<r:Number.isInteger(t)&&t>=0?n=BigInt(t)<r:n=!1,n)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return(0,c.writeUIntLE)(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return(0,c.slebEncode)(-5-t)}decodeValue(t,r){this.checkType(r);let n=(0,c.readUIntLE)(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}};s.FixedNatClass=H;var Ue=class e extends K{constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof H&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof H?this._type._bits:this._type instanceof Y?this._type._bits:0;if(ArrayBuffer.isView(t)&&r==t.BYTES_PER_ELEMENT*8||Array.isArray(t)&&t.every((n,o)=>{try{return this._type.covariant(n)}catch(i){throw new Error(`Invalid ${this.display()} argument:
|
|
4
4
|
|
|
5
5
|
index ${o} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){let r=(0,c.lebEncode)(t.length);if(this._blobOptimization)return(0,h.concat)(r,new Uint8Array(t));if(ArrayBuffer.isView(t))return(0,h.concat)(r,new Uint8Array(t.buffer));let n=new h.PipeArrayBuffer(new ArrayBuffer(r.byteLength+t.length),0);n.write(r);for(let o of t){let i=this._type.encodeValue(o);n.write(new Uint8Array(i))}return n.buffer}_buildTypeTableImpl(t){this._type.buildTypeTable(t);let r=(0,c.slebEncode)(-19),n=this._type.encodeType(t);t.add(this,(0,h.concat)(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a vector type");let o=Number((0,c.lebDecode)(t));if(this._type instanceof H){if(this._type._bits==8)return new Uint8Array(t.read(o));if(this._type._bits==16)return new Uint16Array(t.read(o*2));if(this._type._bits==32)return new Uint32Array(t.read(o*4));if(this._type._bits==64)return new BigUint64Array(t.read(o*8))}if(this._type instanceof Y){if(this._type._bits==8)return new Int8Array(t.read(o));if(this._type._bits==16)return new Int16Array(t.read(o*2));if(this._type._bits==32)return new Int32Array(t.read(o*4));if(this._type._bits==64)return new BigInt64Array(t.read(o*8))}let i=[];for(let a=0;a<o;a++)i.push(this._type.decodeValue(t,n._type));return i}get name(){return`vec ${this._type.name}`}display(){return`vec ${this._type.display()}`}valueToString(t){return"vec {"+t.map(n=>this._type.valueToString(n)).join("; ")+"}"}};s.VecClass=Ue;var ce=class e extends K{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: ${S(t)}
|
|
6
6
|
|
|
7
7
|
-> ${r.message}`)}throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){return t.length===0?new Uint8Array([0]):(0,h.concat)(new Uint8Array([1]),this._type.encodeValue(t[0]))}_buildTypeTableImpl(t){this._type.buildTypeTable(t);let r=(0,c.slebEncode)(-18),n=this._type.encodeType(t);t.add(this,(0,h.concat)(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not an option type");switch((0,c.safeReadUint8)(t)){case 0:return[];case 1:return[this._type.decodeValue(t,n._type)];default:throw new Error("Not an option value")}}get name(){return`opt ${this._type.name}`}display(){return`opt ${this._type.display()}`}valueToString(t){return t.length===0?"null":`opt ${this._type.valueToString(t[0])}`}};s.OptClass=ce;var ye=class e extends K{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>(0,z.idlLabelToId)(r[0])-(0,z.idlLabelToId)(n[0]))}accept(t,r){return t.visitRecord(this,this._fields,r)}tryAsTuple(){let t=[];for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(n!==`_${r}_`)return null;t.push(o)}return t}covariant(t){if(typeof t=="object"&&this._fields.every(([r,n])=>{if(!t.hasOwnProperty(r))throw new Error(`Record is missing key "${r}".`);try{return n.covariant(t[r])}catch(o){throw new Error(`Invalid ${this.display()} argument:
|
|
8
8
|
|
|
9
|
-
field ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){let r=this._fields.map(([o])=>t[o]),n=fe(this._fields,r,([,o],i)=>o.encodeValue(i));return(0,h.concat)(...n)}_buildTypeTableImpl(t){this._fields.forEach(([i,a])=>a.buildTypeTable(t));let r=(0,c.slebEncode)(-20),n=(0,c.lebEncode)(this._fields.length),o=this._fields.map(([i,a])=>(0,h.concat)((0,c.lebEncode)((0,z.idlLabelToId)(i)),a.encodeType(t)));t.add(this,(0,h.concat)(r,n,(0,h.concat)(...o)))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a record type");let o={},i=0,a=0;for(;a<n._fields.length;){let[l,p]=n._fields[a];if(i>=this._fields.length){p.decodeValue(t,p),a++;continue}let[d,b]=this._fields[i],x=(0,z.idlLabelToId)(this._fields[i][0]),
|
|
9
|
+
field ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){let r=this._fields.map(([o])=>t[o]),n=fe(this._fields,r,([,o],i)=>o.encodeValue(i));return(0,h.concat)(...n)}_buildTypeTableImpl(t){this._fields.forEach(([i,a])=>a.buildTypeTable(t));let r=(0,c.slebEncode)(-20),n=(0,c.lebEncode)(this._fields.length),o=this._fields.map(([i,a])=>(0,h.concat)((0,c.lebEncode)((0,z.idlLabelToId)(i)),a.encodeType(t)));t.add(this,(0,h.concat)(r,n,(0,h.concat)(...o)))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a record type");let o={},i=0,a=0;for(;a<n._fields.length;){let[l,p]=n._fields[a];if(i>=this._fields.length){p.decodeValue(t,p),a++;continue}let[d,b]=this._fields[i],x=(0,z.idlLabelToId)(this._fields[i][0]),_=(0,z.idlLabelToId)(l);if(x===_)o[d]=b.decodeValue(t,p),i++,a++;else if(_>x)if(b instanceof ce||b instanceof ae)o[d]=[],i++;else throw new Error("Cannot find required field "+d);else p.decodeValue(t,p),a++}for(let[l,p]of this._fields.slice(i))if(p instanceof ce||p instanceof ae)o[l]=[];else throw new Error("Cannot find required field "+l);return o}get name(){return`record {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`record {${this._fields.map(([r,n])=>r+":"+n.display()).join("; ")}}`}valueToString(t){let r=this._fields.map(([o])=>t[o]);return`record {${fe(this._fields,r,([o,i],a)=>o+"="+i.valueToString(a)).join("; ")}}`}};s.RecordClass=ye;var $e=class e extends ye{constructor(t){let r={};t.forEach((n,o)=>r["_"+o+"_"]=n),super(r),this._components=t}accept(t,r){return t.visitTuple(this,this._components,r)}covariant(t){if(Array.isArray(t)&&t.length>=this._fields.length&&this._components.every((r,n)=>{try{return r.covariant(t[n])}catch(o){throw new Error(`Invalid ${this.display()} argument:
|
|
10
10
|
|
|
11
11
|
index ${n} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){let r=fe(this._components,t,(n,o)=>n.encodeValue(o));return(0,h.concat)(...r)}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("not a tuple type");if(n._components.length<this._components.length)throw new Error("tuple mismatch");let o=[];for(let[i,a]of n._components.entries())i>=this._components.length?a.decodeValue(t,a):o.push(this._components[i].decodeValue(t,a));return o}display(){return`record {${this._components.map(r=>r.display()).join("; ")}}`}valueToString(t){return`record {${fe(this._components,t,(n,o)=>n.valueToString(o)).join("; ")}}`}};s.TupleClass=$e;var qe=class e extends K{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>(0,z.idlLabelToId)(r[0])-(0,z.idlLabelToId)(n[0]))}accept(t,r){return t.visitVariant(this,this._fields,r)}covariant(t){if(typeof t=="object"&&Object.entries(t).length===1&&this._fields.every(([r,n])=>{try{return!t.hasOwnProperty(r)||n.covariant(t[r])}catch(o){throw new Error(`Invalid ${this.display()} argument:
|
|
12
12
|
|
|
13
|
-
variant ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(t.hasOwnProperty(n)){let i=(0,c.lebEncode)(r),a=o.encodeValue(t[n]);return(0,h.concat)(i,a)}}throw Error("Variant has no data: "+t)}_buildTypeTableImpl(t){this._fields.forEach(([,i])=>{i.buildTypeTable(t)});let r=(0,c.slebEncode)(-21),n=(0,c.lebEncode)(this._fields.length),o=this._fields.map(([i,a])=>(0,h.concat)((0,c.lebEncode)((0,z.idlLabelToId)(i)),a.encodeType(t)));t.add(this,(0,h.concat)(r,n,...o))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a variant type");let o=Number((0,c.lebDecode)(t));if(o>=n._fields.length)throw Error("Invalid variant index: "+o);let[i,a]=n._fields[o];for(let[l,p]of this._fields)if((0,z.idlLabelToId)(i)===(0,z.idlLabelToId)(l)){let d=p.decodeValue(t,a);return{[l]:d}}throw new Error("Cannot find field hash "+i)}get name(){return`variant {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`variant {${this._fields.map(([r,n])=>r+(n.name==="null"?"":`:${n.display()}`)).join("; ")}}`}valueToString(t){for(let[r,n]of this._fields)if(t.hasOwnProperty(r)){let o=n.valueToString(t[r]);return o==="null"?`variant {${r}}`:`variant {${r}=${o}}`}throw new Error("Variant has no data: "+t)}};s.VariantClass=qe;var Q=class e extends K{constructor(){super(...arguments),this._id=e._counter++,this._type=void 0}accept(t,r){if(!this._type)throw Error("Recursive type uninitialized.");return t.visitRec(this,this._type,r)}fill(t){this._type=t}getType(){return this._type}covariant(t){if(this._type&&this._type.covariant(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.encodeValue(t)}_buildTypeTableImpl(t){if(!this._type)throw Error("Recursive type uninitialized.");t.add(this,new Uint8Array([])),this._type.buildTypeTable(t),t.merge(this,this._type.name)}decodeValue(t,r){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.decodeValue(t,r)}get name(){return`rec_${this._id}`}display(){if(!this._type)throw Error("Recursive type uninitialized.");return`\u03BC${this.name}.${this._type.name}`}valueToString(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.valueToString(t)}};s.RecClass=Q;Q._counter=0;function at(e){if((0,c.safeReadUint8)(e)!==1)throw new Error("Cannot decode principal");let r=Number((0,c.lebDecode)(e));return
|
|
13
|
+
variant ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(t.hasOwnProperty(n)){let i=(0,c.lebEncode)(r),a=o.encodeValue(t[n]);return(0,h.concat)(i,a)}}throw Error("Variant has no data: "+t)}_buildTypeTableImpl(t){this._fields.forEach(([,i])=>{i.buildTypeTable(t)});let r=(0,c.slebEncode)(-21),n=(0,c.lebEncode)(this._fields.length),o=this._fields.map(([i,a])=>(0,h.concat)((0,c.lebEncode)((0,z.idlLabelToId)(i)),a.encodeType(t)));t.add(this,(0,h.concat)(r,n,...o))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a variant type");let o=Number((0,c.lebDecode)(t));if(o>=n._fields.length)throw Error("Invalid variant index: "+o);let[i,a]=n._fields[o];for(let[l,p]of this._fields)if((0,z.idlLabelToId)(i)===(0,z.idlLabelToId)(l)){let d=p.decodeValue(t,a);return{[l]:d}}throw new Error("Cannot find field hash "+i)}get name(){return`variant {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`variant {${this._fields.map(([r,n])=>r+(n.name==="null"?"":`:${n.display()}`)).join("; ")}}`}valueToString(t){for(let[r,n]of this._fields)if(t.hasOwnProperty(r)){let o=n.valueToString(t[r]);return o==="null"?`variant {${r}}`:`variant {${r}=${o}}`}throw new Error("Variant has no data: "+t)}};s.VariantClass=qe;var Q=class e extends K{constructor(){super(...arguments),this._id=e._counter++,this._type=void 0}accept(t,r){if(!this._type)throw Error("Recursive type uninitialized.");return t.visitRec(this,this._type,r)}fill(t){this._type=t}getType(){return this._type}covariant(t){if(this._type&&this._type.covariant(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.encodeValue(t)}_buildTypeTableImpl(t){if(!this._type)throw Error("Recursive type uninitialized.");t.add(this,new Uint8Array([])),this._type.buildTypeTable(t),t.merge(this,this._type.name)}decodeValue(t,r){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.decodeValue(t,r)}get name(){return`rec_${this._id}`}display(){if(!this._type)throw Error("Recursive type uninitialized.");return`\u03BC${this.name}.${this._type.name}`}valueToString(t){if(!this._type)throw Error("Recursive type uninitialized.");return this._type.valueToString(t)}};s.RecClass=Q;Q._counter=0;function at(e){if((0,c.safeReadUint8)(e)!==1)throw new Error("Cannot decode principal");let r=Number((0,c.lebDecode)(e));return Qn.Principal.fromUint8Array(new Uint8Array((0,c.safeRead)(e,r)))}var je=class extends U{accept(t,r){return t.visitPrincipal(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=(0,c.lebEncode)(r.byteLength);return(0,h.concat)(new Uint8Array([1]),n,r)}encodeType(){return(0,c.slebEncode)(-24)}decodeValue(t,r){return this.checkType(r),at(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}};s.PrincipalClass=je;var _e=class extends K{constructor(t,r,n=[]){super(),this.argTypes=t,this.retTypes=r,this.annotations=n}static argsToString(t,r){if(t.length!==r.length)throw new Error("arity mismatch");return"("+t.map((n,o)=>n.valueToString(r[o])).join(", ")+")"}accept(t,r){return t.visitFunc(this,r)}covariant(t){if(Array.isArray(t)&&t.length===2&&t[0]&&t[0]._isPrincipal&&typeof t[1]=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue([t,r]){let n=t.toUint8Array(),o=(0,c.lebEncode)(n.byteLength),i=(0,h.concat)(new Uint8Array([1]),o,n),a=new TextEncoder().encode(r),l=(0,c.lebEncode)(a.byteLength);return(0,h.concat)(new Uint8Array([1]),i,l,a)}_buildTypeTableImpl(t){this.argTypes.forEach(d=>d.buildTypeTable(t)),this.retTypes.forEach(d=>d.buildTypeTable(t));let r=(0,c.slebEncode)(-22),n=(0,c.lebEncode)(this.argTypes.length),o=(0,h.concat)(...this.argTypes.map(d=>d.encodeType(t))),i=(0,c.lebEncode)(this.retTypes.length),a=(0,h.concat)(...this.retTypes.map(d=>d.encodeType(t))),l=(0,c.lebEncode)(this.annotations.length),p=(0,h.concat)(...this.annotations.map(d=>this.encodeAnnotation(d)));t.add(this,(0,h.concat)(r,n,o,i,a,l,p))}decodeValue(t){if((0,c.safeReadUint8)(t)!==1)throw new Error("Cannot decode function reference");let n=at(t),o=Number((0,c.lebDecode)(t)),i=(0,c.safeRead)(t,o),l=new TextDecoder("utf8",{fatal:!0}).decode(i);return[n,l]}get name(){let t=this.argTypes.map(o=>o.name).join(", "),r=this.retTypes.map(o=>o.name).join(", "),n=" "+this.annotations.join(" ");return`(${t}) -> (${r})${n}`}valueToString([t,r]){return`func "${t.toText()}".${r}`}display(){let t=this.argTypes.map(o=>o.display()).join(", "),r=this.retTypes.map(o=>o.display()).join(", "),n=" "+this.annotations.join(" ");return`(${t}) \u2192 (${r})${n}`}encodeAnnotation(t){if(t==="query")return new Uint8Array([1]);if(t==="oneway")return new Uint8Array([2]);if(t==="composite_query")return new Uint8Array([3]);throw new Error("Illegal function annotation")}};s.FuncClass=_e;var ze=class extends K{constructor(t){super(),this._fields=Object.entries(t).sort((r,n)=>r[0]<n[0]?-1:r[0]>n[0]?1:0)}accept(t,r){return t.visitService(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${S(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=(0,c.lebEncode)(r.length);return(0,h.concat)(new Uint8Array([1]),n,r)}_buildTypeTableImpl(t){this._fields.forEach(([i,a])=>a.buildTypeTable(t));let r=(0,c.slebEncode)(-23),n=(0,c.lebEncode)(this._fields.length),o=this._fields.map(([i,a])=>{let l=new TextEncoder().encode(i),p=(0,c.lebEncode)(l.length);return(0,h.concat)(p,l,a.encodeType(t))});t.add(this,(0,h.concat)(r,n,...o))}decodeValue(t){return at(t)}get name(){return`service {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}valueToString(t){return`service "${t.toText()}"`}};s.ServiceClass=ze;function S(e){let t=JSON.stringify(e,(r,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>sr?t.substring(0,sr-3)+"...":t}function In(e,t){if(t.length<e.length)throw Error("Wrong number of message arguments");let r=new it;e.forEach(p=>p.buildTypeTable(r));let n=new TextEncoder().encode(Ve),o=r.encode(),i=(0,c.lebEncode)(t.length),a=(0,h.concat)(...e.map(p=>p.encodeType(r))),l=(0,h.concat)(...fe(e,t,(p,d)=>{try{p.covariant(d)}catch(b){throw new Error(b.message+`
|
|
14
14
|
|
|
15
|
-
`)}return p.encodeValue(d)}));return(0,h.concat)(n,o,i,a,l)}s.encode=Qn;function In(e,t){let r=new h.PipeArrayBuffer(t);if(t.byteLength<Ve.length)throw new Error("Message length smaller than magic number");let n=(0,c.safeRead)(r,Ve.length),o=new TextDecoder().decode(n);if(o!==Ve)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(u){let m=[],_=Number((0,c.lebDecode)(u));for(let g=0;g<_;g++){let P=Number((0,c.slebDecode)(u));switch(P){case-18:case-19:{let T=Number((0,c.slebDecode)(u));m.push([P,T]);break}case-20:case-21:{let T=[],C=Number((0,c.lebDecode)(u)),R;for(;C--;){let V=Number((0,c.lebDecode)(u));if(V>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof R=="number"&&R>=V)throw new Error("field id collision or not sorted");R=V;let A=Number((0,c.slebDecode)(u));T.push([V,A])}m.push([P,T]);break}case-22:{let T=[],C=Number((0,c.lebDecode)(u));for(;C--;)T.push(Number((0,c.slebDecode)(u)));let R=[],V=Number((0,c.lebDecode)(u));for(;V--;)R.push(Number((0,c.slebDecode)(u)));let A=[],B=Number((0,c.lebDecode)(u));for(;B--;)switch(Number((0,c.lebDecode)(u))){case 1:{A.push("query");break}case 2:{A.push("oneway");break}case 3:{A.push("composite_query");break}default:throw new Error("unknown annotation")}m.push([P,[T,R,A]]);break}case-23:{let T=Number((0,c.lebDecode)(u)),C=[];for(;T--;){let R=Number((0,c.lebDecode)(u)),V=new TextDecoder().decode((0,c.safeRead)(u,R)),A=(0,c.slebDecode)(u);C.push([V,A])}m.push([P,C]);break}default:throw new Error("Illegal op_code: "+P)}}let N=[],w=Number((0,c.lebDecode)(u));for(let g=0;g<w;g++)N.push(Number((0,c.slebDecode)(u)));return[m,N]}let[a,l]=i(r);if(l.length<e.length)throw new Error("Wrong number of return values");let p=a.map(u=>dr());function d(u){if(u<-24)throw new Error("future value not supported");if(u<0)switch(u){case-1:return s.Null;case-2:return s.Bool;case-3:return s.Nat;case-4:return s.Int;case-5:return s.Nat8;case-6:return s.Nat16;case-7:return s.Nat32;case-8:return s.Nat64;case-9:return s.Int8;case-10:return s.Int16;case-11:return s.Int32;case-12:return s.Int64;case-13:return s.Float32;case-14:return s.Float64;case-15:return s.Text;case-16:return s.Reserved;case-17:return s.Empty;case-24:return s.Principal;default:throw new Error("Illegal op_code: "+u)}if(u>=a.length)throw new Error("type index out of range");return p[u]}function b(u){switch(u[0]){case-19:{let m=d(u[1]);return ar(m)}case-18:{let m=d(u[1]);return cr(m)}case-20:{let m={};for(let[w,g]of u[1]){let P=`_${w}_`;m[P]=d(g)}let _=lr(m),N=_.tryAsTuple();return Array.isArray(N)?sr(...N):_}case-21:{let m={};for(let[_,N]of u[1]){let w=`_${_}_`;m[w]=d(N)}return ur(m)}case-22:{let[m,_,N]=u[1];return pr(m.map(w=>d(w)),_.map(w=>d(w)),N)}case-23:{let m={},_=u[1];for(let[N,w]of _){let g=d(w);if(g instanceof Q&&(g=g.getType()),!(g instanceof _e))throw new Error("Illegal service definition: services can only contain functions");m[N]=g}return mr(m)}default:throw new Error("Illegal op_code: "+u[0])}}a.forEach((u,m)=>{if(u[0]===-22){let _=b(u);p[m].fill(_)}}),a.forEach((u,m)=>{if(u[0]!==-22){let _=b(u);p[m].fill(_)}});let x=l.map(u=>d(u)),y=e.map((u,m)=>u.decodeValue(r,x[m]));for(let u=e.length;u<x.length;u++)x[u].decodeValue(r,x[u]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return y}s.decode=In;s.Empty=new Ae;s.Reserved=new ae;s.Unknown=new Oe;s.Bool=new Fe;s.Null=new Ee;s.Text=new Me;s.Int=new Be;s.Nat=new ke;s.Float32=new he(32);s.Float64=new he(64);s.Int8=new Y(8);s.Int16=new Y(16);s.Int32=new Y(32);s.Int64=new Y(64);s.Nat8=new H(8);s.Nat16=new H(16);s.Nat32=new H(32);s.Nat64=new H(64);s.Principal=new je;function sr(...e){return new $e(e)}s.Tuple=sr;function ar(e){return new Ue(e)}s.Vec=ar;function cr(e){return new ce(e)}s.Opt=cr;function lr(e){return new ye(e)}s.Record=lr;function ur(e){return new qe(e)}s.Variant=ur;function dr(){return new Q}s.Rec=dr;function pr(e,t,r=[]){return new _e(e,t,r)}s.Func=pr;function mr(e){return new ze(e)}s.Service=mr});var ht=Z(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.VecForm=E.OptionForm=E.VariantForm=E.TupleForm=E.RecordForm=E.InputForm=E.InputBox=void 0;var lt=class{constructor(t,r){this.idl=t,this.ui=r,this.label=null,this.value=void 0;let n=document.createElement("span");n.className="status",this.status=n,r.input&&(r.input.addEventListener("blur",()=>{r.input.value!==""&&this.parse()}),r.input.addEventListener("input",()=>{n.style.display="none",r.input.classList.remove("reject")}))}isRejected(){return this.value===void 0}parse(t={}){if(this.ui.form){let r=this.ui.form.parse(t);return this.value=r,r}if(this.ui.input){let r=this.ui.input;try{let n=this.ui.parse(this.idl,t,r.value);if(!this.idl.covariant(n))throw new Error(`${r.value} is not of type ${this.idl.display()}`);return this.status.style.display="none",this.value=n,n}catch(n){r.classList.add("reject"),this.status.style.display="block",this.status.innerHTML="InputError: "+n.message,this.value=void 0;return}}return null}render(t){let r=document.createElement("span");if(this.label){let n=document.createElement("label");n.innerText=this.label,r.appendChild(n)}this.ui.input&&(r.appendChild(this.ui.input),r.appendChild(this.status)),this.ui.form&&this.ui.form.render(r),t.appendChild(r)}};E.InputBox=lt;var I=class{constructor(t){this.ui=t,this.form=[]}renderForm(t){this.ui.container?(this.form.forEach(r=>r.render(this.ui.container)),t.appendChild(this.ui.container)):this.form.forEach(r=>r.render(t))}render(t){if(this.ui.open&&this.ui.event){t.appendChild(this.ui.open);let r=this;r.ui.open.addEventListener(r.ui.event,()=>{if(r.ui.container)r.ui.container.innerHTML="";else{let n=r.ui.open.nextElementSibling;n&&n.parentNode.removeChild(n)}r.generateForm(),r.renderForm(t)})}else this.generateForm(),this.renderForm(t)}};E.InputForm=I;var ut=class extends I{constructor(t,r){super(r),this.fields=t,this.ui=r}generateForm(){this.form=this.fields.map(([t,r])=>{let n=this.ui.render(r);return this.ui.labelMap&&this.ui.labelMap.hasOwnProperty(t)?n.label=this.ui.labelMap[t]+" ":n.label=t+" ",n})}parse(t){let r={};if(this.fields.forEach(([n,o],i)=>{let a=this.form[i].parse(t);r[n]=a}),!this.form.some(n=>n.isRejected()))return r}};E.RecordForm=ut;var dt=class extends I{constructor(t,r){super(r),this.components=t,this.ui=r}generateForm(){this.form=this.components.map(t=>this.ui.render(t))}parse(t){let r=[];if(this.components.forEach((n,o)=>{let i=this.form[o].parse(t);r.push(i)}),!this.form.some(n=>n.isRejected()))return r}};E.TupleForm=dt;var pt=class extends I{constructor(t,r){super(r),this.fields=t,this.ui=r}generateForm(){let t=this.ui.open.selectedIndex,[r,n]=this.fields[t],o=this.ui.render(n);this.form=[o]}parse(t){let r=this.ui.open,n=r.options[r.selectedIndex].value,o=this.form[0].parse(t);if(o===void 0)return;let i={};return i[n]=o,i}};E.VariantForm=pt;var mt=class extends I{constructor(t,r){super(r),this.ty=t,this.ui=r}generateForm(){if(this.ui.open.checked){let t=this.ui.render(this.ty);this.form=[t]}else this.form=[]}parse(t){if(this.form.length===0)return[];{let r=this.form[0].parse(t);return r===void 0?void 0:[r]}}};E.OptionForm=mt;var ft=class extends I{constructor(t,r){super(r),this.ty=t,this.ui=r}generateForm(){let t=+this.ui.open.value;this.form=[];for(let r=0;r<t;r++){let n=this.ui.render(this.ty);this.form.push(n)}}parse(t){let r=this.form.map(n=>n.parse(t));if(!this.form.some(n=>n.isRejected()))return r}};E.VecForm=ft});var hr=Z(f=>{"use strict";var Dn=f&&f.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),Ln=f&&f.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),fr=f&&f.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Dn(t,e,r);return Ln(t,e),t};Object.defineProperty(f,"__esModule",{value:!0});f.renderValue=f.renderInput=f.Render=f.vecForm=f.optForm=f.variantForm=f.tupleForm=f.recordForm=f.inputBox=void 0;var Ke=fr(ct()),yt=Rt("@dfinity/principal"),le=fr(ht()),eo={parse:ao},ge={render:bt},to=(e,t)=>new le.InputBox(e,Object.assign(Object.assign({},eo),t));f.inputBox=to;var ro=(e,t)=>new le.RecordForm(e,Object.assign(Object.assign({},ge),t));f.recordForm=ro;var no=(e,t)=>new le.TupleForm(e,Object.assign(Object.assign({},ge),t));f.tupleForm=no;var oo=(e,t)=>new le.VariantForm(e,Object.assign(Object.assign({},ge),t));f.variantForm=oo;var io=(e,t)=>new le.OptionForm(e,Object.assign(Object.assign({},ge),t));f.optForm=io;var so=(e,t)=>new le.VecForm(e,Object.assign(Object.assign({},ge),t));f.vecForm=so;var He=class extends Ke.Visitor{visitType(t,r){let n=document.createElement("input");return n.classList.add("argument"),n.placeholder=t.display(),(0,f.inputBox)(t,{input:n})}visitNull(t,r){return(0,f.inputBox)(t,{})}visitRecord(t,r,n){let o={};if(r.length>1){let a=document.createElement("div");a.classList.add("popup-form"),o={container:a}}let i=(0,f.recordForm)(r,o);return(0,f.inputBox)(t,{form:i})}visitTuple(t,r,n){let o={};if(r.length>1){let a=document.createElement("div");a.classList.add("popup-form"),o={container:a}}let i=(0,f.tupleForm)(r,o);return(0,f.inputBox)(t,{form:i})}visitVariant(t,r,n){let o=document.createElement("select");for(let[l,p]of r){let d=new Option(l);o.add(d)}o.selectedIndex=-1,o.classList.add("open");let i={open:o,event:"change"},a=(0,f.variantForm)(r,i);return(0,f.inputBox)(t,{form:a})}visitOpt(t,r,n){let o=document.createElement("input");o.type="checkbox",o.classList.add("open");let i=(0,f.optForm)(r,{open:o,event:"change"});return(0,f.inputBox)(t,{form:i})}visitVec(t,r,n){let o=document.createElement("input");o.type="number",o.min="0",o.max="100",o.style.width="8rem",o.placeholder="len",o.classList.add("open");let i=document.createElement("div");i.classList.add("popup-form");let a=(0,f.vecForm)(r,{open:o,event:"change",container:i});return(0,f.inputBox)(t,{form:a})}visitRec(t,r,n){return bt(r)}};f.Render=He;var _t=class extends Ke.Visitor{visitNull(t,r){return null}visitBool(t,r){if(r==="true")return!0;if(r==="false")return!1;throw new Error(`Cannot parse ${r} as boolean`)}visitText(t,r){return r}visitFloat(t,r){return parseFloat(r)}visitFixedInt(t,r){return t._bits<=32?parseInt(r,10):BigInt(r)}visitFixedNat(t,r){return t._bits<=32?parseInt(r,10):BigInt(r)}visitNumber(t,r){return BigInt(r)}visitPrincipal(t,r){return yt.Principal.fromText(r)}visitService(t,r){return yt.Principal.fromText(r)}visitFunc(t,r){let n=r.split(".",2);return[yt.Principal.fromText(n[0]),n[1]]}},gt=class extends Ke.Visitor{visitNull(t,r){return null}visitBool(t,r){return Math.random()<.5}visitText(t,r){return Math.random().toString(36).substring(6)}visitFloat(t,r){return Math.random()}visitInt(t,r){return BigInt(this.generateNumber(!0))}visitNat(t,r){return BigInt(this.generateNumber(!1))}visitFixedInt(t,r){let n=this.generateNumber(!0);return t._bits<=32?n:BigInt(r)}visitFixedNat(t,r){let n=this.generateNumber(!1);return t._bits<=32?n:BigInt(r)}generateNumber(t){let r=Math.floor(Math.random()*100);return t&&Math.random()<.5?-r:r}};function ao(e,t,r){return t.random&&r===""?e.accept(new gt,r):e.accept(new _t,r)}function bt(e){return e.accept(new He,null)}f.renderInput=bt;function ne(e,t,r){return e.accept(new Tt,{input:t,value:r})}f.renderValue=ne;var Tt=class extends Ke.Visitor{visitType(t,r){r.input.ui.input.value=t.valueToString(r.value)}visitNull(t,r){}visitText(t,r){r.input.ui.input.value=r.value}visitRec(t,r,n){ne(r,n.input,n.value)}visitOpt(t,r,n){if(n.value.length!==0){let o=n.input.ui.form,i=o.ui.open;i.checked=!0,i.dispatchEvent(new Event(o.ui.event)),ne(r,o.form[0],n.value[0])}}visitRecord(t,r,n){let o=n.input.ui.form;r.forEach(([i,a],l)=>{ne(a,o.form[l],n.value[i])})}visitTuple(t,r,n){let o=n.input.ui.form;r.forEach((i,a)=>{ne(i,o.form[a],n.value[a])})}visitVariant(t,r,n){let o=n.input.ui.form,i=Object.entries(n.value)[0];r.forEach(([a,l],p)=>{if(a===i[0]){let d=o.ui.open;d.selectedIndex=p,d.dispatchEvent(new Event(o.ui.event)),ne(l,o.form[0],i[1])}})}visitVec(t,r,n){let o=n.input.ui.form,i=n.value.length,a=o.ui.open;a.value=i,a.dispatchEvent(new Event(o.ui.event)),n.value.forEach((l,p)=>{ne(r,o.form[p],l)})}}});var _r=Z(yr=>{"use strict";Object.defineProperty(yr,"__esModule",{value:!0})});var xt=Z(F=>{"use strict";var gr=F&&F.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),co=F&&F.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ue=F&&F.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&gr(t,e,r)},lo=F&&F.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&gr(t,e,r);return co(t,e),t};Object.defineProperty(F,"__esModule",{value:!0});F.IDL=void 0;ue(hr(),F);ue(ht(),F);F.IDL=lo(ct());ue(tt(),F);ue(nt(),F);ue(Ce(),F);ue(_r(),F)});var xe=class extends Error{constructor(){super("The Wasm code for the upgrade is identical to the code currently installed. No upgrade is necessary.")}};import{isNullish as Nn}from"@junobuild/utils";var At=({IDL:e})=>{let t=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),r=e.Record({subnet_id:e.Opt(e.Principal),name:e.Opt(e.Text)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),o=e.Record({cycles:e.Nat,destination_id:e.Principal}),i=e.Record({e8s:e.Nat64}),a=e.Record({timestamp_nanos:e.Nat64}),l=e.Record({to:e.Vec(e.Nat8),fee:i,memo:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:i}),p=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:i}),TxDuplicate:e.Record({duplicate_of:e.Nat64}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:i})}),d=e.Variant({Ok:e.Nat64,Err:p}),b=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),x=e.Record({to:b,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),y=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:e.Nat}),Duplicate:e.Record({duplicate_of:e.Nat}),BadFee:e.Record({expected_fee:e.Nat}),CreatedInFuture:e.Record({ledger_time:e.Nat64}),TooOld:e.Null,InsufficientFunds:e.Record({balance:e.Nat})}),u=e.Variant({Ok:e.Nat,Err:y}),m=e.Variant({Write:e.Null,Admin:e.Null}),_=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:m,expires_at:e.Opt(e.Nat64)}),N=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),w=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),g=e.Record({status:N,memory_size:e.Nat,cycles:e.Nat,settings:w,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),P=e.Record({id:e.Principal,status:g,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),T=e.Variant({Ok:P,Err:e.Text}),C=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:m,expires_at:e.Opt(e.Nat64)}),R=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),V=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,R)),satellites:e.Vec(e.Tuple(e.Principal,R)),cycles_threshold:e.Opt(e.Nat64)}),A=e.Record({orbiters:e.Opt(e.Vec(T)),satellites:e.Opt(e.Vec(T)),mission_control:T});return e.Service({add_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),add_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),create_orbiter:e.Func([e.Opt(e.Text)],[t],[]),create_orbiter_with_config:e.Func([r],[t],[]),create_satellite:e.Func([e.Text],[n],[]),create_satellite_with_config:e.Func([r],[n],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([o],[],[]),get_user:e.Func([],[e.Principal],["query"]),icp_transfer:e.Func([l],[d],[]),icrc_transfer:e.Func([e.Principal,x],[u],[]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,_))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,T))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,T)))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,t))],["query"]),list_satellite_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,T)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),remove_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),remove_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),C],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[t],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[t],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),C],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[n],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[n],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),C],[],[]),status:e.Func([V],[A],[]),top_up:e.Func([e.Principal,i],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),version:e.Func([],[e.Text],["query"])})};var Ot=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:r,expires_at:e.Opt(e.Nat64)}),o=e.Record({version:e.Opt(e.Nat64)}),i=e.Record({cycles:e.Nat,destination_id:e.Principal}),a=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),l=e.Record({key:e.Text,collected_at:e.Nat64}),p=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),d=e.Record({title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:p,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),b=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),x=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),y=e.Record({browsers:b,devices:x}),u=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),m=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(u,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),_=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),N=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),w=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(N),delta:e.Float64}),g=e.Variant({WebVitalsMetric:w}),P=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),T=e.Record({updated_at:e.Nat64,session_id:e.Text,data:g,href:e.Text,metric_name:P,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),C=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),R=e.Record({overall:C,pages:e.Vec(e.Tuple(e.Text,C))}),V=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),A=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),B=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),M=e.Record({updated_at:e.Nat64,features:e.Opt(B),created_at:e.Nat64,version:e.Opt(e.Nat64)}),$=e.Record({stable:e.Nat64,heap:e.Nat64}),W=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),q=e.Record({controller:W,controllers:e.Vec(e.Principal)}),G=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,satellite_id:e.Principal,device:p,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),J=e.Variant({Ok:d,Err:e.Text}),X=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(l,e.Text))}),j=e.Record({session_id:e.Text,data:g,href:e.Text,metric_name:P,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),Qe=e.Variant({Ok:T,Err:e.Text}),Ie=e.Record({features:e.Opt(B),version:e.Opt(e.Nat64)}),be=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),De=e.Variant({Ok:V,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,n))],[]),del_satellite_config:e.Func([e.Principal,o],[],[]),deposit_cycles:e.Func([i],[],[]),get_page_views:e.Func([a],[e.Vec(e.Tuple(l,d))],["query"]),get_page_views_analytics_clients:e.Func([a],[y],["query"]),get_page_views_analytics_metrics:e.Func([a],[m],["query"]),get_page_views_analytics_top_10:e.Func([a],[_],["query"]),get_performance_metrics:e.Func([a],[e.Vec(e.Tuple(l,T))],["query"]),get_performance_metrics_analytics_web_vitals:e.Func([a],[R],["query"]),get_track_events:e.Func([a],[e.Vec(e.Tuple(l,V))],["query"]),get_track_events_analytics:e.Func([a],[A],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,M))],["query"]),memory_size:e.Func([],[$],["query"]),set_controllers:e.Func([q],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([l,G],[J],[]),set_page_views:e.Func([e.Vec(e.Tuple(l,G))],[X],[]),set_performance_metric:e.Func([l,j],[Qe],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(l,j))],[X],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,Ie))],[e.Vec(e.Tuple(e.Principal,M))],[]),set_track_event:e.Func([l,be],[De],[]),set_track_events:e.Func([e.Vec(e.Tuple(l,be))],[X],[]),version:e.Func([],[e.Text],["query"])})};var Ft=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),a=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),p=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),d=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),b=e.Variant({Callback:e.Record({token:d,callback:e.Func([],[],[])})}),x=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(b),status_code:e.Nat16}),y=e.Record({token:e.Opt(d),body:e.Vec(e.Nat8)}),u=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),m=e.Record({batch_id:e.Nat}),_=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),N=e.Record({field:_,desc:e.Bool}),w=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),g=e.Record({order:e.Opt(N),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(w)}),P=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),C=e.Record({key:P,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,T)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),R=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,C))}),V=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),A=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),B=e.Variant({Db:e.Null,Storage:e.Null}),M=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),$=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:M,created_at:e.Nat64,write:M}),W=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),q=e.Record({controller:W,controllers:e.Vec(e.Principal)}),G=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),J=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:M,write:M}),X=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),j=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,o],[],[]),get_config:e.Func([],[a],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(l)],["query"]),http_request:e.Func([p],[x],["query"]),http_request_streaming_callback:e.Func([d],[y],["query"]),init_asset_upload:e.Func([u],[m],[]),list_assets:e.Func([e.Opt(e.Text),g],[R],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,V))],["query"]),list_docs:e.Func([e.Text,g],[A],["query"]),list_rules:e.Func([B],[e.Vec(e.Tuple(e.Text,$))],["query"]),set_config:e.Func([a],[],[]),set_controllers:e.Func([q],[e.Vec(e.Tuple(e.Principal,n))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,G],[l],[]),set_rule:e.Func([B,e.Text,J],[],[]),upload_asset_chunk:e.Func([X],[j],[]),version:e.Func([],[e.Text],["query"])})};var Et=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),a=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),p=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),d=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),b=e.Variant({Callback:e.Record({token:d,callback:e.Func([],[],[])})}),x=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(b),status_code:e.Nat16}),y=e.Record({token:e.Opt(d),body:e.Vec(e.Nat8)}),u=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),m=e.Record({batch_id:e.Nat}),_=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),N=e.Record({field:_,desc:e.Bool}),w=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),g=e.Record({order:e.Opt(N),matcher:e.Opt(e.Text),paginate:e.Opt(w)}),P=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),C=e.Record({key:P,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,T)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),R=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,C))}),V=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),A=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),B=e.Variant({Db:e.Null,Storage:e.Null}),M=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),$=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:M,created_at:e.Nat64,write:M}),W=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),q=e.Record({controller:W,controllers:e.Vec(e.Principal)}),G=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),J=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:M,write:M}),X=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),j=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,o],[],[]),get_config:e.Func([],[a],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(l)],["query"]),http_request:e.Func([p],[x],["query"]),http_request_streaming_callback:e.Func([d],[y],["query"]),init_asset_upload:e.Func([u],[m],[]),list_assets:e.Func([e.Opt(e.Text),g],[R],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,V))],["query"]),list_docs:e.Func([e.Text,g],[A],["query"]),list_rules:e.Func([B],[e.Vec(e.Tuple(e.Text,$))],["query"]),set_config:e.Func([a],[],[]),set_controllers:e.Func([q],[e.Vec(e.Tuple(e.Principal,n))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,G],[l],[]),set_rule:e.Func([B,e.Text,J],[],[]),upload_asset_chunk:e.Func([X],[j],[]),version:e.Func([],[e.Text],["query"])})};var Mt=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),n=e.Record({field:r,desc:e.Bool}),o=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),i=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(o),description:e.Opt(e.Text),created_at:e.Opt(o)}),a=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),l=e.Record({order:e.Opt(n),owner:e.Opt(e.Principal),matcher:e.Opt(i),paginate:e.Opt(a)}),p=e.Record({controllers:e.Vec(e.Principal)}),d=e.Variant({Write:e.Null,Admin:e.Null}),b=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:d,expires_at:e.Opt(e.Nat64)}),x=e.Record({version:e.Opt(e.Nat64)}),y=e.Variant({Db:e.Null,Storage:e.Null}),u=e.Record({version:e.Opt(e.Nat64)}),m=e.Record({cycles:e.Nat,destination_id:e.Principal}),_=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),N=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),w=e.Record({key:_,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,N)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),g=e.Record({derivation_origin:e.Opt(e.Text)}),P=e.Record({internet_identity:e.Opt(g)}),T=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),C=e.Record({max_memory_size:e.Opt(T)}),R=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),V=e.Variant({Deny:e.Null,Allow:e.Null}),A=e.Record({status_code:e.Nat16,location:e.Text}),B=e.Record({iframe:e.Opt(R),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),max_memory_size:e.Opt(T),raw_access:e.Opt(V),redirects:e.Opt(e.Vec(e.Tuple(e.Text,A)))}),M=e.Record({db:e.Opt(C),authentication:e.Opt(P),storage:B}),$=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),W=e.Variant({Heap:e.Null,Stable:e.Null}),q=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),G=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),J=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(W),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:q,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(G),write:q}),X=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),j=e.Record({memory:W,token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),Qe=e.Variant({Callback:e.Record({token:j,callback:e.Func([],[],["query"])})}),Ie=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Qe),status_code:e.Nat16}),be=e.Record({token:e.Opt(j),body:e.Vec(e.Nat8)}),De=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,description:e.Opt(e.Text),encoding_type:e.Opt(e.Text),full_path:e.Text}),on=e.Record({batch_id:e.Nat}),sn=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,w)),items_length:e.Nat64}),an=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),cn=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,$)),items_length:e.Nat64}),ln=e.Record({stable:e.Nat64,heap:e.Nat64}),un=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:d,expires_at:e.Opt(e.Nat64)}),dn=e.Record({controller:un,controllers:e.Vec(e.Principal)}),Ct=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),pn=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(W),max_size:e.Opt(e.Nat),read:q,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(G),write:q}),mn=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),fn=e.Record({chunk_id:e.Nat});return e.Service({build_version:e.Func([],[e.Text],["query"]),commit_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,l],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,l],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([p],[e.Vec(e.Tuple(e.Principal,b))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,x],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,l],[],[]),del_filtered_docs:e.Func([e.Text,l],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,x))],[],[]),del_rule:e.Func([y,e.Text,u],[],[]),deposit_cycles:e.Func([m],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(w)],["query"]),get_auth_config:e.Func([],[e.Opt(P)],["query"]),get_config:e.Func([],[M],[]),get_db_config:e.Func([],[e.Opt(C)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt($)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(w)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt($)))],["query"]),get_rule:e.Func([y,e.Text],[e.Opt(J)],["query"]),get_storage_config:e.Func([],[B],["query"]),http_request:e.Func([X],[Ie],["query"]),http_request_streaming_callback:e.Func([j],[be],["query"]),init_asset_upload:e.Func([De],[on],[]),list_assets:e.Func([e.Text,l],[sn],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,b))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,an))],["query"]),list_docs:e.Func([e.Text,l],[cn],["query"]),list_rules:e.Func([y],[e.Vec(e.Tuple(e.Text,J))],["query"]),memory_size:e.Func([],[ln],["query"]),set_auth_config:e.Func([P],[],[]),set_controllers:e.Func([dn],[e.Vec(e.Tuple(e.Principal,b))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([C],[],[]),set_doc:e.Func([e.Text,e.Text,Ct],[$],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ct))],[e.Vec(e.Tuple(e.Text,$))],[]),set_rule:e.Func([y,e.Text,pn],[J],[]),set_storage_config:e.Func([B],[],[]),upload_asset_chunk:e.Func([mn],[fn],[]),version:e.Func([],[e.Text],["query"])})};import{Actor as xn,HttpAgent as wn}from"@dfinity/agent";import{nonNullish as Bt}from"@junobuild/utils";var kt=async({canisterId:e,idlFactory:t,config:r,...n})=>{let o=await ee(n);return xn.createActor(t,{agent:o,canisterId:e,...r??{}})},ee=async({agent:e,...t})=>e??await vn(t),vn=async({identity:e,fetch:t,container:r})=>{let n=Bt(r)&&r!==!1,o=n?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io";return await wn.create({identity:e,host:o,retryTimes:10,...Bt(t)&&{fetch:t},shouldFetchRootKey:n})};var Ut=({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:Et}),O=({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:Mt}),$t=({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:Ft}),oe=({missionControlId:e,...t})=>pe({canisterId:e,...t,idlFactory:At}),we=({orbiterId:e,...t})=>pe({canisterId:e,...t,idlFactory:Ot}),pe=({canisterId:e,idlFactory:t,...r})=>{if(Nn(e))throw new Error("No canister ID provided.");return kt({canisterId:e,idlFactory:t,...r})};var qt=async({missionControl:e})=>(await oe(e)).version(),jt=async({missionControl:e})=>(await oe(e)).get_user(),zt=async({missionControl:e})=>(await oe(e)).list_mission_control_controllers(),Ht=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await oe(e)).set_satellites_controllers(t,r,n),Kt=async({missionControl:e,controllerIds:t,controller:r})=>(await oe(e)).set_mission_control_controllers(t,r);import{Principal as Pn}from"@dfinity/principal";import{nonNullish as Cn,toNullable as Sn}from"@junobuild/utils";var Le=({controllerId:e,profile:t})=>({controllerIds:[Pn.fromText(e)],controller:Rn(t)}),Rn=e=>({metadata:Cn(e)&&e!==""?[["profile",e]]:[],expires_at:Sn(void 0),scope:{Admin:null}});var Go=({controllerId:e,profile:t,...r})=>Ht({...r,...Le({controllerId:e,profile:t})}),Jo=({controllerId:e,profile:t,...r})=>Kt({...r,...Le({controllerId:e,profile:t})}),Xo=e=>zt(e);import{Principal as uo}from"@dfinity/principal";var me={reinstall:null},te={upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]};import{fromNullable as En,isNullish as Mn}from"@junobuild/utils";import{CanisterStatus as Vn}from"@dfinity/agent";import{ICManagementCanister as ve}from"@dfinity/ic-management";import{Principal as An}from"@dfinity/principal";import{assertNonNullish as On}from"@junobuild/utils";var Wt=async({canisterId:e,actor:t})=>{let r=await ee(t),{stopCanister:n}=ve.create({agent:r});await n(e)},Gt=async({canisterId:e,actor:t})=>{let r=await ee(t),{startCanister:n}=ve.create({agent:r});await n(e)},Jt=async({actor:e,code:t})=>{let r=await ee(e),{installCode:n}=ve.create({agent:r});return n(t)};var Xt=async({actor:e,canisterId:t})=>{let r=await ee(e),{canisterStatus:n}=ve.create({agent:r});return n(t)},Zt=async({canisterId:e,path:t,...r})=>{On(e,"A canister ID must be provided to request its status.");let n=await ee(r);return(await Vn.request({canisterId:An.from(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]})).get(t)};var Yt=e=>(e instanceof Uint8Array||(e=Uint8Array.from(e)),e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),""));var Qt=e=>crypto.subtle.digest("SHA-256",e),It=e=>Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join(""),oi=async e=>{let t=await Qt(await e.arrayBuffer());return It(t)},Dt=async e=>{let t=await Qt(e);return It(t)};var re=async({wasmModule:e,canisterId:t,actor:r,...n})=>{await Bn({wasmModule:e,canisterId:t,actor:r,...n}),await Wt({canisterId:t,actor:r});let o=()=>new Blob([e]).size>2e6?"chunked":"simple";await kn({wasmModule:e,canisterId:t,actor:r,...n}),await Gt({canisterId:t,actor:r})},Bn=async({actor:e,canisterId:t,wasmModule:r})=>{let{module_hash:n}=await Xt({actor:e,canisterId:t}),o=En(n);if(Mn(o))return;let i=await Dt(r),a=Yt(o);if(i===a)throw new xe},kn=async({actor:e,...t})=>{await Jt({actor:e,code:t})};var D=Vt(xt(),1),Tr=e=>D.IDL.encode([D.IDL.Record({user:D.IDL.Principal})],[{user:e}]),We=e=>D.IDL.encode([D.IDL.Record({controllers:D.IDL.Vec(D.IDL.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var Ri=async({missionControl:e,wasmModule:t,preClearChunks:r})=>{let n=await jt({missionControl:e}),{missionControlId:o,...i}=e;if(!o)throw new Error("No mission control principal defined.");let a=Tr(n);await re({actor:i,canisterId:uo.fromText(o),arg:new Uint8Array(a),wasmModule:t,mode:te,preClearChunks:r})};var Oi=e=>qt(e);var br=async({orbiter:e})=>(await we(e)).version(),Ge=async({orbiter:e})=>(await we(e)).list_controllers(),xr=async({orbiter:e})=>{let{memory_size:t}=await we(e);return t()};var ki=e=>Ge(e);var qi=e=>xr(e);import{Principal as po}from"@dfinity/principal";var Ji=async({orbiter:e,missionControlId:t,wasmModule:r,reset:n=!1,preClearChunks:o})=>{let{orbiterId:i,...a}=e;if(!i)throw new Error("No orbiter principal defined.");let l=await Ge({orbiter:e}),p=We(l);await re({actor:a,canisterId:po.fromText(i),missionControlId:t,arg:new Uint8Array(p),wasmModule:r,mode:n?me:te,preClearChunks:o})};var Yi=e=>br(e);import{major as wr,minor as vr,patch as Nr}from"semver";var Di=({currentVersion:e,selectedVersion:t})=>{let r=wr(e),n=wr(t),o=vr(e),i=vr(t),a=Nr(e),l=Nr(t);return r<n-1||o<i-1||a<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{toNullable as mo}from"@junobuild/utils";var Pr=async({config:e,satellite:t})=>{let{set_storage_config:r}=await O(t);return r(e)},Cr=async({config:e,satellite:t})=>{let{set_db_config:r}=await O(t);return r(e)},Sr=async({config:e,satellite:t})=>{let{set_auth_config:r}=await O(t);return r(e)};var Rr=async({satellite:e})=>{let{get_auth_config:t}=await O(e);return t()},Vr=async({satellite:e,type:t})=>(await O(e)).list_rules(t),Ar=async({type:e,collection:t,rule:r,satellite:n})=>{let{set_rule:o}=await O(n);return o(e,t,r)},Or=async({satellite:e})=>{let{version:t}=await O(e);return t()},Fr=async({satellite:e})=>{let{build_version:t}=await O(e);return t()},Er=async({satellite:e})=>(await Ut(e)).list_controllers(),Je=async({satellite:e})=>(await $t(e)).list_controllers(),Xe=async({satellite:e})=>(await O(e)).list_controllers(),Mr=async({satellite:e})=>{let{list_custom_domains:t}=await O(e);return t()},Br=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await O(e);await n(t,mo(r))},kr=async({satellite:e})=>{let{memory_size:t}=await O(e);return t()},Ur=async({collection:e,satellite:t})=>{let{count_collection_docs:r}=await O(t);return r(e)},$r=async({collection:e,satellite:t})=>{let{count_collection_assets:r}=await O(t);return r(e)},qr=async({collection:e,satellite:t})=>{let{del_docs:r}=await O(t);return r(e)},jr=async({collection:e,satellite:t})=>{let{del_assets:r}=await O(t);return r(e)},zr=async({args:e,satellite:t})=>{let{set_controllers:r}=await O(t);return r(e)};var os=e=>$r(e),is=e=>jr(e);import{fromNullable as Ze,isNullish as Kr,nonNullish as Hr}from"@junobuild/utils";import{nonNullish as fo,toNullable as wt}from"@junobuild/utils";var vt=e=>wt(fo(e)?{heap:wt(e.heap),stable:wt(e.stable)}:void 0);var ps=async({config:{headers:e,rewrites:t,redirects:r,iframe:n,rawAccess:o,maxMemorySize:i},satellite:a})=>{let l=(e??[]).map(({source:y,headers:u})=>[y,u]),p=(t??[]).map(({source:y,destination:u})=>[y,u]),d=(r??[]).map(({source:y,location:u,code:m})=>[y,{status_code:m,location:u}]);return await Pr({satellite:a,config:{headers:l,rewrites:p,redirects:[d],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[o===!0?{Allow:null}:{Deny:null}],max_memory_size:vt(i)}})},ms=async({config:{maxMemorySize:e},...t})=>{await Cr({config:{max_memory_size:vt(e)},...t})},fs=async({config:{internetIdentity:e},...t})=>{await Sr({config:{internet_identity:Kr(e?.derivationOrigin)?[]:[{derivation_origin:[e.derivationOrigin]}]},...t})},hs=async({satellite:e})=>{let t=Ze(await Rr({satellite:e}));if(Kr(t))return;let r=Ze(t.internet_identity??[]);return{...Hr(r)&&{internetIdentity:{...Hr(Ze(r.derivation_origin))&&{derivationOrigin:Ze(r.derivation_origin)}}}}};var gs=({deprecatedNoScope:e,...t})=>(e===!0?Je:Xe)(t),Ts=e=>zr(e);var ws=e=>Ur(e),vs=e=>qr(e);import{fromNullable as Wr,nonNullish as ho}from"@junobuild/utils";var Ss=async({satellite:e})=>(await Mr({satellite:e})).map(([r,n])=>{let o=Wr(n.version);return{domain:r,bn_id:Wr(n.bn_id),created_at:n.created_at,updated_at:n.updated_at,...ho(o)&&{version:o}}}),Rs=({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>Br({satellite:e,domainName:r,boundaryNodesId:n})));var Os=e=>kr(e);import{fromNullable as de,nonNullish as L,toNullable as Ye}from"@junobuild/utils";var Gr={Db:null},Jr={Storage:null},Xr={Public:null},Zr={Private:null},Yr={Managed:null},Qr={Controllers:null},Nt={Heap:null},Ir={Stable:null},Dr=600000000n;var Pt=e=>e==="storage"?Jr:Gr,tn=({read:e,write:t,memory:r,maxSize:n,maxCapacity:o,version:i,mutablePermissions:a,maxTokens:l})=>({read:en(e),write:en(t),memory:L(r)?[yo(r)]:[],version:Ye(i),max_size:Ye(L(n)&&n>0?BigInt(n):void 0),max_capacity:Ye(L(o)&&o>0?o:void 0),mutable_permissions:Ye(a),rate_config:L(l)?[{max_tokens:BigInt(l),time_per_token_ns:Dr}]:[]}),rn=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:a,max_capacity:l,memory:p,mutable_permissions:d,version:b,rate_config:x}=t,y=a?.[0]??0n>0n?Number(de(a)):void 0,u=l?.[0]??!1?de(l):void 0,m=de(b),_=x?.[0]?.max_tokens??0n>0n?de(x)?.max_tokens:void 0;return{collection:e,read:Lr(r),write:Lr(n),memory:_o(de(p)??Nt),updatedAt:o,createdAt:i,...L(m)&&{version:m},...L(y)&&{maxSize:y},...L(u)&&{maxCapacity:u},mutablePermissions:de(d)??!0,...L(_)&&{maxTokens:Number(_)}}},Lr=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",en=e=>{switch(e){case"public":return Xr;case"private":return Zr;case"managed":return Yr;default:return Qr}},yo=e=>{switch(e.toLowerCase()){case"heap":return Nt;default:return Ir}},_o=e=>"Heap"in e?"heap":"stable";var qs=async({type:e,satellite:t})=>(await Vr({satellite:t,type:Pt(e)})).map(n=>rn(n)),js=async({rule:{collection:e,...t},type:r,satellite:n})=>{await Ar({type:Pt(r),rule:tn(t),satellite:n,collection:e})};var Te=Vt(xt(),1);import{Principal as nn}from"@dfinity/principal";import{isNullish as go}from"@junobuild/utils";var Zs=async({satellite:e,missionControlId:t,wasmModule:r,deprecated:n,deprecatedNoScope:o,reset:i=!1,preClearChunks:a})=>{let{satelliteId:l,...p}=e;if(go(l))throw new Error("No satellite principal defined.");if(n){let y=await Er({satellite:e}),u=Te.IDL.encode([Te.IDL.Record({controllers:Te.IDL.Vec(Te.IDL.Principal)})],[{controllers:y}]);await re({actor:p,canisterId:nn.fromText(l),missionControlId:t,arg:new Uint8Array(u),wasmModule:r,mode:i?me:te,preClearChunks:a});return}let b=await(o?Je:Xe)({satellite:e}),x=We(b);await re({actor:p,canisterId:nn.fromText(l),missionControlId:t,arg:new Uint8Array(x),wasmModule:r,mode:i?me:te,preClearChunks:a})};import{nonNullish as To}from"@junobuild/utils";var Ls=e=>Or(e),ea=e=>Fr(e),ta=async({satellite:{satelliteId:e,...t}})=>{let r=await Zt({...t,canisterId:e,path:"juno:build"});return To(r)&&["stock","extended"].includes(r)?r:void 0};export{xe as UpgradeCodeUnchangedError,oi as blobSha256,Di as checkUpgradeVersion,os as countAssets,ws as countDocs,is as deleteAssets,vs as deleteDocs,hs as getAuthConfig,Ss as listCustomDomains,Xo as listMissionControlControllers,ki as listOrbiterControllers,qs as listRules,gs as listSatelliteControllers,Oi as missionControlVersion,qi as orbiterMemorySize,Yi as orbiterVersion,ta as satelliteBuildType,ea as satelliteBuildVersion,Os as satelliteMemorySize,Ls as satelliteVersion,fs as setAuthConfig,Rs as setCustomDomains,ms as setDatastoreConfig,Jo as setMissionControlController,js as setRule,Ts as setSatelliteControllers,Go as setSatellitesController,ps as setStorageConfig,Dt as uint8ArraySha256,Ri as upgradeMissionControl,Ji as upgradeOrbiter,Zs as upgradeSatellite};
|
|
15
|
+
`)}return p.encodeValue(d)}));return(0,h.concat)(n,o,i,a,l)}s.encode=In;function Dn(e,t){let r=new h.PipeArrayBuffer(t);if(t.byteLength<Ve.length)throw new Error("Message length smaller than magic number");let n=(0,c.safeRead)(r,Ve.length),o=new TextDecoder().decode(n);if(o!==Ve)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(u){let m=[],y=Number((0,c.lebDecode)(u));for(let g=0;g<y;g++){let N=Number((0,c.slebDecode)(u));switch(N){case-18:case-19:{let T=Number((0,c.slebDecode)(u));m.push([N,T]);break}case-20:case-21:{let T=[],C=Number((0,c.lebDecode)(u)),R;for(;C--;){let V=Number((0,c.lebDecode)(u));if(V>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof R=="number"&&R>=V)throw new Error("field id collision or not sorted");R=V;let A=Number((0,c.slebDecode)(u));T.push([V,A])}m.push([N,T]);break}case-22:{let T=[],C=Number((0,c.lebDecode)(u));for(;C--;)T.push(Number((0,c.slebDecode)(u)));let R=[],V=Number((0,c.lebDecode)(u));for(;V--;)R.push(Number((0,c.slebDecode)(u)));let A=[],B=Number((0,c.lebDecode)(u));for(;B--;)switch(Number((0,c.lebDecode)(u))){case 1:{A.push("query");break}case 2:{A.push("oneway");break}case 3:{A.push("composite_query");break}default:throw new Error("unknown annotation")}m.push([N,[T,R,A]]);break}case-23:{let T=Number((0,c.lebDecode)(u)),C=[];for(;T--;){let R=Number((0,c.lebDecode)(u)),V=new TextDecoder().decode((0,c.safeRead)(u,R)),A=(0,c.slebDecode)(u);C.push([V,A])}m.push([N,C]);break}default:throw new Error("Illegal op_code: "+N)}}let P=[],w=Number((0,c.lebDecode)(u));for(let g=0;g<w;g++)P.push(Number((0,c.slebDecode)(u)));return[m,P]}let[a,l]=i(r);if(l.length<e.length)throw new Error("Wrong number of return values");let p=a.map(u=>pr());function d(u){if(u<-24)throw new Error("future value not supported");if(u<0)switch(u){case-1:return s.Null;case-2:return s.Bool;case-3:return s.Nat;case-4:return s.Int;case-5:return s.Nat8;case-6:return s.Nat16;case-7:return s.Nat32;case-8:return s.Nat64;case-9:return s.Int8;case-10:return s.Int16;case-11:return s.Int32;case-12:return s.Int64;case-13:return s.Float32;case-14:return s.Float64;case-15:return s.Text;case-16:return s.Reserved;case-17:return s.Empty;case-24:return s.Principal;default:throw new Error("Illegal op_code: "+u)}if(u>=a.length)throw new Error("type index out of range");return p[u]}function b(u){switch(u[0]){case-19:{let m=d(u[1]);return cr(m)}case-18:{let m=d(u[1]);return lr(m)}case-20:{let m={};for(let[w,g]of u[1]){let N=`_${w}_`;m[N]=d(g)}let y=ur(m),P=y.tryAsTuple();return Array.isArray(P)?ar(...P):y}case-21:{let m={};for(let[y,P]of u[1]){let w=`_${y}_`;m[w]=d(P)}return dr(m)}case-22:{let[m,y,P]=u[1];return mr(m.map(w=>d(w)),y.map(w=>d(w)),P)}case-23:{let m={},y=u[1];for(let[P,w]of y){let g=d(w);if(g instanceof Q&&(g=g.getType()),!(g instanceof _e))throw new Error("Illegal service definition: services can only contain functions");m[P]=g}return fr(m)}default:throw new Error("Illegal op_code: "+u[0])}}a.forEach((u,m)=>{if(u[0]===-22){let y=b(u);p[m].fill(y)}}),a.forEach((u,m)=>{if(u[0]!==-22){let y=b(u);p[m].fill(y)}});let x=l.map(u=>d(u)),_=e.map((u,m)=>u.decodeValue(r,x[m]));for(let u=e.length;u<x.length;u++)x[u].decodeValue(r,x[u]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return _}s.decode=Dn;s.Empty=new Ae;s.Reserved=new ae;s.Unknown=new Oe;s.Bool=new Fe;s.Null=new Ee;s.Text=new Me;s.Int=new Be;s.Nat=new ke;s.Float32=new he(32);s.Float64=new he(64);s.Int8=new Y(8);s.Int16=new Y(16);s.Int32=new Y(32);s.Int64=new Y(64);s.Nat8=new H(8);s.Nat16=new H(16);s.Nat32=new H(32);s.Nat64=new H(64);s.Principal=new je;function ar(...e){return new $e(e)}s.Tuple=ar;function cr(e){return new Ue(e)}s.Vec=cr;function lr(e){return new ce(e)}s.Opt=lr;function ur(e){return new ye(e)}s.Record=ur;function dr(e){return new qe(e)}s.Variant=dr;function pr(){return new Q}s.Rec=pr;function mr(e,t,r=[]){return new _e(e,t,r)}s.Func=mr;function fr(e){return new ze(e)}s.Service=fr});var ht=Z(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.VecForm=E.OptionForm=E.VariantForm=E.TupleForm=E.RecordForm=E.InputForm=E.InputBox=void 0;var lt=class{constructor(t,r){this.idl=t,this.ui=r,this.label=null,this.value=void 0;let n=document.createElement("span");n.className="status",this.status=n,r.input&&(r.input.addEventListener("blur",()=>{r.input.value!==""&&this.parse()}),r.input.addEventListener("input",()=>{n.style.display="none",r.input.classList.remove("reject")}))}isRejected(){return this.value===void 0}parse(t={}){if(this.ui.form){let r=this.ui.form.parse(t);return this.value=r,r}if(this.ui.input){let r=this.ui.input;try{let n=this.ui.parse(this.idl,t,r.value);if(!this.idl.covariant(n))throw new Error(`${r.value} is not of type ${this.idl.display()}`);return this.status.style.display="none",this.value=n,n}catch(n){r.classList.add("reject"),this.status.style.display="block",this.status.innerHTML="InputError: "+n.message,this.value=void 0;return}}return null}render(t){let r=document.createElement("span");if(this.label){let n=document.createElement("label");n.innerText=this.label,r.appendChild(n)}this.ui.input&&(r.appendChild(this.ui.input),r.appendChild(this.status)),this.ui.form&&this.ui.form.render(r),t.appendChild(r)}};E.InputBox=lt;var I=class{constructor(t){this.ui=t,this.form=[]}renderForm(t){this.ui.container?(this.form.forEach(r=>r.render(this.ui.container)),t.appendChild(this.ui.container)):this.form.forEach(r=>r.render(t))}render(t){if(this.ui.open&&this.ui.event){t.appendChild(this.ui.open);let r=this;r.ui.open.addEventListener(r.ui.event,()=>{if(r.ui.container)r.ui.container.innerHTML="";else{let n=r.ui.open.nextElementSibling;n&&n.parentNode.removeChild(n)}r.generateForm(),r.renderForm(t)})}else this.generateForm(),this.renderForm(t)}};E.InputForm=I;var ut=class extends I{constructor(t,r){super(r),this.fields=t,this.ui=r}generateForm(){this.form=this.fields.map(([t,r])=>{let n=this.ui.render(r);return this.ui.labelMap&&this.ui.labelMap.hasOwnProperty(t)?n.label=this.ui.labelMap[t]+" ":n.label=t+" ",n})}parse(t){let r={};if(this.fields.forEach(([n,o],i)=>{let a=this.form[i].parse(t);r[n]=a}),!this.form.some(n=>n.isRejected()))return r}};E.RecordForm=ut;var dt=class extends I{constructor(t,r){super(r),this.components=t,this.ui=r}generateForm(){this.form=this.components.map(t=>this.ui.render(t))}parse(t){let r=[];if(this.components.forEach((n,o)=>{let i=this.form[o].parse(t);r.push(i)}),!this.form.some(n=>n.isRejected()))return r}};E.TupleForm=dt;var pt=class extends I{constructor(t,r){super(r),this.fields=t,this.ui=r}generateForm(){let t=this.ui.open.selectedIndex,[r,n]=this.fields[t],o=this.ui.render(n);this.form=[o]}parse(t){let r=this.ui.open,n=r.options[r.selectedIndex].value,o=this.form[0].parse(t);if(o===void 0)return;let i={};return i[n]=o,i}};E.VariantForm=pt;var mt=class extends I{constructor(t,r){super(r),this.ty=t,this.ui=r}generateForm(){if(this.ui.open.checked){let t=this.ui.render(this.ty);this.form=[t]}else this.form=[]}parse(t){if(this.form.length===0)return[];{let r=this.form[0].parse(t);return r===void 0?void 0:[r]}}};E.OptionForm=mt;var ft=class extends I{constructor(t,r){super(r),this.ty=t,this.ui=r}generateForm(){let t=+this.ui.open.value;this.form=[];for(let r=0;r<t;r++){let n=this.ui.render(this.ty);this.form.push(n)}}parse(t){let r=this.form.map(n=>n.parse(t));if(!this.form.some(n=>n.isRejected()))return r}};E.VecForm=ft});var yr=Z(f=>{"use strict";var Ln=f&&f.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),eo=f&&f.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),hr=f&&f.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Ln(t,e,r);return eo(t,e),t};Object.defineProperty(f,"__esModule",{value:!0});f.renderValue=f.renderInput=f.Render=f.vecForm=f.optForm=f.variantForm=f.tupleForm=f.recordForm=f.inputBox=void 0;var Ke=hr(ct()),yt=Rt("@dfinity/principal"),le=hr(ht()),to={parse:co},ge={render:bt},ro=(e,t)=>new le.InputBox(e,Object.assign(Object.assign({},to),t));f.inputBox=ro;var no=(e,t)=>new le.RecordForm(e,Object.assign(Object.assign({},ge),t));f.recordForm=no;var oo=(e,t)=>new le.TupleForm(e,Object.assign(Object.assign({},ge),t));f.tupleForm=oo;var io=(e,t)=>new le.VariantForm(e,Object.assign(Object.assign({},ge),t));f.variantForm=io;var so=(e,t)=>new le.OptionForm(e,Object.assign(Object.assign({},ge),t));f.optForm=so;var ao=(e,t)=>new le.VecForm(e,Object.assign(Object.assign({},ge),t));f.vecForm=ao;var He=class extends Ke.Visitor{visitType(t,r){let n=document.createElement("input");return n.classList.add("argument"),n.placeholder=t.display(),(0,f.inputBox)(t,{input:n})}visitNull(t,r){return(0,f.inputBox)(t,{})}visitRecord(t,r,n){let o={};if(r.length>1){let a=document.createElement("div");a.classList.add("popup-form"),o={container:a}}let i=(0,f.recordForm)(r,o);return(0,f.inputBox)(t,{form:i})}visitTuple(t,r,n){let o={};if(r.length>1){let a=document.createElement("div");a.classList.add("popup-form"),o={container:a}}let i=(0,f.tupleForm)(r,o);return(0,f.inputBox)(t,{form:i})}visitVariant(t,r,n){let o=document.createElement("select");for(let[l,p]of r){let d=new Option(l);o.add(d)}o.selectedIndex=-1,o.classList.add("open");let i={open:o,event:"change"},a=(0,f.variantForm)(r,i);return(0,f.inputBox)(t,{form:a})}visitOpt(t,r,n){let o=document.createElement("input");o.type="checkbox",o.classList.add("open");let i=(0,f.optForm)(r,{open:o,event:"change"});return(0,f.inputBox)(t,{form:i})}visitVec(t,r,n){let o=document.createElement("input");o.type="number",o.min="0",o.max="100",o.style.width="8rem",o.placeholder="len",o.classList.add("open");let i=document.createElement("div");i.classList.add("popup-form");let a=(0,f.vecForm)(r,{open:o,event:"change",container:i});return(0,f.inputBox)(t,{form:a})}visitRec(t,r,n){return bt(r)}};f.Render=He;var _t=class extends Ke.Visitor{visitNull(t,r){return null}visitBool(t,r){if(r==="true")return!0;if(r==="false")return!1;throw new Error(`Cannot parse ${r} as boolean`)}visitText(t,r){return r}visitFloat(t,r){return parseFloat(r)}visitFixedInt(t,r){return t._bits<=32?parseInt(r,10):BigInt(r)}visitFixedNat(t,r){return t._bits<=32?parseInt(r,10):BigInt(r)}visitNumber(t,r){return BigInt(r)}visitPrincipal(t,r){return yt.Principal.fromText(r)}visitService(t,r){return yt.Principal.fromText(r)}visitFunc(t,r){let n=r.split(".",2);return[yt.Principal.fromText(n[0]),n[1]]}},gt=class extends Ke.Visitor{visitNull(t,r){return null}visitBool(t,r){return Math.random()<.5}visitText(t,r){return Math.random().toString(36).substring(6)}visitFloat(t,r){return Math.random()}visitInt(t,r){return BigInt(this.generateNumber(!0))}visitNat(t,r){return BigInt(this.generateNumber(!1))}visitFixedInt(t,r){let n=this.generateNumber(!0);return t._bits<=32?n:BigInt(r)}visitFixedNat(t,r){let n=this.generateNumber(!1);return t._bits<=32?n:BigInt(r)}generateNumber(t){let r=Math.floor(Math.random()*100);return t&&Math.random()<.5?-r:r}};function co(e,t,r){return t.random&&r===""?e.accept(new gt,r):e.accept(new _t,r)}function bt(e){return e.accept(new He,null)}f.renderInput=bt;function ne(e,t,r){return e.accept(new Tt,{input:t,value:r})}f.renderValue=ne;var Tt=class extends Ke.Visitor{visitType(t,r){r.input.ui.input.value=t.valueToString(r.value)}visitNull(t,r){}visitText(t,r){r.input.ui.input.value=r.value}visitRec(t,r,n){ne(r,n.input,n.value)}visitOpt(t,r,n){if(n.value.length!==0){let o=n.input.ui.form,i=o.ui.open;i.checked=!0,i.dispatchEvent(new Event(o.ui.event)),ne(r,o.form[0],n.value[0])}}visitRecord(t,r,n){let o=n.input.ui.form;r.forEach(([i,a],l)=>{ne(a,o.form[l],n.value[i])})}visitTuple(t,r,n){let o=n.input.ui.form;r.forEach((i,a)=>{ne(i,o.form[a],n.value[a])})}visitVariant(t,r,n){let o=n.input.ui.form,i=Object.entries(n.value)[0];r.forEach(([a,l],p)=>{if(a===i[0]){let d=o.ui.open;d.selectedIndex=p,d.dispatchEvent(new Event(o.ui.event)),ne(l,o.form[0],i[1])}})}visitVec(t,r,n){let o=n.input.ui.form,i=n.value.length,a=o.ui.open;a.value=i,a.dispatchEvent(new Event(o.ui.event)),n.value.forEach((l,p)=>{ne(r,o.form[p],l)})}}});var gr=Z(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0})});var xt=Z(F=>{"use strict";var Tr=F&&F.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);(!o||("get"in o?!t.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),lo=F&&F.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ue=F&&F.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&Tr(t,e,r)},uo=F&&F.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&Tr(t,e,r);return lo(t,e),t};Object.defineProperty(F,"__esModule",{value:!0});F.IDL=void 0;ue(yr(),F);ue(ht(),F);F.IDL=uo(ct());ue(tt(),F);ue(nt(),F);ue(Ce(),F);ue(gr(),F)});var xe=class extends Error{constructor(){super("The Wasm code for the upgrade is identical to the code currently installed. No upgrade is necessary.")}};import{isNullish as Nn}from"@junobuild/utils";var At=({IDL:e})=>{let t=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),r=e.Record({subnet_id:e.Opt(e.Principal),name:e.Opt(e.Text)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),o=e.Record({cycles:e.Nat,destination_id:e.Principal}),i=e.Record({e8s:e.Nat64}),a=e.Record({timestamp_nanos:e.Nat64}),l=e.Record({to:e.Vec(e.Nat8),fee:i,memo:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(a),amount:i}),p=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:i}),TxDuplicate:e.Record({duplicate_of:e.Nat64}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:i})}),d=e.Variant({Ok:e.Nat64,Err:p}),b=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),x=e.Record({to:b,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),_=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:e.Nat}),Duplicate:e.Record({duplicate_of:e.Nat}),BadFee:e.Record({expected_fee:e.Nat}),CreatedInFuture:e.Record({ledger_time:e.Nat64}),TooOld:e.Null,InsufficientFunds:e.Record({balance:e.Nat})}),u=e.Variant({Ok:e.Nat,Err:_}),m=e.Variant({Write:e.Null,Admin:e.Null}),y=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:m,expires_at:e.Opt(e.Nat64)}),P=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),w=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),g=e.Record({status:P,memory_size:e.Nat,cycles:e.Nat,settings:w,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),N=e.Record({id:e.Principal,status:g,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),T=e.Variant({Ok:N,Err:e.Text}),C=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:m,expires_at:e.Opt(e.Nat64)}),R=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),V=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,R)),satellites:e.Vec(e.Tuple(e.Principal,R)),cycles_threshold:e.Opt(e.Nat64)}),A=e.Record({orbiters:e.Opt(e.Vec(T)),satellites:e.Opt(e.Vec(T)),mission_control:T});return e.Service({add_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),add_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),create_orbiter:e.Func([e.Opt(e.Text)],[t],[]),create_orbiter_with_config:e.Func([r],[t],[]),create_satellite:e.Func([e.Text],[n],[]),create_satellite_with_config:e.Func([r],[n],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([o],[],[]),get_user:e.Func([],[e.Principal],["query"]),icp_transfer:e.Func([l],[d],[]),icrc_transfer:e.Func([e.Principal,x],[u],[]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,y))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,T))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,T)))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,t))],["query"]),list_satellite_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,T)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),remove_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),remove_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),C],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[t],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[t],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),C],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[n],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[n],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),C],[],[]),status:e.Func([V],[A],[]),top_up:e.Func([e.Principal,i],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),version:e.Func([],[e.Text],["query"])})};var Ot=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:r,expires_at:e.Opt(e.Nat64)}),o=e.Record({version:e.Opt(e.Nat64)}),i=e.Record({cycles:e.Nat,destination_id:e.Principal}),a=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),l=e.Record({key:e.Text,collected_at:e.Nat64}),p=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),d=e.Record({title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:p,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),b=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),x=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),_=e.Record({browsers:b,devices:x}),u=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),m=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(u,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),y=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),P=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),w=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(P),delta:e.Float64}),g=e.Variant({WebVitalsMetric:w}),N=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),T=e.Record({updated_at:e.Nat64,session_id:e.Text,data:g,href:e.Text,metric_name:N,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),C=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),R=e.Record({overall:C,pages:e.Vec(e.Tuple(e.Text,C))}),V=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),A=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),B=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),M=e.Record({updated_at:e.Nat64,features:e.Opt(B),created_at:e.Nat64,version:e.Opt(e.Nat64)}),$=e.Record({stable:e.Nat64,heap:e.Nat64}),W=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),q=e.Record({controller:W,controllers:e.Vec(e.Principal)}),G=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,satellite_id:e.Principal,device:p,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),J=e.Variant({Ok:d,Err:e.Text}),X=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(l,e.Text))}),j=e.Record({session_id:e.Text,data:g,href:e.Text,metric_name:N,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),Qe=e.Variant({Ok:T,Err:e.Text}),Ie=e.Record({features:e.Opt(B),version:e.Opt(e.Nat64)}),be=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),De=e.Variant({Ok:V,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,n))],[]),del_satellite_config:e.Func([e.Principal,o],[],[]),deposit_cycles:e.Func([i],[],[]),get_page_views:e.Func([a],[e.Vec(e.Tuple(l,d))],["query"]),get_page_views_analytics_clients:e.Func([a],[_],["query"]),get_page_views_analytics_metrics:e.Func([a],[m],["query"]),get_page_views_analytics_top_10:e.Func([a],[y],["query"]),get_performance_metrics:e.Func([a],[e.Vec(e.Tuple(l,T))],["query"]),get_performance_metrics_analytics_web_vitals:e.Func([a],[R],["query"]),get_track_events:e.Func([a],[e.Vec(e.Tuple(l,V))],["query"]),get_track_events_analytics:e.Func([a],[A],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,M))],["query"]),memory_size:e.Func([],[$],["query"]),set_controllers:e.Func([q],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([l,G],[J],[]),set_page_views:e.Func([e.Vec(e.Tuple(l,G))],[X],[]),set_performance_metric:e.Func([l,j],[Qe],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(l,j))],[X],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,Ie))],[e.Vec(e.Tuple(e.Principal,M))],[]),set_track_event:e.Func([l,be],[De],[]),set_track_events:e.Func([e.Vec(e.Tuple(l,be))],[X],[]),version:e.Func([],[e.Text],["query"])})};var Ft=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),a=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),p=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),d=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),b=e.Variant({Callback:e.Record({token:d,callback:e.Func([],[],[])})}),x=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(b),status_code:e.Nat16}),_=e.Record({token:e.Opt(d),body:e.Vec(e.Nat8)}),u=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),m=e.Record({batch_id:e.Nat}),y=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),P=e.Record({field:y,desc:e.Bool}),w=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),g=e.Record({order:e.Opt(P),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(w)}),N=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),C=e.Record({key:N,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,T)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),R=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,C))}),V=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),A=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),B=e.Variant({Db:e.Null,Storage:e.Null}),M=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),$=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:M,created_at:e.Nat64,write:M}),W=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),q=e.Record({controller:W,controllers:e.Vec(e.Principal)}),G=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),J=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:M,write:M}),X=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),j=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,o],[],[]),get_config:e.Func([],[a],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(l)],["query"]),http_request:e.Func([p],[x],["query"]),http_request_streaming_callback:e.Func([d],[_],["query"]),init_asset_upload:e.Func([u],[m],[]),list_assets:e.Func([e.Opt(e.Text),g],[R],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,V))],["query"]),list_docs:e.Func([e.Text,g],[A],["query"]),list_rules:e.Func([B],[e.Vec(e.Tuple(e.Text,$))],["query"]),set_config:e.Func([a],[],[]),set_controllers:e.Func([q],[e.Vec(e.Tuple(e.Principal,n))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,G],[l],[]),set_rule:e.Func([B,e.Text,J],[],[]),upload_asset_chunk:e.Func([X],[j],[]),version:e.Func([],[e.Text],["query"])})};var Et=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),a=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),p=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),d=e.Record({token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),b=e.Variant({Callback:e.Record({token:d,callback:e.Func([],[],[])})}),x=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(b),status_code:e.Nat16}),_=e.Record({token:e.Opt(d),body:e.Vec(e.Nat8)}),u=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),m=e.Record({batch_id:e.Nat}),y=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),P=e.Record({field:y,desc:e.Bool}),w=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),g=e.Record({order:e.Opt(P),matcher:e.Opt(e.Text),paginate:e.Opt(w)}),N=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),C=e.Record({key:N,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,T)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),R=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,C))}),V=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),A=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),B=e.Variant({Db:e.Null,Storage:e.Null}),M=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),$=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:M,created_at:e.Nat64,write:M}),W=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),q=e.Record({controller:W,controllers:e.Vec(e.Principal)}),G=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),J=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:M,write:M}),X=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),j=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,o],[],[]),get_config:e.Func([],[a],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(l)],["query"]),http_request:e.Func([p],[x],["query"]),http_request_streaming_callback:e.Func([d],[_],["query"]),init_asset_upload:e.Func([u],[m],[]),list_assets:e.Func([e.Opt(e.Text),g],[R],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,V))],["query"]),list_docs:e.Func([e.Text,g],[A],["query"]),list_rules:e.Func([B],[e.Vec(e.Tuple(e.Text,$))],["query"]),set_config:e.Func([a],[],[]),set_controllers:e.Func([q],[e.Vec(e.Tuple(e.Principal,n))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,G],[l],[]),set_rule:e.Func([B,e.Text,J],[],[]),upload_asset_chunk:e.Func([X],[j],[]),version:e.Func([],[e.Text],["query"])})};var Mt=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),n=e.Record({field:r,desc:e.Bool}),o=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),i=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(o),description:e.Opt(e.Text),created_at:e.Opt(o)}),a=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),l=e.Record({order:e.Opt(n),owner:e.Opt(e.Principal),matcher:e.Opt(i),paginate:e.Opt(a)}),p=e.Record({controllers:e.Vec(e.Principal)}),d=e.Variant({Write:e.Null,Admin:e.Null}),b=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:d,expires_at:e.Opt(e.Nat64)}),x=e.Record({version:e.Opt(e.Nat64)}),_=e.Variant({Db:e.Null,Storage:e.Null}),u=e.Record({version:e.Opt(e.Nat64)}),m=e.Record({cycles:e.Nat,destination_id:e.Principal}),y=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),P=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),w=e.Record({key:y,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,P)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),g=e.Record({derivation_origin:e.Opt(e.Text)}),N=e.Record({internet_identity:e.Opt(g)}),T=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),C=e.Record({max_memory_size:e.Opt(T)}),R=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),V=e.Variant({Deny:e.Null,Allow:e.Null}),A=e.Record({status_code:e.Nat16,location:e.Text}),B=e.Record({iframe:e.Opt(R),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),max_memory_size:e.Opt(T),raw_access:e.Opt(V),redirects:e.Opt(e.Vec(e.Tuple(e.Text,A)))}),M=e.Record({db:e.Opt(C),authentication:e.Opt(N),storage:B}),$=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),W=e.Variant({Heap:e.Null,Stable:e.Null}),q=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),G=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),J=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(W),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:q,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(G),write:q}),X=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),j=e.Record({memory:W,token:e.Opt(e.Text),sha256:e.Opt(e.Vec(e.Nat8)),headers:e.Vec(e.Tuple(e.Text,e.Text)),index:e.Nat64,encoding_type:e.Text,full_path:e.Text}),Qe=e.Variant({Callback:e.Record({token:j,callback:e.Func([],[],["query"])})}),Ie=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Qe),status_code:e.Nat16}),be=e.Record({token:e.Opt(j),body:e.Vec(e.Nat8)}),De=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,description:e.Opt(e.Text),encoding_type:e.Opt(e.Text),full_path:e.Text}),sn=e.Record({batch_id:e.Nat}),an=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,w)),items_length:e.Nat64}),cn=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),ln=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,$)),items_length:e.Nat64}),un=e.Record({stable:e.Nat64,heap:e.Nat64}),dn=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:d,expires_at:e.Opt(e.Nat64)}),pn=e.Record({controller:dn,controllers:e.Vec(e.Principal)}),Ct=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),mn=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(W),max_size:e.Opt(e.Nat),read:q,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(G),write:q}),fn=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),hn=e.Record({chunk_id:e.Nat});return e.Service({build_version:e.Func([],[e.Text],["query"]),commit_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,l],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,l],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([p],[e.Vec(e.Tuple(e.Principal,b))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,x],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,l],[],[]),del_filtered_docs:e.Func([e.Text,l],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,x))],[],[]),del_rule:e.Func([_,e.Text,u],[],[]),deposit_cycles:e.Func([m],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(w)],["query"]),get_auth_config:e.Func([],[e.Opt(N)],["query"]),get_config:e.Func([],[M],[]),get_db_config:e.Func([],[e.Opt(C)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt($)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(w)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt($)))],["query"]),get_rule:e.Func([_,e.Text],[e.Opt(J)],["query"]),get_storage_config:e.Func([],[B],["query"]),http_request:e.Func([X],[Ie],["query"]),http_request_streaming_callback:e.Func([j],[be],["query"]),init_asset_upload:e.Func([De],[sn],[]),list_assets:e.Func([e.Text,l],[an],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,b))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,cn))],["query"]),list_docs:e.Func([e.Text,l],[ln],["query"]),list_rules:e.Func([_],[e.Vec(e.Tuple(e.Text,J))],["query"]),memory_size:e.Func([],[un],["query"]),set_auth_config:e.Func([N],[],[]),set_controllers:e.Func([pn],[e.Vec(e.Tuple(e.Principal,b))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([C],[],[]),set_doc:e.Func([e.Text,e.Text,Ct],[$],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ct))],[e.Vec(e.Tuple(e.Text,$))],[]),set_rule:e.Func([_,e.Text,mn],[J],[]),set_storage_config:e.Func([B],[],[]),upload_asset_chunk:e.Func([fn],[hn],[]),version:e.Func([],[e.Text],["query"])})};import{Actor as wn,HttpAgent as vn}from"@dfinity/agent";import{nonNullish as Bt}from"@junobuild/utils";var kt=async({canisterId:e,idlFactory:t,config:r,...n})=>{let o=await ee(n);return wn.createActor(t,{agent:o,canisterId:e,...r??{}})},ee=async({agent:e,...t})=>e??await Pn(t),Pn=async({identity:e,fetch:t,container:r})=>{let n=Bt(r)&&r!==!1,o=n?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io";return await vn.create({identity:e,host:o,retryTimes:10,...Bt(t)&&{fetch:t},shouldFetchRootKey:n})};var Ut=({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:Et}),O=({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:Mt}),$t=({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:Ft}),oe=({missionControlId:e,...t})=>pe({canisterId:e,...t,idlFactory:At}),we=({orbiterId:e,...t})=>pe({canisterId:e,...t,idlFactory:Ot}),pe=({canisterId:e,idlFactory:t,...r})=>{if(Nn(e))throw new Error("No canister ID provided.");return kt({canisterId:e,idlFactory:t,...r})};var qt=async({missionControl:e})=>(await oe(e)).version(),jt=async({missionControl:e})=>(await oe(e)).get_user(),zt=async({missionControl:e})=>(await oe(e)).list_mission_control_controllers(),Ht=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await oe(e)).set_satellites_controllers(t,r,n),Kt=async({missionControl:e,controllerIds:t,controller:r})=>(await oe(e)).set_mission_control_controllers(t,r);import{Principal as Cn}from"@dfinity/principal";import{nonNullish as Sn,toNullable as Rn}from"@junobuild/utils";var Le=({controllerId:e,profile:t})=>({controllerIds:[Cn.fromText(e)],controller:Vn(t)}),Vn=e=>({metadata:Sn(e)&&e!==""?[["profile",e]]:[],expires_at:Rn(void 0),scope:{Admin:null}});var Jo=({controllerId:e,profile:t,...r})=>Ht({...r,...Le({controllerId:e,profile:t})}),Xo=({controllerId:e,profile:t,...r})=>Kt({...r,...Le({controllerId:e,profile:t})}),Zo=e=>zt(e);import{Principal as po}from"@dfinity/principal";var me={reinstall:null},te={upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]};import{fromNullable as Mn,isNullish as Bn}from"@junobuild/utils";import{CanisterStatus as An}from"@dfinity/agent";import{ICManagementCanister as ve}from"@dfinity/ic-management";import{Principal as On}from"@dfinity/principal";import{assertNonNullish as Fn}from"@junobuild/utils";var Wt=async({canisterId:e,actor:t})=>{let r=await ee(t),{stopCanister:n}=ve.create({agent:r});await n(e)},Gt=async({canisterId:e,actor:t})=>{let r=await ee(t),{startCanister:n}=ve.create({agent:r});await n(e)},Jt=async({actor:e,code:t})=>{let r=await ee(e),{installCode:n}=ve.create({agent:r});return n(t)};var Xt=async({actor:e,canisterId:t})=>{let r=await ee(e),{canisterStatus:n}=ve.create({agent:r});return n(t)},Zt=async({canisterId:e,path:t,...r})=>{Fn(e,"A canister ID must be provided to request its status.");let n=await ee(r);return(await An.request({canisterId:On.from(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]})).get(t)};var Yt=(o=>(o[o.AssertingExistingCode=0]="AssertingExistingCode",o[o.StoppingCanister=1]="StoppingCanister",o[o.UpgradingCode=2]="UpgradingCode",o[o.RestartingCanister=3]="RestartingCanister",o))(Yt||{});var Qt=e=>(e instanceof Uint8Array||(e=Uint8Array.from(e)),e.reduce((t,r)=>t+r.toString(16).padStart(2,"0"),""));var It=e=>crypto.subtle.digest("SHA-256",e),Dt=e=>Array.from(new Uint8Array(e)).map(r=>r.toString(16).padStart(2,"0")).join(""),si=async e=>{let t=await It(await e.arrayBuffer());return Dt(t)},Lt=async e=>{let t=await It(e);return Dt(t)};var re=async({wasmModule:e,canisterId:t,actor:r,onProgress:n,...o})=>{n?.(0),await kn({wasmModule:e,canisterId:t,actor:r,...o}),n?.(1),await Wt({canisterId:t,actor:r}),n?.(2);let i=()=>new Blob([e]).size>2e6?"chunked":"simple";await Un({wasmModule:e,canisterId:t,actor:r,...o}),n?.(3),await Gt({canisterId:t,actor:r})},kn=async({actor:e,canisterId:t,wasmModule:r})=>{let{module_hash:n}=await Xt({actor:e,canisterId:t}),o=Mn(n);if(Bn(o))return;let i=await Lt(r),a=Qt(o);if(i===a)throw new xe},Un=async({actor:e,...t})=>{await Jt({actor:e,code:t})};var D=Vt(xt(),1),br=e=>D.IDL.encode([D.IDL.Record({user:D.IDL.Principal})],[{user:e}]),We=e=>D.IDL.encode([D.IDL.Record({controllers:D.IDL.Vec(D.IDL.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var Fi=async({missionControl:e,...t})=>{let r=await jt({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=br(r);await re({actor:o,canisterId:po.fromText(n),arg:new Uint8Array(i),mode:te,...t})};var Bi=e=>qt(e);var xr=async({orbiter:e})=>(await we(e)).version(),Ge=async({orbiter:e})=>(await we(e)).list_controllers(),wr=async({orbiter:e})=>{let{memory_size:t}=await we(e);return t()};var ji=e=>Ge(e);var Ki=e=>wr(e);import{Principal as mo}from"@dfinity/principal";var Qi=async({orbiter:e,reset:t=!1,...r})=>{let{orbiterId:n,...o}=e;if(!n)throw new Error("No orbiter principal defined.");let i=await Ge({orbiter:e}),a=We(i);await re({actor:o,canisterId:mo.fromText(n),arg:new Uint8Array(a),mode:t?me:te,...r})};var Li=e=>xr(e);import{major as vr,minor as Pr,patch as Nr}from"semver";var rs=({currentVersion:e,selectedVersion:t})=>{let r=vr(e),n=vr(t),o=Pr(e),i=Pr(t),a=Nr(e),l=Nr(t);return r<n-1||o<i-1||a<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{toNullable as fo}from"@junobuild/utils";var Cr=async({config:e,satellite:t})=>{let{set_storage_config:r}=await O(t);return r(e)},Sr=async({config:e,satellite:t})=>{let{set_db_config:r}=await O(t);return r(e)},Rr=async({config:e,satellite:t})=>{let{set_auth_config:r}=await O(t);return r(e)};var Vr=async({satellite:e})=>{let{get_auth_config:t}=await O(e);return t()},Ar=async({satellite:e,type:t})=>(await O(e)).list_rules(t),Or=async({type:e,collection:t,rule:r,satellite:n})=>{let{set_rule:o}=await O(n);return o(e,t,r)},Fr=async({satellite:e})=>{let{version:t}=await O(e);return t()},Er=async({satellite:e})=>{let{build_version:t}=await O(e);return t()},Mr=async({satellite:e})=>(await Ut(e)).list_controllers(),Je=async({satellite:e})=>(await $t(e)).list_controllers(),Xe=async({satellite:e})=>(await O(e)).list_controllers(),Br=async({satellite:e})=>{let{list_custom_domains:t}=await O(e);return t()},kr=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await O(e);await n(t,fo(r))},Ur=async({satellite:e})=>{let{memory_size:t}=await O(e);return t()},$r=async({collection:e,satellite:t})=>{let{count_collection_docs:r}=await O(t);return r(e)},qr=async({collection:e,satellite:t})=>{let{count_collection_assets:r}=await O(t);return r(e)},jr=async({collection:e,satellite:t})=>{let{del_docs:r}=await O(t);return r(e)},zr=async({collection:e,satellite:t})=>{let{del_assets:r}=await O(t);return r(e)},Hr=async({args:e,satellite:t})=>{let{set_controllers:r}=await O(t);return r(e)};var cs=e=>qr(e),ls=e=>zr(e);import{fromNullable as Ze,isNullish as Wr,nonNullish as Kr}from"@junobuild/utils";import{nonNullish as ho,toNullable as wt}from"@junobuild/utils";var vt=e=>wt(ho(e)?{heap:wt(e.heap),stable:wt(e.stable)}:void 0);var ys=async({config:{headers:e,rewrites:t,redirects:r,iframe:n,rawAccess:o,maxMemorySize:i},satellite:a})=>{let l=(e??[]).map(({source:_,headers:u})=>[_,u]),p=(t??[]).map(({source:_,destination:u})=>[_,u]),d=(r??[]).map(({source:_,location:u,code:m})=>[_,{status_code:m,location:u}]);return await Cr({satellite:a,config:{headers:l,rewrites:p,redirects:[d],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[o===!0?{Allow:null}:{Deny:null}],max_memory_size:vt(i)}})},_s=async({config:{maxMemorySize:e},...t})=>{await Sr({config:{max_memory_size:vt(e)},...t})},gs=async({config:{internetIdentity:e},...t})=>{await Rr({config:{internet_identity:Wr(e?.derivationOrigin)?[]:[{derivation_origin:[e.derivationOrigin]}]},...t})},Ts=async({satellite:e})=>{let t=Ze(await Vr({satellite:e}));if(Wr(t))return;let r=Ze(t.internet_identity??[]);return{...Kr(r)&&{internetIdentity:{...Kr(Ze(r.derivation_origin))&&{derivationOrigin:Ze(r.derivation_origin)}}}}};var ws=({deprecatedNoScope:e,...t})=>(e===!0?Je:Xe)(t),vs=e=>Hr(e);var Cs=e=>$r(e),Ss=e=>jr(e);import{fromNullable as Gr,nonNullish as yo}from"@junobuild/utils";var Os=async({satellite:e})=>(await Br({satellite:e})).map(([r,n])=>{let o=Gr(n.version);return{domain:r,bn_id:Gr(n.bn_id),created_at:n.created_at,updated_at:n.updated_at,...yo(o)&&{version:o}}}),Fs=({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>kr({satellite:e,domainName:r,boundaryNodesId:n})));var Bs=e=>Ur(e);import{fromNullable as de,nonNullish as L,toNullable as Ye}from"@junobuild/utils";var Jr={Db:null},Xr={Storage:null},Zr={Public:null},Yr={Private:null},Qr={Managed:null},Ir={Controllers:null},Pt={Heap:null},Dr={Stable:null},Lr=600000000n;var Nt=e=>e==="storage"?Xr:Jr,rn=({read:e,write:t,memory:r,maxSize:n,maxCapacity:o,version:i,mutablePermissions:a,maxTokens:l})=>({read:tn(e),write:tn(t),memory:L(r)?[_o(r)]:[],version:Ye(i),max_size:Ye(L(n)&&n>0?BigInt(n):void 0),max_capacity:Ye(L(o)&&o>0?o:void 0),mutable_permissions:Ye(a),rate_config:L(l)?[{max_tokens:BigInt(l),time_per_token_ns:Lr}]:[]}),nn=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:a,max_capacity:l,memory:p,mutable_permissions:d,version:b,rate_config:x}=t,_=a?.[0]??0n>0n?Number(de(a)):void 0,u=l?.[0]??!1?de(l):void 0,m=de(b),y=x?.[0]?.max_tokens??0n>0n?de(x)?.max_tokens:void 0;return{collection:e,read:en(r),write:en(n),memory:go(de(p)??Pt),updatedAt:o,createdAt:i,...L(m)&&{version:m},...L(_)&&{maxSize:_},...L(u)&&{maxCapacity:u},mutablePermissions:de(d)??!0,...L(y)&&{maxTokens:Number(y)}}},en=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",tn=e=>{switch(e){case"public":return Zr;case"private":return Yr;case"managed":return Qr;default:return Ir}},_o=e=>{switch(e.toLowerCase()){case"heap":return Pt;default:return Dr}},go=e=>"Heap"in e?"heap":"stable";var Ks=async({type:e,satellite:t})=>(await Ar({satellite:t,type:Nt(e)})).map(n=>nn(n)),Ws=async({rule:{collection:e,...t},type:r,satellite:n})=>{await Or({type:Nt(r),rule:rn(t),satellite:n,collection:e})};var Te=Vt(xt(),1);import{Principal as on}from"@dfinity/principal";import{isNullish as To}from"@junobuild/utils";var Ds=async({satellite:e,deprecated:t,deprecatedNoScope:r,reset:n=!1,...o})=>{let{satelliteId:i,...a}=e;if(To(i))throw new Error("No satellite principal defined.");if(t){let b=await Mr({satellite:e}),x=Te.IDL.encode([Te.IDL.Record({controllers:Te.IDL.Vec(Te.IDL.Principal)})],[{controllers:b}]);await re({actor:a,canisterId:on.fromText(i),arg:new Uint8Array(x),mode:n?me:te,...o});return}let p=await(r?Je:Xe)({satellite:e}),d=We(p);await re({actor:a,canisterId:on.fromText(i),arg:new Uint8Array(d),mode:n?me:te,...o})};import{nonNullish as bo}from"@junobuild/utils";var na=e=>Fr(e),oa=e=>Er(e),ia=async({satellite:{satelliteId:e,...t}})=>{let r=await Zt({...t,canisterId:e,path:"juno:build"});return bo(r)&&["stock","extended"].includes(r)?r:void 0};export{Yt as UpgradeCodeProgress,xe as UpgradeCodeUnchangedError,si as blobSha256,rs as checkUpgradeVersion,cs as countAssets,Cs as countDocs,ls as deleteAssets,Ss as deleteDocs,Ts as getAuthConfig,Os as listCustomDomains,Zo as listMissionControlControllers,ji as listOrbiterControllers,Ks as listRules,ws as listSatelliteControllers,Bi as missionControlVersion,Ki as orbiterMemorySize,Li as orbiterVersion,ia as satelliteBuildType,oa as satelliteBuildVersion,Bs as satelliteMemorySize,na as satelliteVersion,gs as setAuthConfig,Fs as setCustomDomains,_s as setDatastoreConfig,Xo as setMissionControlController,Ws as setRule,vs as setSatelliteControllers,Jo as setSatellitesController,ys as setStorageConfig,Lt as uint8ArraySha256,Fi as upgradeMissionControl,Qi as upgradeOrbiter,Ds as upgradeSatellite};
|
|
16
16
|
//# sourceMappingURL=index.mjs.map
|