@junobuild/admin 0.0.52 → 0.0.53
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/declarations/satellite/satellite.did.d.ts +25 -2
- package/declarations/satellite/satellite.factory.did.js +28 -4
- package/declarations/satellite/satellite.factory.did.mjs +28 -4
- package/dist/browser/index.js +7 -7
- package/dist/browser/index.js.map +4 -4
- package/dist/declarations/satellite/satellite.did.d.ts +25 -2
- package/dist/declarations/satellite/satellite.factory.did.js +28 -4
- package/dist/declarations/satellite/satellite.factory.did.mjs +28 -4
- package/dist/node/index.mjs +7 -7
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/api/satellite.api.d.ts +13 -3
- package/dist/types/services/satellite.services.d.ts +23 -14
- package/dist/types/utils/memory.utils.d.ts +3 -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 Tn=Object.create;var Ft=Object.defineProperty;var bn=Object.getOwnPropertyDescriptor;var wn=Object.getOwnPropertyNames;var xn=Object.getPrototypeOf,vn=Object.prototype.hasOwnProperty;var Ot=(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 K=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Nn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of wn(t))!vn.call(e,o)&&o!==r&&Ft(e,o,{get:()=>t[o],enumerable:!(n=bn(t,o))||n.enumerable});return e};var At=(e,t,r)=>(r=e!=null?Tn(xn(e)):{},Nn(t||!e||!e.__esModule?Ft(r,"default",{value:e,enumerable:!0}):r,e));var Pe=K(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.bufFromBufLike=k.uint8ToBuf=k.PipeArrayBuffer=k.fromHexString=k.toHexString=k.concat=void 0;function kn(...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=kn;function Mn(e){return new Uint8Array(e).reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}k.toHexString=Mn;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 rt=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=rt;function ve(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).buffer}k.uint8ToBuf=ve;function Ne(e){return e instanceof Uint8Array?ve(e):e instanceof ArrayBuffer?e:Array.isArray(e)?ve(new Uint8Array(e)):"buffer"in e?Ne(e.buffer):ve(new Uint8Array(e))}k.bufFromBufLike=Ne});var nt=K(Ve=>{"use strict";Object.defineProperty(Ve,"__esModule",{value:!0});Ve.idlLabelToId=void 0;function $n(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function Un(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 $n(e)}Ve.idlLabelToId=Un});var it=K(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.readIntLE=N.readUIntLE=N.writeIntLE=N.writeUIntLE=N.slebDecode=N.slebEncode=N.lebDecode=N.lebEncode=N.safeReadUint8=N.safeRead=void 0;var ot=Pe();function Dt(){throw new Error("unexpected end of buffer")}function Lt(e,t){return e.byteLength<t&&Dt(),e.read(t)}N.safeRead=Lt;function Re(e){let t=e.readUint8();return t===void 0&&Dt(),t}N.safeReadUint8=Re;function jn(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 ot.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}N.lebEncode=jn;function er(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}N.lebDecode=er;function zn(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 ot.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}N.slebEncode=zn;function Hn(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return er(e);break}let n=new Uint8Array(Lt(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)}N.slebDecode=Hn;function Kn(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return tr(e,t)}N.writeUIntLE=Kn;function tr(e,t){e=BigInt(e);let r=new ot.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}N.writeIntLE=tr;function rr(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}N.readUIntLE=rr;function Wn(e,t){let r=rr(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}N.readIntLE=Wn});var nr=K(ne=>{"use strict";Object.defineProperty(ne,"__esModule",{value:!0});ne.iexp2=ne.ilog2=void 0;function Jn(e){let t=BigInt(e);if(e<=0)throw new RangeError("Input must be positive");return t.toString(2).length-1}ne.ilog2=Jn;function Gn(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}ne.iexp2=Gn});var ut=K(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=Ot("@dfinity/principal"),g=Pe(),$=nt(),c=it(),st=nr(),Ce="DIDL",or=400;function me(e,t,r){return e.map((n,o)=>r(n,t[o]))}var at=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,g.concat)(...this._typs);return(0,g.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)}},ct=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=ct;var oe=class{display(){return this.name}valueToString(t){return V(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}};s.Type=oe;var M=class extends oe{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=M;var j=class extends oe{checkType(t){if(t instanceof G){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=j;var Se=class extends M{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${V(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=Se;var Fe=class extends oe{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: ${V(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 G?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=Fe;var Oe=class extends M{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${V(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=Oe;var Ae=class extends M{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${V(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=Ae;var ie=class extends M{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=ie;var Ee=class extends M{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${V(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=(0,c.lebEncode)(r.byteLength);return(0,g.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=Ee;var Be=class extends M{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: ${V(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 M{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: ${V(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 _e=class extends M{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: ${V(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=_e;var W=class extends M{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=(0,st.iexp2)(this._bits-1)*BigInt(-1),n=(0,st.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: ${V(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=W;var U=class extends M{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=(0,st.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: ${V(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=U;var Me=class e extends j{constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof U&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof U?this._type._bits:this._type instanceof W?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 xn=Object.create;var kt=Object.defineProperty;var vn=Object.getOwnPropertyDescriptor;var Nn=Object.getOwnPropertyNames;var Pn=Object.getPrototypeOf,Vn=Object.prototype.hasOwnProperty;var Mt=(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 K=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Rn=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Nn(t))!Vn.call(e,o)&&o!==r&&kt(e,o,{get:()=>t[o],enumerable:!(n=vn(t,o))||n.enumerable});return e};var qt=(e,t,r)=>(r=e!=null?xn(Pn(e)):{},Rn(t||!e||!e.__esModule?kt(r,"default",{value:e,enumerable:!0}):r,e));var Ve=K(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 Un(e){return new Uint8Array(e).reduce((t,r)=>t+r.toString(16).padStart(2,"0"),"")}k.toHexString=Un;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 it=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=it;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 st=K(Re=>{"use strict";Object.defineProperty(Re,"__esModule",{value:!0});Re.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)}Re.idlLabelToId=Hn});var ct=K(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 at=Ve();function nr(){throw new Error("unexpected end of buffer")}function or(e,t){return e.byteLength<t&&nr(),e.read(t)}v.safeRead=or;function Ce(e){let t=e.readUint8();return t===void 0&&nr(),t}v.safeReadUint8=Ce;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 at.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 ir(e){let t=BigInt(1),r=BigInt(0),n;do n=Ce(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}v.lebDecode=ir;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 at.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 ir(e);break}let n=new Uint8Array(or(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 sr(e,t)}v.writeUIntLE=Jn;function sr(e,t){e=BigInt(e);let r=new at.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=sr;function ar(e,t){let r=BigInt(Ce(e)),n=BigInt(1),o=0;for(;++o<t;){n*=BigInt(256);let i=BigInt(Ce(e));r=r+n*i}return r}v.readUIntLE=ar;function Yn(e,t){let r=ar(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}v.readIntLE=Yn});var cr=K(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.iexp2=oe.ilog2=void 0;function Qn(e){let t=BigInt(e);if(e<=0)throw new RangeError("Input must be positive");return t.toString(2).length-1}oe.ilog2=Qn;function Xn(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}oe.iexp2=Xn});var mt=K(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 Zn=Mt("@dfinity/principal"),h=Ve(),$=st(),c=ct(),lt=cr(),Se="DIDL",lr=400;function fe(e,t,r){return e.map((n,o)=>r(n,t[o]))}var ut=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)}},dt=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=dt;var ie=class{display(){return this.name}valueToString(t){return V(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}};s.Type=ie;var M=class extends ie{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=M;var j=class extends ie{checkType(t){if(t instanceof J){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=j;var Fe=class extends M{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${V(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=Fe;var Oe=class extends ie{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: ${V(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 J?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 Ae=class extends M{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${V(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=Ae;var Ee=class extends M{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${V(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 se=class extends M{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=se;var Be=class extends M{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${V(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=Be;var ke=class extends M{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: ${V(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=ke;var Me=class extends M{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: ${V(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=Me;var he=class extends M{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: ${V(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 W=class extends M{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=(0,lt.iexp2)(this._bits-1)*BigInt(-1),n=(0,lt.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: ${V(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=W;var U=class extends M{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=(0,lt.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: ${V(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=U;var qe=class e extends j{constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof U&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof U?this._type._bits:this._type instanceof W?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
|
-
index ${o} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${V(t)}`)}encodeValue(t){let r=(0,c.lebEncode)(t.length);if(this._blobOptimization)return(0,
|
|
5
|
+
index ${o} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${V(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 U){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 W){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=qe;var ae=class e extends j{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: ${V(t)}
|
|
6
6
|
|
|
7
|
-
-> ${r.message}`)}throw new Error(`Invalid ${this.display()} argument: ${V(t)}`)}encodeValue(t){return t.length===0?new Uint8Array([0]):(0,
|
|
7
|
+
-> ${r.message}`)}throw new Error(`Invalid ${this.display()} argument: ${V(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=ae;var ye=class e extends j{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>(0,$.idlLabelToId)(r[0])-(0,$.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: ${V(t)}`)}encodeValue(t){let r=this._fields.map(([o])=>t[o]),n=
|
|
9
|
+
field ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${V(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,$.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[u,p]=n._fields[a];if(i>=this._fields.length){p.decodeValue(t,p),a++;continue}let[d,y]=this._fields[i],g=(0,$.idlLabelToId)(this._fields[i][0]),b=(0,$.idlLabelToId)(u);if(g===b)o[d]=y.decodeValue(t,p),i++,a++;else if(b>g)if(y instanceof ae||y instanceof se)o[d]=[],i++;else throw new Error("Cannot find required field "+d);else p.decodeValue(t,p),a++}for(let[u,p]of this._fields.slice(i))if(p instanceof ae||p instanceof se)o[u]=[];else throw new Error("Cannot find required field "+u);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
|
-
index ${n} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${V(t)}`)}encodeValue(t){let r=
|
|
11
|
+
index ${n} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${V(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 Ue=class e extends j{constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>(0,$.idlLabelToId)(r[0])-(0,$.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: ${V(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,
|
|
13
|
+
variant ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${V(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,$.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[u,p]of this._fields)if((0,$.idlLabelToId)(i)===(0,$.idlLabelToId)(u)){let d=p.decodeValue(t,a);return{[u]: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=Ue;var J=class e extends j{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: ${V(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=J;J._counter=0;function pt(e){if((0,c.safeReadUint8)(e)!==1)throw new Error("Cannot decode principal");let r=Number((0,c.lebDecode)(e));return Zn.Principal.fromUint8Array(new Uint8Array((0,c.safeRead)(e,r)))}var je=class extends M{accept(t,r){return t.visitPrincipal(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${V(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),pt(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}};s.PrincipalClass=je;var ge=class extends j{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: ${V(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),u=(0,c.lebEncode)(a.byteLength);return(0,h.concat)(new Uint8Array([1]),i,u,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))),u=(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,u,p))}decodeValue(t){if((0,c.safeReadUint8)(t)!==1)throw new Error("Cannot decode function reference");let n=pt(t),o=Number((0,c.lebDecode)(t)),i=(0,c.safeRead)(t,o),u=new TextDecoder("utf8",{fatal:!0}).decode(i);return[n,u]}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=ge;var ze=class extends j{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: ${V(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 u=new TextEncoder().encode(i),p=(0,c.lebEncode)(u.length);return(0,h.concat)(p,u,a.encodeType(t))});t.add(this,(0,h.concat)(r,n,...o))}decodeValue(t){return pt(t)}get name(){return`service {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}valueToString(t){return`service "${t.toText()}"`}};s.ServiceClass=ze;function V(e){let t=JSON.stringify(e,(r,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>lr?t.substring(0,lr-3)+"...":t}function In(e,t){if(t.length<e.length)throw Error("Wrong number of message arguments");let r=new ut;e.forEach(p=>p.buildTypeTable(r));let n=new TextEncoder().encode(Se),o=r.encode(),i=(0,c.lebEncode)(t.length),a=(0,h.concat)(...e.map(p=>p.encodeType(r))),u=(0,h.concat)(...fe(e,t,(p,d)=>{try{p.covariant(d)}catch(y){throw new Error(y.message+`
|
|
14
14
|
|
|
15
|
-
`)}return p.encodeValue(d)}));return(0,g.concat)(n,o,i,a,u)}s.encode=Qn;function Xn(e,t){let r=new g.PipeArrayBuffer(t);if(t.byteLength<Ce.length)throw new Error("Message length smaller than magic number");let n=(0,c.safeRead)(r,Ce.length),o=new TextDecoder().decode(n);if(o!==Ce)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(l){let m=[],w=Number((0,c.lebDecode)(l));for(let T=0;T<w;T++){let f=Number((0,c.slebDecode)(l));switch(f){case-18:case-19:{let P=Number((0,c.slebDecode)(l));m.push([f,P]);break}case-20:case-21:{let P=[],S=Number((0,c.lebDecode)(l)),R;for(;S--;){let F=Number((0,c.lebDecode)(l));if(F>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof R=="number"&&R>=F)throw new Error("field id collision or not sorted");R=F;let C=Number((0,c.slebDecode)(l));P.push([F,C])}m.push([f,P]);break}case-22:{let P=[],S=Number((0,c.lebDecode)(l));for(;S--;)P.push(Number((0,c.slebDecode)(l)));let R=[],F=Number((0,c.lebDecode)(l));for(;F--;)R.push(Number((0,c.slebDecode)(l)));let C=[],q=Number((0,c.lebDecode)(l));for(;q--;)switch(Number((0,c.lebDecode)(l))){case 1:{C.push("query");break}case 2:{C.push("oneway");break}case 3:{C.push("composite_query");break}default:throw new Error("unknown annotation")}m.push([f,[P,R,C]]);break}case-23:{let P=Number((0,c.lebDecode)(l)),S=[];for(;P--;){let R=Number((0,c.lebDecode)(l)),F=new TextDecoder().decode((0,c.safeRead)(l,R)),C=(0,c.slebDecode)(l);S.push([F,C])}m.push([f,S]);break}default:throw new Error("Illegal op_code: "+f)}}let x=[],v=Number((0,c.lebDecode)(l));for(let T=0;T<v;T++)x.push(Number((0,c.slebDecode)(l)));return[m,x]}let[a,u]=i(r);if(u.length<e.length)throw new Error("Wrong number of return values");let p=a.map(l=>ur());function d(l){if(l<-24)throw new Error("future value not supported");if(l<0)switch(l){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: "+l)}if(l>=a.length)throw new Error("type index out of range");return p[l]}function y(l){switch(l[0]){case-19:{let m=d(l[1]);return sr(m)}case-18:{let m=d(l[1]);return ar(m)}case-20:{let m={};for(let[v,T]of l[1]){let f=`_${v}_`;m[f]=d(T)}let w=cr(m),x=w.tryAsTuple();return Array.isArray(x)?ir(...x):w}case-21:{let m={};for(let[w,x]of l[1]){let v=`_${w}_`;m[v]=d(x)}return lr(m)}case-22:{let[m,w,x]=l[1];return dr(m.map(v=>d(v)),w.map(v=>d(v)),x)}case-23:{let m={},w=l[1];for(let[x,v]of w){let T=d(v);if(T instanceof G&&(T=T.getType()),!(T instanceof he))throw new Error("Illegal service definition: services can only contain functions");m[x]=T}return pr(m)}default:throw new Error("Illegal op_code: "+l[0])}}a.forEach((l,m)=>{if(l[0]===-22){let w=y(l);p[m].fill(w)}}),a.forEach((l,m)=>{if(l[0]!==-22){let w=y(l);p[m].fill(w)}});let h=u.map(l=>d(l)),b=e.map((l,m)=>l.decodeValue(r,h[m]));for(let l=e.length;l<h.length;l++)h[l].decodeValue(r,h[l]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return b}s.decode=Xn;s.Empty=new Se;s.Reserved=new ie;s.Unknown=new Fe;s.Bool=new Oe;s.Null=new Ae;s.Text=new Ee;s.Int=new Be;s.Nat=new ke;s.Float32=new _e(32);s.Float64=new _e(64);s.Int8=new W(8);s.Int16=new W(16);s.Int32=new W(32);s.Int64=new W(64);s.Nat8=new U(8);s.Nat16=new U(16);s.Nat32=new U(32);s.Nat64=new U(64);s.Principal=new Ue;function ir(...e){return new qe(e)}s.Tuple=ir;function sr(e){return new Me(e)}s.Vec=sr;function ar(e){return new se(e)}s.Opt=ar;function cr(e){return new fe(e)}s.Record=cr;function lr(e){return new $e(e)}s.Variant=lr;function ur(){return new G}s.Rec=ur;function dr(e,t,r=[]){return new he(e,t,r)}s.Func=dr;function pr(e){return new je(e)}s.Service=pr});var yt=K(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.VecForm=B.OptionForm=B.VariantForm=B.TupleForm=B.RecordForm=B.InputForm=B.InputBox=void 0;var dt=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)}};B.InputBox=dt;var Y=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)}};B.InputForm=Y;var pt=class extends Y{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}};B.RecordForm=pt;var mt=class extends Y{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}};B.TupleForm=mt;var _t=class extends Y{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}};B.VariantForm=_t;var ft=class extends Y{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]}}};B.OptionForm=ft;var ht=class extends Y{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}};B.VecForm=ht});var _r=K(_=>{"use strict";var Zn=_&&_.__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]}),In=_&&_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),mr=_&&_.__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)&&Zn(t,e,r);return In(t,e),t};Object.defineProperty(_,"__esModule",{value:!0});_.renderValue=_.renderInput=_.Render=_.vecForm=_.optForm=_.variantForm=_.tupleForm=_.recordForm=_.inputBox=void 0;var He=mr(ut()),gt=Ot("@dfinity/principal"),ae=mr(yt()),Dn={parse:io},ye={render:xt},Ln=(e,t)=>new ae.InputBox(e,Object.assign(Object.assign({},Dn),t));_.inputBox=Ln;var eo=(e,t)=>new ae.RecordForm(e,Object.assign(Object.assign({},ye),t));_.recordForm=eo;var to=(e,t)=>new ae.TupleForm(e,Object.assign(Object.assign({},ye),t));_.tupleForm=to;var ro=(e,t)=>new ae.VariantForm(e,Object.assign(Object.assign({},ye),t));_.variantForm=ro;var no=(e,t)=>new ae.OptionForm(e,Object.assign(Object.assign({},ye),t));_.optForm=no;var oo=(e,t)=>new ae.VecForm(e,Object.assign(Object.assign({},ye),t));_.vecForm=oo;var ze=class extends He.Visitor{visitType(t,r){let n=document.createElement("input");return n.classList.add("argument"),n.placeholder=t.display(),(0,_.inputBox)(t,{input:n})}visitNull(t,r){return(0,_.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,_.recordForm)(r,o);return(0,_.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,_.tupleForm)(r,o);return(0,_.inputBox)(t,{form:i})}visitVariant(t,r,n){let o=document.createElement("select");for(let[u,p]of r){let d=new Option(u);o.add(d)}o.selectedIndex=-1,o.classList.add("open");let i={open:o,event:"change"},a=(0,_.variantForm)(r,i);return(0,_.inputBox)(t,{form:a})}visitOpt(t,r,n){let o=document.createElement("input");o.type="checkbox",o.classList.add("open");let i=(0,_.optForm)(r,{open:o,event:"change"});return(0,_.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,_.vecForm)(r,{open:o,event:"change",container:i});return(0,_.inputBox)(t,{form:a})}visitRec(t,r,n){return xt(r)}};_.Render=ze;var Tt=class extends He.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 gt.Principal.fromText(r)}visitService(t,r){return gt.Principal.fromText(r)}visitFunc(t,r){let n=r.split(".",2);return[gt.Principal.fromText(n[0]),n[1]]}},bt=class extends He.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 io(e,t,r){return t.random&&r===""?e.accept(new bt,r):e.accept(new Tt,r)}function xt(e){return e.accept(new ze,null)}_.renderInput=xt;function te(e,t,r){return e.accept(new wt,{input:t,value:r})}_.renderValue=te;var wt=class extends He.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){te(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)),te(r,o.form[0],n.value[0])}}visitRecord(t,r,n){let o=n.input.ui.form;r.forEach(([i,a],u)=>{te(a,o.form[u],n.value[i])})}visitTuple(t,r,n){let o=n.input.ui.form;r.forEach((i,a)=>{te(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,u],p)=>{if(a===i[0]){let d=o.ui.open;d.selectedIndex=p,d.dispatchEvent(new Event(o.ui.event)),te(u,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((u,p)=>{te(r,o.form[p],u)})}}});var hr=K(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0})});var vt=K(A=>{"use strict";var yr=A&&A.__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]}),so=A&&A.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),ce=A&&A.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&yr(t,e,r)},ao=A&&A.__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)&&yr(t,e,r);return so(t,e),t};Object.defineProperty(A,"__esModule",{value:!0});A.IDL=void 0;ce(_r(),A);ce(yt(),A);A.IDL=ao(ut());ce(nt(),A);ce(it(),A);ce(Pe(),A);ce(hr(),A)});import{Principal as co}from"@dfinity/principal";import{CanisterStatus as Cn}from"@dfinity/agent";import{Principal as Sn}from"@dfinity/principal";import{assertNonNullish as Fn}from"@junobuild/utils";import{Actor as Pn,HttpAgent as Vn}from"@dfinity/agent";import{nonNullish as Et}from"@junobuild/utils";var Le=async({canisterId:e,idlFactory:t,config:r,...n})=>{let o=await et(n);return Pn.createActor(t,{agent:o,canisterId:e,...r!==void 0?r:{}})},et=async({identity:e,fetch:t,container:r})=>{let n=Et(r)&&r!==!1,o=n?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io",i=new Vn({identity:e,host:o,retryTimes:10,...Et(t)&&{fetch:t}});return n&&await i.fetchRootKey(),i};import{Principal as zt}from"@dfinity/principal";import{isNullish as Rn}from"@junobuild/utils";var Bt=({IDL:e})=>{let t=e.Variant({mainnet:e.Null,testnet:e.Null}),r=e.Text,n=e.Record({network:t,address:r,min_confirmations:e.Opt(e.Nat32)}),o=e.Nat64,i=o,a=e.Record({network:t,address:r,min_confirmations:e.Opt(e.Nat32)}),u=o,p=e.Record({network:t}),d=e.Nat64,y=e.Vec(d),h=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),b=e.Vec(e.Nat8),l=e.Record({txid:e.Vec(e.Nat8),vout:e.Nat32}),m=e.Record({height:e.Nat32,value:o,outpoint:l}),w=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:b,utxos:e.Vec(m)}),x=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),v=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:b,utxos:e.Vec(m)}),T=e.Record({transaction:e.Vec(e.Nat8),network:t}),f=e.Principal,P=e.Record({canister_id:f,num_requested_changes:e.Opt(e.Nat64)}),S=e.Variant({from_user:e.Record({user_id:e.Principal}),from_canister:e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal})}),R=e.Variant({creation:e.Record({controllers:e.Vec(e.Principal)}),code_deployment:e.Record({mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),module_hash:e.Vec(e.Nat8)}),controllers_change:e.Record({controllers:e.Vec(e.Principal)}),code_uninstall:e.Null}),F=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:S,details:R}),C=e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(F),total_num_changes:e.Nat64}),q=e.Record({canister_id:f}),O=e.Variant({controllers:e.Null,public:e.Null}),z=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Nat,log_visibility:O,memory_allocation:e.Nat,compute_allocation:e.Nat}),X=e.Record({status:e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),memory_size:e.Nat,cycles:e.Nat,settings:z,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Nat}),Z=e.Record({canister_id:f}),H=e.Record({freezing_threshold:e.Opt(e.Nat),controllers:e.Opt(e.Vec(e.Principal)),reserved_cycles_limit:e.Opt(e.Nat),log_visibility:e.Opt(O),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),J=e.Record({settings:e.Opt(H),sender_canister_version:e.Opt(e.Nat64)}),I=e.Record({canister_id:f}),D=e.Record({canister_id:f}),Ge=e.Record({canister_id:f}),L=e.Variant({secp256k1:e.Null}),Ye=e.Record({key_id:e.Record({name:e.Text,curve:L}),canister_id:e.Opt(f),derivation_path:e.Vec(e.Vec(e.Nat8))}),Qe=e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)}),Xe=e.Record({canister_id:f}),Ze=e.Record({idx:e.Nat64,timestamp_nanos:e.Nat64,content:e.Vec(e.Nat8)}),be=e.Record({canister_log_records:e.Vec(Ze)}),we=e.Record({value:e.Text,name:e.Text}),de=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(we)}),Ie=e.Record({url:e.Text,method:e.Variant({get:e.Null,head:e.Null,post:e.Null}),max_response_bytes:e.Opt(e.Nat64),body:e.Opt(e.Vec(e.Nat8)),transform:e.Opt(e.Record({function:e.Func([e.Record({context:e.Vec(e.Nat8),response:de})],[de],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(we)}),De=e.Vec(e.Nat8),Dr=e.Record({arg:e.Vec(e.Nat8),wasm_module_hash:e.Vec(e.Nat8),mode:e.Variant({reinstall:e.Null,upgrade:e.Opt(e.Record({skip_pre_upgrade:e.Opt(e.Bool)})),install:e.Null}),chunk_hashes_list:e.Vec(De),target_canister:f,sender_canister_version:e.Opt(e.Nat64),storage_canister:e.Opt(f)}),Lr=e.Vec(e.Nat8),en=e.Record({arg:e.Vec(e.Nat8),wasm_module:Lr,mode:e.Variant({reinstall:e.Null,upgrade:e.Opt(e.Record({skip_pre_upgrade:e.Opt(e.Bool)})),install:e.Null}),canister_id:f,sender_canister_version:e.Opt(e.Nat64)}),tn=e.Record({start_at_timestamp_nanos:e.Nat64,subnet_id:e.Principal}),rn=e.Record({num_block_failures_total:e.Nat64,node_id:e.Principal,num_blocks_total:e.Nat64}),nn=e.Vec(e.Record({timestamp_nanos:e.Nat64,node_metrics:e.Vec(rn)})),on=e.Record({settings:e.Opt(H),specified_id:e.Opt(f),amount:e.Opt(e.Nat),sender_canister_version:e.Opt(e.Nat64)}),sn=e.Record({canister_id:f}),an=e.Record({canister_id:f,amount:e.Nat}),cn=e.Vec(e.Nat8),ln=e.Record({key_id:e.Record({name:e.Text,curve:L}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)}),un=e.Record({signature:e.Vec(e.Nat8)}),dn=e.Record({canister_id:f}),pn=e.Record({canister_id:f}),mn=e.Record({canister_id:f}),_n=e.Vec(De),fn=e.Record({canister_id:f,sender_canister_version:e.Opt(e.Nat64)}),hn=e.Record({canister_id:e.Principal,settings:H,sender_canister_version:e.Opt(e.Nat64)}),yn=e.Record({chunk:e.Vec(e.Nat8),canister_id:e.Principal}),gn=De;return e.Service({bitcoin_get_balance:e.Func([n],[i],[]),bitcoin_get_balance_query:e.Func([a],[u],["query"]),bitcoin_get_current_fee_percentiles:e.Func([p],[y],[]),bitcoin_get_utxos:e.Func([h],[w],[]),bitcoin_get_utxos_query:e.Func([x],[v],["query"]),bitcoin_send_transaction:e.Func([T],[],[]),canister_info:e.Func([P],[C],[]),canister_status:e.Func([q],[X],[]),clear_chunk_store:e.Func([Z],[],[]),create_canister:e.Func([J],[I],[]),delete_canister:e.Func([D],[],[]),deposit_cycles:e.Func([Ge],[],[]),ecdsa_public_key:e.Func([Ye],[Qe],[]),fetch_canister_logs:e.Func([Xe],[be],["query"]),http_request:e.Func([Ie],[de],[]),install_chunked_code:e.Func([Dr],[],[]),install_code:e.Func([en],[],[]),node_metrics_history:e.Func([tn],[nn],[]),provisional_create_canister_with_cycles:e.Func([on],[sn],[]),provisional_top_up_canister:e.Func([an],[],[]),raw_rand:e.Func([],[cn],[]),sign_with_ecdsa:e.Func([ln],[un],[]),start_canister:e.Func([dn],[],[]),stop_canister:e.Func([pn],[],[]),stored_chunks:e.Func([mn],[_n],[]),uninstall_code:e.Func([fn],[],[]),update_settings:e.Func([hn],[],[]),upload_chunk:e.Func([yn],[gn],[])})};var kt=({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({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),n=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Variant({Write:e.Null,Admin:e.Null}),i=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:o,expires_at:e.Opt(e.Nat64)}),a=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),u=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),p=e.Record({status:a,memory_size:e.Nat,cycles:e.Nat,settings:u,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),d=e.Record({id:e.Principal,status:p,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),y=e.Variant({Ok:d,Err:e.Text}),h=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:o,expires_at:e.Opt(e.Nat64)}),b=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),l=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,b)),satellites:e.Vec(e.Tuple(e.Principal,b)),cycles_threshold:e.Opt(e.Nat64)}),m=e.Record({orbiters:e.Opt(e.Vec(y)),satellites:e.Opt(e.Vec(y)),mission_control:y}),w=e.Record({e8s:e.Nat64});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_satellite:e.Func([e.Text],[r],[]),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([n],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,i))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,y))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,y)))],["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,y)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,r))],["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),h],[],[]),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),h],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[r],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[r],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),h],[],[]),status:e.Func([l],[m],[]),top_up:e.Func([e.Principal,w],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),version:e.Func([],[e.Text],["query"])})};var Mt=({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)}),u=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)}),y=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),h=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),b=e.Record({browsers:y,devices:h}),l=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(l,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),w=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),x=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)}),v=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),T=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),enabled:e.Bool}),f=e.Record({stable:e.Nat64,heap:e.Nat64}),P=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),S=e.Record({controller:P,controllers:e.Vec(e.Principal)}),R=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)}),F=e.Variant({Ok:d,Err:e.Text}),C=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(u,e.Text))}),q=e.Record({version:e.Opt(e.Nat64),enabled:e.Bool}),O=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)}),z=e.Variant({Ok:x,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(u,d))],["query"]),get_page_views_analytics_clients:e.Func([a],[b],["query"]),get_page_views_analytics_metrics:e.Func([a],[m],["query"]),get_page_views_analytics_top_10:e.Func([a],[w],["query"]),get_track_events:e.Func([a],[e.Vec(e.Tuple(u,x))],["query"]),get_track_events_analytics:e.Func([a],[v],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,T))],["query"]),memory_size:e.Func([],[f],["query"]),set_controllers:e.Func([S],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([u,R],[F],[]),set_page_views:e.Func([e.Vec(e.Tuple(u,R))],[C],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,q))],[e.Vec(e.Tuple(e.Principal,T))],[]),set_track_event:e.Func([u,O],[z],[]),set_track_events:e.Func([e.Vec(e.Tuple(u,O))],[C],[]),version:e.Func([],[e.Text],["query"])})};var qt=({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}),u=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}),y=e.Variant({Callback:e.Record({token:d,callback:e.Func([],[],[])})}),h=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(y),status_code:e.Nat16}),b=e.Record({token:e.Opt(d),body:e.Vec(e.Nat8)}),l=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}),w=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),x=e.Record({field:w,desc:e.Bool}),v=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),T=e.Record({order:e.Opt(x),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(v)}),f=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),P=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),S=e.Record({key:f,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}),R=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,S))}),F=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),C=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,u))}),q=e.Variant({Db:e.Null,Storage:e.Null}),O=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),z=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:O,created_at:e.Nat64,write:O}),X=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),Z=e.Record({controller:X,controllers:e.Vec(e.Principal)}),H=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:O,write:O}),I=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),D=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(u)],["query"]),http_request:e.Func([p],[h],["query"]),http_request_streaming_callback:e.Func([d],[b],["query"]),init_asset_upload:e.Func([l],[m],[]),list_assets:e.Func([e.Opt(e.Text),T],[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,F))],["query"]),list_docs:e.Func([e.Text,T],[C],["query"]),list_rules:e.Func([q],[e.Vec(e.Tuple(e.Text,z))],["query"]),set_config:e.Func([a],[],[]),set_controllers:e.Func([Z],[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,H],[u],[]),set_rule:e.Func([q,e.Text,J],[],[]),upload_asset_chunk:e.Func([I],[D],[]),version:e.Func([],[e.Text],["query"])})};var $t=({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}),u=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}),y=e.Variant({Callback:e.Record({token:d,callback:e.Func([],[],[])})}),h=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(y),status_code:e.Nat16}),b=e.Record({token:e.Opt(d),body:e.Vec(e.Nat8)}),l=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}),w=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),x=e.Record({field:w,desc:e.Bool}),v=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),T=e.Record({order:e.Opt(x),matcher:e.Opt(e.Text),paginate:e.Opt(v)}),f=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),P=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),S=e.Record({key:f,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}),R=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,S))}),F=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),C=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,u))}),q=e.Variant({Db:e.Null,Storage:e.Null}),O=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),z=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:O,created_at:e.Nat64,write:O}),X=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),Z=e.Record({controller:X,controllers:e.Vec(e.Principal)}),H=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:O,write:O}),I=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),D=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(u)],["query"]),http_request:e.Func([p],[h],["query"]),http_request_streaming_callback:e.Func([d],[b],["query"]),init_asset_upload:e.Func([l],[m],[]),list_assets:e.Func([e.Opt(e.Text),T],[R],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,F))],["query"]),list_docs:e.Func([e.Text,T],[C],["query"]),list_rules:e.Func([q],[e.Vec(e.Tuple(e.Text,z))],["query"]),set_config:e.Func([a],[],[]),set_controllers:e.Func([Z],[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,H],[u],[]),set_rule:e.Func([q,e.Text,J],[],[]),upload_asset_chunk:e.Func([I],[D],[]),version:e.Func([],[e.Text],["query"])})};var Ut=({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.Variant({Write:e.Null,Admin:e.Null}),o=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:n,expires_at:e.Opt(e.Nat64)}),i=e.Record({version:e.Opt(e.Nat64)}),a=e.Variant({Db:e.Null,Storage:e.Null}),u=e.Record({cycles:e.Nat,destination_id:e.Principal}),p=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}),d=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),y=e.Record({key:p,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,d)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),h=e.Record({derivation_origin:e.Opt(e.Text)}),b=e.Record({internet_identity:e.Opt(h)}),l=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),m=e.Variant({Deny:e.Null,Allow:e.Null}),w=e.Record({status_code:e.Nat16,location:e.Text}),x=e.Record({iframe:e.Opt(l),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),raw_access:e.Opt(m),redirects:e.Opt(e.Vec(e.Tuple(e.Text,w)))}),v=e.Record({storage:x}),T=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)}),f=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)}),P=e.Variant({Heap:e.Null,Stable:e.Null}),S=e.Record({memory:P,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}),R=e.Variant({Callback:e.Record({token:S,callback:e.Func([],[],["query"])})}),F=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(R),status_code:e.Nat16}),C=e.Record({token:e.Opt(S),body:e.Vec(e.Nat8)}),q=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}),O=e.Record({batch_id:e.Nat}),z=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),X=e.Record({field:z,desc:e.Bool}),Z=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),H=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),J=e.Record({order:e.Opt(X),owner:e.Opt(e.Principal),matcher:e.Opt(Z),paginate:e.Opt(H)}),I=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,y)),items_length:e.Nat64}),D=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),Ge=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,T)),items_length:e.Nat64}),L=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Ye=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(P),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:L,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),write:L}),Qe=e.Record({stable:e.Nat64,heap:e.Nat64}),Xe=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),Ze=e.Record({controller:Xe,controllers:e.Vec(e.Principal)}),be=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),we=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(P),max_size:e.Opt(e.Nat),read:L,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),write:L}),de=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Ie=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],[e.Nat64],["query"]),count_docs:e.Func([e.Text],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),del_docs:e.Func([e.Text],[],[]),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,i))],[],[]),del_rule:e.Func([a,e.Text,i],[],[]),deposit_cycles:e.Func([u],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(y)],["query"]),get_auth_config:e.Func([],[e.Opt(b)],["query"]),get_config:e.Func([],[v],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(T)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(y)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(T)))],["query"]),http_request:e.Func([f],[F],["query"]),http_request_streaming_callback:e.Func([S],[C],["query"]),init_asset_upload:e.Func([q],[O],[]),list_assets:e.Func([e.Text,J],[I],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,D))],["query"]),list_docs:e.Func([e.Text,J],[Ge],["query"]),list_rules:e.Func([a],[e.Vec(e.Tuple(e.Text,Ye))],["query"]),memory_size:e.Func([],[Qe],["query"]),set_auth_config:e.Func([b],[],[]),set_config:e.Func([v],[],[]),set_controllers:e.Func([Ze],[e.Vec(e.Tuple(e.Principal,o))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_doc:e.Func([e.Text,e.Text,be],[T],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,be))],[e.Vec(e.Tuple(e.Text,T))],[]),set_rule:e.Func([a,e.Text,we],[],[]),upload_asset_chunk:e.Func([de],[Ie],[]),version:e.Func([],[e.Text],["query"])})};var Ht=async({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:$t}),E=async({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:Ut}),Kt=async({satelliteId:e,...t})=>pe({canisterId:e,...t,idlFactory:qt}),re=async({missionControlId:e,...t})=>pe({canisterId:e,...t,idlFactory:kt}),xe=async({orbiterId:e,...t})=>pe({canisterId:e,...t,idlFactory:Mt}),pe=async({canisterId:e,idlFactory:t,...r})=>{if(Rn(e))throw new Error("No canister ID provided.");return Le({canisterId:e,idlFactory:t,...r})},Wt=zt.fromText("aaaaa-aa"),jt=(e,t,r)=>{let n=t[0],o=Wt;return n&&typeof n=="object"&&n.canister_id&&(o=zt.from(n.canister_id)),{effectiveCanisterId:o}},Jt=e=>Le({canisterId:Wt.toText(),config:{callTransform:jt,queryTransform:jt},idlFactory:Bt,...e});var ee=async({actor:e,code:t})=>{let{install_code:r}=await Jt(e);return r({...t,sender_canister_version:[]})},Gt=async({canisterId:e,path:t,...r})=>{Fn(e,"A canister ID must be provided to request its status.");let n=await et(r);return(await Cn.request({canisterId:Sn.from(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]})).get(t)};var Yt=async({missionControl:e})=>(await re(e)).version(),Qt=async({missionControl:e})=>(await re(e)).get_user(),Xt=async({missionControl:e})=>(await re(e)).list_mission_control_controllers(),Zt=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await re(e)).set_satellites_controllers(t,r,n),It=async({missionControl:e,controllerIds:t,controller:r})=>(await re(e)).set_mission_control_controllers(t,r);import{Principal as On}from"@dfinity/principal";import{nonNullish as An,toNullable as En}from"@junobuild/utils";var tt=({controllerId:e,profile:t})=>({controllerIds:[On.fromText(e)],controller:Bn(t)}),Bn=e=>({metadata:An(e)&&e!==""?[["profile",e]]:[],expires_at:En(void 0),scope:{Admin:null}});var Q=At(vt(),1),gr=e=>Q.IDL.encode([Q.IDL.Record({user:Q.IDL.Principal})],[{user:e}]),Ke=e=>Q.IDL.encode([Q.IDL.Record({controllers:Q.IDL.Vec(Q.IDL.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var si=async e=>Yt(e),ai=async({missionControl:e,wasm_module:t})=>{let r=await Qt({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=gr(r);await ee({actor:o,code:{canister_id:co.fromText(n),arg:new Uint8Array(i),wasm_module:t,mode:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},ci=async({controllerId:e,profile:t,...r})=>Zt({...r,...tt({controllerId:e,profile:t})}),li=async({controllerId:e,profile:t,...r})=>It({...r,...tt({controllerId:e,profile:t})}),ui=e=>Xt(e);import{Principal as lo}from"@dfinity/principal";var Tr=async({orbiter:e})=>(await xe(e)).version(),Nt=async({orbiter:e})=>(await xe(e)).list_controllers(),br=async({orbiter:e})=>{let{memory_size:t}=await xe(e);return t()};var gi=async e=>Tr(e),Ti=async({orbiter:e,wasm_module:t,reset:r=!1})=>{let{orbiterId:n,...o}=e;if(!n)throw new Error("No orbiter principal defined.");let i=await Nt({orbiter:e}),a=Ke(i);await ee({actor:o,code:{canister_id:lo.fromText(n),arg:new Uint8Array(a),wasm_module:t,mode:r?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},bi=e=>br(e),wi=e=>Nt(e);import{major as wr,minor as xr,patch as vr}from"semver";var Ni=({currentVersion:e,selectedVersion:t})=>{let r=wr(e),n=wr(t),o=xr(e),i=xr(t),a=vr(e),u=vr(t);return r<n-1||o<i-1||a<u-1?{canUpgrade:!1}:{canUpgrade:!0}};var Te=At(vt(),1);import{Principal as Ir}from"@dfinity/principal";import{fromNullable as ue,isNullish as St,nonNullish as Je}from"@junobuild/utils";import{toNullable as uo}from"@junobuild/utils";var Nr=async({config:e,satellite:t})=>{let{set_config:r}=await E(t);return r(e)},Pr=async({config:e,satellite:t})=>{let{set_auth_config:r}=await E(t);return r(e)},Vr=async({satellite:e})=>{let{get_auth_config:t}=await E(e);return t()},Rr=async({satellite:e,type:t})=>(await E(e)).list_rules(t),Cr=async({type:e,collection:t,rule:r,satellite:n})=>(await E(n)).set_rule(e,t,r),Sr=async({satellite:e})=>{let{version:t}=await E(e);return t()},Fr=async({satellite:e})=>{let{build_version:t}=await E(e);return t()},Or=async({satellite:e})=>(await Ht(e)).list_controllers(),Pt=async({satellite:e})=>(await Kt(e)).list_controllers(),Vt=async({satellite:e})=>(await E(e)).list_controllers(),Ar=async({satellite:e})=>{let{list_custom_domains:t}=await E(e);return t()},Er=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await E(e);await n(t,uo(r))},Br=async({satellite:e})=>{let{memory_size:t}=await E(e);return t()},kr=async({collection:e,satellite:t})=>{let{count_docs:r}=await E(t);return r(e)},Mr=async({collection:e,satellite:t})=>{let{count_assets:r}=await E(t);return r(e)},qr=async({collection:e,satellite:t})=>{let{del_docs:r}=await E(t);return r(e)},$r=async({collection:e,satellite:t})=>{let{del_assets:r}=await E(t);return r(e)},Ur=async({args:e,satellite:t})=>{let{set_controllers:r}=await E(t);return r(e)};import{fromNullable as ge,nonNullish as le,toNullable as We}from"@junobuild/utils";var jr={Db:null},zr={Storage:null},Hr={Public:null},Kr={Private:null},Wr={Managed:null},Jr={Controllers:null},Rt={Heap:null},Gr={Stable:null};var Ct=e=>e==="storage"?zr:jr,Xr=({read:e,write:t,memory:r,maxSize:n,maxCapacity:o,version:i,mutablePermissions:a})=>({read:Qr(e),write:Qr(t),memory:le(r)?[po(r)]:[],version:We(i),max_size:We(le(n)&&n>0?BigInt(n):void 0),max_capacity:We(le(o)&&o>0?o:void 0),mutable_permissions:We(a)}),Zr=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:a,max_capacity:u,memory:p,mutable_permissions:d,version:y}=t,h=a?.[0]??0n>0n?Number(ge(a)):void 0,b=u?.[0]??!1?ge(u):void 0,l=ge(y);return{collection:e,read:Yr(r),write:Yr(n),memory:mo(ge(p)??Rt),updatedAt:o,createdAt:i,...le(l)&&{version:l},...le(h)&&{maxSize:h},...le(b)&&{maxCapacity:b},mutablePermissions:ge(d)??!0}},Yr=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",Qr=e=>{switch(e){case"public":return Hr;case"private":return Kr;case"managed":return Wr;default:return Jr}},po=e=>{switch(e.toLowerCase()){case"heap":return Rt;default:return Gr}},mo=e=>"Heap"in e?"heap":"stable";var Ui=async({config:{storage:{headers:e,rewrites:t,redirects:r,iframe:n,rawAccess:o}},satellite:i})=>{let a=(e??[]).map(({source:h,headers:b})=>[h,b]),u=(t??[]).map(({source:h,destination:b})=>[h,b]),p=(r??[]).map(({source:h,location:b,code:l})=>[h,{status_code:l,location:b}]);return Nr({satellite:i,config:{storage:{headers:a,rewrites:u,redirects:[p],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[o===!0?{Allow:null}:{Deny:null}]}}})},ji=async({config:{authentication:{internetIdentity:e}},...t})=>{await Pr({config:{internet_identity:St(e?.derivationOrigin)?[]:[{derivation_origin:[e.derivationOrigin]}]},...t})},zi=async({satellite:e})=>{let t=ue(await Vr({satellite:e}));if(St(t))return;let r=ue(t.internet_identity??[]);return{...Je(r)&&{internetIdentity:{...Je(ue(r.derivation_origin))&&{derivationOrigin:ue(r.derivation_origin)}}}}},Hi=async({type:e,satellite:t})=>(await Rr({satellite:t,type:Ct(e)})).map(n=>Zr(n)),Ki=async({rule:{collection:e,...t},type:r,satellite:n})=>Cr({type:Ct(r),rule:Xr(t),satellite:n,collection:e}),Wi=e=>Sr(e),Ji=e=>Fr(e),Gi=async({satellite:{satelliteId:e,...t}})=>{let r=await Gt({...t,canisterId:e,path:"juno:build"});return Je(r)&&["stock","extended"].includes(r)?r:void 0},Yi=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n,reset:o=!1})=>{let{satelliteId:i,...a}=e;if(St(i))throw new Error("No satellite principal defined.");if(r){let y=await Or({satellite:e}),h=Te.IDL.encode([Te.IDL.Record({controllers:Te.IDL.Vec(Te.IDL.Principal)})],[{controllers:y}]);await ee({actor:a,code:{canister_id:Ir.fromText(i),arg:new Uint8Array(h),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}});return}let p=await(n?Pt:Vt)({satellite:e}),d=Ke(p);await ee({actor:a,code:{canister_id:Ir.fromText(i),arg:new Uint8Array(d),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},Qi=async({satellite:e})=>(await Ar({satellite:e})).map(([r,n])=>{let o=ue(n.version);return{domain:r,bn_id:ue(n.bn_id),created_at:n.created_at,updated_at:n.updated_at,...Je(o)&&{version:o}}}),Xi=async({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>Er({satellite:e,domainName:r,boundaryNodesId:n}))),Zi=e=>Br(e),Ii=async e=>kr(e),Di=async e=>qr(e),Li=async e=>Mr(e),es=async e=>$r(e),ts=({deprecatedNoScope:e,...t})=>(e===!0?Pt:Vt)(t),rs=e=>Ur(e);export{Ni as checkUpgradeVersion,Li as countAssets,Ii as countDocs,es as deleteAssets,Di as deleteDocs,zi as getAuthConfig,Qi as listCustomDomains,ui as listMissionControlControllers,wi as listOrbiterControllers,Hi as listRules,ts as listSatelliteControllers,si as missionControlVersion,bi as orbiterMemorySize,gi as orbiterVersion,Gi as satelliteBuildType,Ji as satelliteBuildVersion,Zi as satelliteMemorySize,Wi as satelliteVersion,ji as setAuthConfig,Ui as setConfig,Xi as setCustomDomains,li as setMissionControlController,Ki as setRule,rs as setSatelliteControllers,ci as setSatellitesController,ai as upgradeMissionControl,Ti as upgradeOrbiter,Yi as upgradeSatellite};
|
|
15
|
+
`)}return p.encodeValue(d)}));return(0,h.concat)(n,o,i,a,u)}s.encode=In;function Dn(e,t){let r=new h.PipeArrayBuffer(t);if(t.byteLength<Se.length)throw new Error("Message length smaller than magic number");let n=(0,c.safeRead)(r,Se.length),o=new TextDecoder().decode(n);if(o!==Se)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(l){let m=[],T=Number((0,c.lebDecode)(l));for(let w=0;w<T;w++){let f=Number((0,c.slebDecode)(l));switch(f){case-18:case-19:{let S=Number((0,c.slebDecode)(l));m.push([f,S]);break}case-20:case-21:{let S=[],R=Number((0,c.lebDecode)(l)),F;for(;R--;){let C=Number((0,c.lebDecode)(l));if(C>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof F=="number"&&F>=C)throw new Error("field id collision or not sorted");F=C;let P=Number((0,c.slebDecode)(l));S.push([C,P])}m.push([f,S]);break}case-22:{let S=[],R=Number((0,c.lebDecode)(l));for(;R--;)S.push(Number((0,c.slebDecode)(l)));let F=[],C=Number((0,c.lebDecode)(l));for(;C--;)F.push(Number((0,c.slebDecode)(l)));let P=[],q=Number((0,c.lebDecode)(l));for(;q--;)switch(Number((0,c.lebDecode)(l))){case 1:{P.push("query");break}case 2:{P.push("oneway");break}case 3:{P.push("composite_query");break}default:throw new Error("unknown annotation")}m.push([f,[S,F,P]]);break}case-23:{let S=Number((0,c.lebDecode)(l)),R=[];for(;S--;){let F=Number((0,c.lebDecode)(l)),C=new TextDecoder().decode((0,c.safeRead)(l,F)),P=(0,c.slebDecode)(l);R.push([C,P])}m.push([f,R]);break}default:throw new Error("Illegal op_code: "+f)}}let x=[],N=Number((0,c.lebDecode)(l));for(let w=0;w<N;w++)x.push(Number((0,c.slebDecode)(l)));return[m,x]}let[a,u]=i(r);if(u.length<e.length)throw new Error("Wrong number of return values");let p=a.map(l=>fr());function d(l){if(l<-24)throw new Error("future value not supported");if(l<0)switch(l){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: "+l)}if(l>=a.length)throw new Error("type index out of range");return p[l]}function y(l){switch(l[0]){case-19:{let m=d(l[1]);return dr(m)}case-18:{let m=d(l[1]);return pr(m)}case-20:{let m={};for(let[N,w]of l[1]){let f=`_${N}_`;m[f]=d(w)}let T=mr(m),x=T.tryAsTuple();return Array.isArray(x)?ur(...x):T}case-21:{let m={};for(let[T,x]of l[1]){let N=`_${T}_`;m[N]=d(x)}return _r(m)}case-22:{let[m,T,x]=l[1];return hr(m.map(N=>d(N)),T.map(N=>d(N)),x)}case-23:{let m={},T=l[1];for(let[x,N]of T){let w=d(N);if(w instanceof J&&(w=w.getType()),!(w instanceof ge))throw new Error("Illegal service definition: services can only contain functions");m[x]=w}return yr(m)}default:throw new Error("Illegal op_code: "+l[0])}}a.forEach((l,m)=>{if(l[0]===-22){let T=y(l);p[m].fill(T)}}),a.forEach((l,m)=>{if(l[0]!==-22){let T=y(l);p[m].fill(T)}});let g=u.map(l=>d(l)),b=e.map((l,m)=>l.decodeValue(r,g[m]));for(let l=e.length;l<g.length;l++)g[l].decodeValue(r,g[l]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return b}s.decode=Dn;s.Empty=new Fe;s.Reserved=new se;s.Unknown=new Oe;s.Bool=new Ae;s.Null=new Ee;s.Text=new Be;s.Int=new ke;s.Nat=new Me;s.Float32=new he(32);s.Float64=new he(64);s.Int8=new W(8);s.Int16=new W(16);s.Int32=new W(32);s.Int64=new W(64);s.Nat8=new U(8);s.Nat16=new U(16);s.Nat32=new U(32);s.Nat64=new U(64);s.Principal=new je;function ur(...e){return new $e(e)}s.Tuple=ur;function dr(e){return new qe(e)}s.Vec=dr;function pr(e){return new ae(e)}s.Opt=pr;function mr(e){return new ye(e)}s.Record=mr;function _r(e){return new Ue(e)}s.Variant=_r;function fr(){return new J}s.Rec=fr;function hr(e,t,r=[]){return new ge(e,t,r)}s.Func=hr;function yr(e){return new ze(e)}s.Service=yr});var bt=K(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.VecForm=B.OptionForm=B.VariantForm=B.TupleForm=B.RecordForm=B.InputForm=B.InputBox=void 0;var _t=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)}};B.InputBox=_t;var Y=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)}};B.InputForm=Y;var ft=class extends Y{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}};B.RecordForm=ft;var ht=class extends Y{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}};B.TupleForm=ht;var yt=class extends Y{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}};B.VariantForm=yt;var gt=class extends Y{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]}}};B.OptionForm=gt;var Tt=class extends Y{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}};B.VecForm=Tt});var Tr=K(_=>{"use strict";var Ln=_&&_.__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=_&&_.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),gr=_&&_.__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(_,"__esModule",{value:!0});_.renderValue=_.renderInput=_.Render=_.vecForm=_.optForm=_.variantForm=_.tupleForm=_.recordForm=_.inputBox=void 0;var Ke=gr(mt()),wt=Mt("@dfinity/principal"),ce=gr(bt()),to={parse:co},Te={render:Pt},ro=(e,t)=>new ce.InputBox(e,Object.assign(Object.assign({},to),t));_.inputBox=ro;var no=(e,t)=>new ce.RecordForm(e,Object.assign(Object.assign({},Te),t));_.recordForm=no;var oo=(e,t)=>new ce.TupleForm(e,Object.assign(Object.assign({},Te),t));_.tupleForm=oo;var io=(e,t)=>new ce.VariantForm(e,Object.assign(Object.assign({},Te),t));_.variantForm=io;var so=(e,t)=>new ce.OptionForm(e,Object.assign(Object.assign({},Te),t));_.optForm=so;var ao=(e,t)=>new ce.VecForm(e,Object.assign(Object.assign({},Te),t));_.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,_.inputBox)(t,{input:n})}visitNull(t,r){return(0,_.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,_.recordForm)(r,o);return(0,_.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,_.tupleForm)(r,o);return(0,_.inputBox)(t,{form:i})}visitVariant(t,r,n){let o=document.createElement("select");for(let[u,p]of r){let d=new Option(u);o.add(d)}o.selectedIndex=-1,o.classList.add("open");let i={open:o,event:"change"},a=(0,_.variantForm)(r,i);return(0,_.inputBox)(t,{form:a})}visitOpt(t,r,n){let o=document.createElement("input");o.type="checkbox",o.classList.add("open");let i=(0,_.optForm)(r,{open:o,event:"change"});return(0,_.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,_.vecForm)(r,{open:o,event:"change",container:i});return(0,_.inputBox)(t,{form:a})}visitRec(t,r,n){return Pt(r)}};_.Render=He;var xt=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 wt.Principal.fromText(r)}visitService(t,r){return wt.Principal.fromText(r)}visitFunc(t,r){let n=r.split(".",2);return[wt.Principal.fromText(n[0]),n[1]]}},vt=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 vt,r):e.accept(new xt,r)}function Pt(e){return e.accept(new He,null)}_.renderInput=Pt;function ee(e,t,r){return e.accept(new Nt,{input:t,value:r})}_.renderValue=ee;var Nt=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){ee(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)),ee(r,o.form[0],n.value[0])}}visitRecord(t,r,n){let o=n.input.ui.form;r.forEach(([i,a],u)=>{ee(a,o.form[u],n.value[i])})}visitTuple(t,r,n){let o=n.input.ui.form;r.forEach((i,a)=>{ee(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,u],p)=>{if(a===i[0]){let d=o.ui.open;d.selectedIndex=p,d.dispatchEvent(new Event(o.ui.event)),ee(u,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((u,p)=>{ee(r,o.form[p],u)})}}});var wr=K(br=>{"use strict";Object.defineProperty(br,"__esModule",{value:!0})});var Vt=K(E=>{"use strict";var xr=E&&E.__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=E&&E.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),le=E&&E.__exportStar||function(e,t){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(t,r)&&xr(t,e,r)},uo=E&&E.__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)&&xr(t,e,r);return lo(t,e),t};Object.defineProperty(E,"__esModule",{value:!0});E.IDL=void 0;le(Tr(),E);le(bt(),E);E.IDL=uo(mt());le(st(),E);le(ct(),E);le(Ve(),E);le(wr(),E)});import{Principal as po}from"@dfinity/principal";import{CanisterStatus as On}from"@dfinity/agent";import{Principal as An}from"@dfinity/principal";import{assertNonNullish as En}from"@junobuild/utils";import{Actor as Cn,HttpAgent as Sn}from"@dfinity/agent";import{nonNullish as $t}from"@junobuild/utils";var rt=async({canisterId:e,idlFactory:t,config:r,...n})=>{let o=await nt(n);return Cn.createActor(t,{agent:o,canisterId:e,...r!==void 0?r:{}})},nt=async({identity:e,fetch:t,container:r})=>{let n=$t(r)&&r!==!1,o=n?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io",i=new Sn({identity:e,host:o,retryTimes:10,...$t(t)&&{fetch:t}});return n&&await i.fetchRootKey(),i};import{Principal as Jt}from"@dfinity/principal";import{isNullish as Fn}from"@junobuild/utils";var Ut=({IDL:e})=>{let t=e.Variant({mainnet:e.Null,testnet:e.Null}),r=e.Text,n=e.Record({network:t,address:r,min_confirmations:e.Opt(e.Nat32)}),o=e.Nat64,i=o,a=e.Record({network:t,address:r,min_confirmations:e.Opt(e.Nat32)}),u=o,p=e.Record({network:t}),d=e.Nat64,y=e.Vec(d),g=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),b=e.Vec(e.Nat8),l=e.Record({txid:e.Vec(e.Nat8),vout:e.Nat32}),m=e.Record({height:e.Nat32,value:o,outpoint:l}),T=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:b,utxos:e.Vec(m)}),x=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),N=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:b,utxos:e.Vec(m)}),w=e.Record({transaction:e.Vec(e.Nat8),network:t}),f=e.Principal,S=e.Record({canister_id:f,num_requested_changes:e.Opt(e.Nat64)}),R=e.Variant({from_user:e.Record({user_id:e.Principal}),from_canister:e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal})}),F=e.Variant({creation:e.Record({controllers:e.Vec(e.Principal)}),code_deployment:e.Record({mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),module_hash:e.Vec(e.Nat8)}),controllers_change:e.Record({controllers:e.Vec(e.Principal)}),code_uninstall:e.Null}),C=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:R,details:F}),P=e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(C),total_num_changes:e.Nat64}),q=e.Record({canister_id:f}),O=e.Variant({controllers:e.Null,public:e.Null}),z=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Nat,log_visibility:O,memory_allocation:e.Nat,compute_allocation:e.Nat}),X=e.Record({status:e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),memory_size:e.Nat,cycles:e.Nat,settings:z,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Nat}),Z=e.Record({canister_id:f}),H=e.Record({freezing_threshold:e.Opt(e.Nat),controllers:e.Opt(e.Vec(e.Principal)),reserved_cycles_limit:e.Opt(e.Nat),log_visibility:e.Opt(O),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),I=e.Record({settings:e.Opt(H),sender_canister_version:e.Opt(e.Nat64)}),G=e.Record({canister_id:f}),D=e.Record({canister_id:f}),Ye=e.Record({canister_id:f}),pe=e.Variant({secp256k1:e.Null}),Qe=e.Record({key_id:e.Record({name:e.Text,curve:pe}),canister_id:e.Opt(f),derivation_path:e.Vec(e.Vec(e.Nat8))}),Xe=e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)}),Ze=e.Record({canister_id:f}),te=e.Record({idx:e.Nat64,timestamp_nanos:e.Nat64,content:e.Vec(e.Nat8)}),Ie=e.Record({canister_log_records:e.Vec(te)}),xe=e.Record({value:e.Text,name:e.Text}),me=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(xe)}),De=e.Record({url:e.Text,method:e.Variant({get:e.Null,head:e.Null,post:e.Null}),max_response_bytes:e.Opt(e.Nat64),body:e.Opt(e.Vec(e.Nat8)),transform:e.Opt(e.Record({function:e.Func([e.Record({context:e.Vec(e.Nat8),response:me})],[me],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(xe)}),re=e.Vec(e.Nat8),Le=e.Record({arg:e.Vec(e.Nat8),wasm_module_hash:e.Vec(e.Nat8),mode:e.Variant({reinstall:e.Null,upgrade:e.Opt(e.Record({skip_pre_upgrade:e.Opt(e.Bool)})),install:e.Null}),chunk_hashes_list:e.Vec(re),target_canister:f,sender_canister_version:e.Opt(e.Nat64),storage_canister:e.Opt(f)}),et=e.Vec(e.Nat8),tt=e.Record({arg:e.Vec(e.Nat8),wasm_module:et,mode:e.Variant({reinstall:e.Null,upgrade:e.Opt(e.Record({skip_pre_upgrade:e.Opt(e.Bool)})),install:e.Null}),canister_id:f,sender_canister_version:e.Opt(e.Nat64)}),on=e.Record({start_at_timestamp_nanos:e.Nat64,subnet_id:e.Principal}),sn=e.Record({num_block_failures_total:e.Nat64,node_id:e.Principal,num_blocks_total:e.Nat64}),an=e.Vec(e.Record({timestamp_nanos:e.Nat64,node_metrics:e.Vec(sn)})),cn=e.Record({settings:e.Opt(H),specified_id:e.Opt(f),amount:e.Opt(e.Nat),sender_canister_version:e.Opt(e.Nat64)}),ln=e.Record({canister_id:f}),un=e.Record({canister_id:f,amount:e.Nat}),dn=e.Vec(e.Nat8),pn=e.Record({key_id:e.Record({name:e.Text,curve:pe}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)}),mn=e.Record({signature:e.Vec(e.Nat8)}),_n=e.Record({canister_id:f}),fn=e.Record({canister_id:f}),hn=e.Record({canister_id:f}),yn=e.Vec(re),gn=e.Record({canister_id:f,sender_canister_version:e.Opt(e.Nat64)}),Tn=e.Record({canister_id:e.Principal,settings:H,sender_canister_version:e.Opt(e.Nat64)}),bn=e.Record({chunk:e.Vec(e.Nat8),canister_id:e.Principal}),wn=re;return e.Service({bitcoin_get_balance:e.Func([n],[i],[]),bitcoin_get_balance_query:e.Func([a],[u],["query"]),bitcoin_get_current_fee_percentiles:e.Func([p],[y],[]),bitcoin_get_utxos:e.Func([g],[T],[]),bitcoin_get_utxos_query:e.Func([x],[N],["query"]),bitcoin_send_transaction:e.Func([w],[],[]),canister_info:e.Func([S],[P],[]),canister_status:e.Func([q],[X],[]),clear_chunk_store:e.Func([Z],[],[]),create_canister:e.Func([I],[G],[]),delete_canister:e.Func([D],[],[]),deposit_cycles:e.Func([Ye],[],[]),ecdsa_public_key:e.Func([Qe],[Xe],[]),fetch_canister_logs:e.Func([Ze],[Ie],["query"]),http_request:e.Func([De],[me],[]),install_chunked_code:e.Func([Le],[],[]),install_code:e.Func([tt],[],[]),node_metrics_history:e.Func([on],[an],[]),provisional_create_canister_with_cycles:e.Func([cn],[ln],[]),provisional_top_up_canister:e.Func([un],[],[]),raw_rand:e.Func([],[dn],[]),sign_with_ecdsa:e.Func([pn],[mn],[]),start_canister:e.Func([_n],[],[]),stop_canister:e.Func([fn],[],[]),stored_chunks:e.Func([hn],[yn],[]),uninstall_code:e.Func([gn],[],[]),update_settings:e.Func([Tn],[],[]),upload_chunk:e.Func([bn],[wn],[])})};var jt=({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({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),n=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Variant({Write:e.Null,Admin:e.Null}),i=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:o,expires_at:e.Opt(e.Nat64)}),a=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),u=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),p=e.Record({status:a,memory_size:e.Nat,cycles:e.Nat,settings:u,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),d=e.Record({id:e.Principal,status:p,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),y=e.Variant({Ok:d,Err:e.Text}),g=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:o,expires_at:e.Opt(e.Nat64)}),b=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),l=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,b)),satellites:e.Vec(e.Tuple(e.Principal,b)),cycles_threshold:e.Opt(e.Nat64)}),m=e.Record({orbiters:e.Opt(e.Vec(y)),satellites:e.Opt(e.Vec(y)),mission_control:y}),T=e.Record({e8s:e.Nat64});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_satellite:e.Func([e.Text],[r],[]),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([n],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,i))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,y))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,y)))],["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,y)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,r))],["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),g],[],[]),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),g],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[r],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[r],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),g],[],[]),status:e.Func([l],[m],[]),top_up:e.Func([e.Principal,T],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),version:e.Func([],[e.Text],["query"])})};var zt=({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)}),u=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)}),y=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),g=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),b=e.Record({browsers:y,devices:g}),l=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(l,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),T=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),x=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)}),N=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),w=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),enabled:e.Bool}),f=e.Record({stable:e.Nat64,heap:e.Nat64}),S=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),R=e.Record({controller:S,controllers:e.Vec(e.Principal)}),F=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)}),C=e.Variant({Ok:d,Err:e.Text}),P=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(u,e.Text))}),q=e.Record({version:e.Opt(e.Nat64),enabled:e.Bool}),O=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)}),z=e.Variant({Ok:x,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(u,d))],["query"]),get_page_views_analytics_clients:e.Func([a],[b],["query"]),get_page_views_analytics_metrics:e.Func([a],[m],["query"]),get_page_views_analytics_top_10:e.Func([a],[T],["query"]),get_track_events:e.Func([a],[e.Vec(e.Tuple(u,x))],["query"]),get_track_events_analytics:e.Func([a],[N],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,w))],["query"]),memory_size:e.Func([],[f],["query"]),set_controllers:e.Func([R],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([u,F],[C],[]),set_page_views:e.Func([e.Vec(e.Tuple(u,F))],[P],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,q))],[e.Vec(e.Tuple(e.Principal,w))],[]),set_track_event:e.Func([u,O],[z],[]),set_track_events:e.Func([e.Vec(e.Tuple(u,O))],[P],[]),version:e.Func([],[e.Text],["query"])})};var Ht=({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}),u=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}),y=e.Variant({Callback:e.Record({token:d,callback:e.Func([],[],[])})}),g=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(y),status_code:e.Nat16}),b=e.Record({token:e.Opt(d),body:e.Vec(e.Nat8)}),l=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}),T=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),x=e.Record({field:T,desc:e.Bool}),N=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),w=e.Record({order:e.Opt(x),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(N)}),f=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),S=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),R=e.Record({key:f,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,S)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),F=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,R))}),C=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,u))}),q=e.Variant({Db:e.Null,Storage:e.Null}),O=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),z=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:O,created_at:e.Nat64,write:O}),X=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),Z=e.Record({controller:X,controllers:e.Vec(e.Principal)}),H=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),I=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:O,write:O}),G=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),D=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(u)],["query"]),http_request:e.Func([p],[g],["query"]),http_request_streaming_callback:e.Func([d],[b],["query"]),init_asset_upload:e.Func([l],[m],[]),list_assets:e.Func([e.Opt(e.Text),w],[F],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,C))],["query"]),list_docs:e.Func([e.Text,w],[P],["query"]),list_rules:e.Func([q],[e.Vec(e.Tuple(e.Text,z))],["query"]),set_config:e.Func([a],[],[]),set_controllers:e.Func([Z],[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,H],[u],[]),set_rule:e.Func([q,e.Text,I],[],[]),upload_asset_chunk:e.Func([G],[D],[]),version:e.Func([],[e.Text],["query"])})};var Kt=({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}),u=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}),y=e.Variant({Callback:e.Record({token:d,callback:e.Func([],[],[])})}),g=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(y),status_code:e.Nat16}),b=e.Record({token:e.Opt(d),body:e.Vec(e.Nat8)}),l=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}),T=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),x=e.Record({field:T,desc:e.Bool}),N=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),w=e.Record({order:e.Opt(x),matcher:e.Opt(e.Text),paginate:e.Opt(N)}),f=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),S=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),R=e.Record({key:f,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,S)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),F=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,R))}),C=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,u))}),q=e.Variant({Db:e.Null,Storage:e.Null}),O=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),z=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:O,created_at:e.Nat64,write:O}),X=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),Z=e.Record({controller:X,controllers:e.Vec(e.Principal)}),H=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),I=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:O,write:O}),G=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),D=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(u)],["query"]),http_request:e.Func([p],[g],["query"]),http_request_streaming_callback:e.Func([d],[b],["query"]),init_asset_upload:e.Func([l],[m],[]),list_assets:e.Func([e.Opt(e.Text),w],[F],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,C))],["query"]),list_docs:e.Func([e.Text,w],[P],["query"]),list_rules:e.Func([q],[e.Vec(e.Tuple(e.Text,z))],["query"]),set_config:e.Func([a],[],[]),set_controllers:e.Func([Z],[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,H],[u],[]),set_rule:e.Func([q,e.Text,I],[],[]),upload_asset_chunk:e.Func([G],[D],[]),version:e.Func([],[e.Text],["query"])})};var Wt=({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.Variant({Write:e.Null,Admin:e.Null}),o=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:n,expires_at:e.Opt(e.Nat64)}),i=e.Record({version:e.Opt(e.Nat64)}),a=e.Variant({Db:e.Null,Storage:e.Null}),u=e.Record({version:e.Opt(e.Nat64)}),p=e.Record({cycles:e.Nat,destination_id:e.Principal}),d=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}),y=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),g=e.Record({key:d,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,y)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),b=e.Record({derivation_origin:e.Opt(e.Text)}),l=e.Record({internet_identity:e.Opt(b)}),m=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),T=e.Record({max_memory_size:e.Opt(m)}),x=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),N=e.Variant({Deny:e.Null,Allow:e.Null}),w=e.Record({status_code:e.Nat16,location:e.Text}),f=e.Record({iframe:e.Opt(x),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(m),raw_access:e.Opt(N),redirects:e.Opt(e.Vec(e.Tuple(e.Text,w)))}),S=e.Record({db:e.Opt(T),authentication:e.Opt(l),storage:f}),R=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)}),F=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)}),C=e.Variant({Heap:e.Null,Stable:e.Null}),P=e.Record({memory:C,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}),q=e.Variant({Callback:e.Record({token:P,callback:e.Func([],[],["query"])})}),O=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(q),status_code:e.Nat16}),z=e.Record({token:e.Opt(P),body:e.Vec(e.Nat8)}),X=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}),Z=e.Record({batch_id:e.Nat}),H=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),I=e.Record({field:H,desc:e.Bool}),G=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),D=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(G),description:e.Opt(e.Text),created_at:e.Opt(G)}),Ye=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),pe=e.Record({order:e.Opt(I),owner:e.Opt(e.Principal),matcher:e.Opt(D),paginate:e.Opt(Ye)}),Qe=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,g)),items_length:e.Nat64}),Xe=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),Ze=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,R)),items_length:e.Nat64}),te=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Ie=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(C),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:te,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),write:te}),xe=e.Record({stable:e.Nat64,heap:e.Nat64}),me=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),De=e.Record({controller:me,controllers:e.Vec(e.Principal)}),re=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Le=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(C),max_size:e.Opt(e.Nat),read:te,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),write:te}),et=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),tt=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],[e.Nat64],["query"]),count_docs:e.Func([e.Text],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),del_docs:e.Func([e.Text],[],[]),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,i))],[],[]),del_rule:e.Func([a,e.Text,u],[],[]),deposit_cycles:e.Func([p],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(g)],["query"]),get_auth_config:e.Func([],[e.Opt(l)],["query"]),get_config:e.Func([],[S],[]),get_db_config:e.Func([],[e.Opt(T)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(R)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(g)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(R)))],["query"]),get_storage_config:e.Func([],[f],["query"]),http_request:e.Func([F],[O],["query"]),http_request_streaming_callback:e.Func([P],[z],["query"]),init_asset_upload:e.Func([X],[Z],[]),list_assets:e.Func([e.Text,pe],[Qe],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,Xe))],["query"]),list_docs:e.Func([e.Text,pe],[Ze],["query"]),list_rules:e.Func([a],[e.Vec(e.Tuple(e.Text,Ie))],["query"]),memory_size:e.Func([],[xe],["query"]),set_auth_config:e.Func([l],[],[]),set_controllers:e.Func([De],[e.Vec(e.Tuple(e.Principal,o))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([T],[],[]),set_doc:e.Func([e.Text,e.Text,re],[R],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,re))],[e.Vec(e.Tuple(e.Text,R))],[]),set_rule:e.Func([a,e.Text,Le],[],[]),set_storage_config:e.Func([f],[],[]),upload_asset_chunk:e.Func([et],[tt],[]),version:e.Func([],[e.Text],["query"])})};var Yt=async({satelliteId:e,...t})=>_e({canisterId:e,...t,idlFactory:Kt}),A=async({satelliteId:e,...t})=>_e({canisterId:e,...t,idlFactory:Wt}),Qt=async({satelliteId:e,...t})=>_e({canisterId:e,...t,idlFactory:Ht}),ne=async({missionControlId:e,...t})=>_e({canisterId:e,...t,idlFactory:jt}),ve=async({orbiterId:e,...t})=>_e({canisterId:e,...t,idlFactory:zt}),_e=async({canisterId:e,idlFactory:t,...r})=>{if(Fn(e))throw new Error("No canister ID provided.");return rt({canisterId:e,idlFactory:t,...r})},Xt=Jt.fromText("aaaaa-aa"),Gt=(e,t,r)=>{let n=t[0],o=Xt;return n&&typeof n=="object"&&n.canister_id&&(o=Jt.from(n.canister_id)),{effectiveCanisterId:o}},Zt=e=>rt({canisterId:Xt.toText(),config:{callTransform:Gt,queryTransform:Gt},idlFactory:Ut,...e});var L=async({actor:e,code:t})=>{let{install_code:r}=await Zt(e);return r({...t,sender_canister_version:[]})},It=async({canisterId:e,path:t,...r})=>{En(e,"A canister ID must be provided to request its status.");let n=await nt(r);return(await On.request({canisterId:An.from(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]})).get(t)};var Dt=async({missionControl:e})=>(await ne(e)).version(),Lt=async({missionControl:e})=>(await ne(e)).get_user(),er=async({missionControl:e})=>(await ne(e)).list_mission_control_controllers(),tr=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await ne(e)).set_satellites_controllers(t,r,n),rr=async({missionControl:e,controllerIds:t,controller:r})=>(await ne(e)).set_mission_control_controllers(t,r);import{Principal as Bn}from"@dfinity/principal";import{nonNullish as kn,toNullable as Mn}from"@junobuild/utils";var ot=({controllerId:e,profile:t})=>({controllerIds:[Bn.fromText(e)],controller:qn(t)}),qn=e=>({metadata:kn(e)&&e!==""?[["profile",e]]:[],expires_at:Mn(void 0),scope:{Admin:null}});var Q=qt(Vt(),1),vr=e=>Q.IDL.encode([Q.IDL.Record({user:Q.IDL.Principal})],[{user:e}]),We=e=>Q.IDL.encode([Q.IDL.Record({controllers:Q.IDL.Vec(Q.IDL.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var ui=async e=>Dt(e),di=async({missionControl:e,wasm_module:t})=>{let r=await Lt({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=vr(r);await L({actor:o,code:{canister_id:po.fromText(n),arg:new Uint8Array(i),wasm_module:t,mode:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},pi=async({controllerId:e,profile:t,...r})=>tr({...r,...ot({controllerId:e,profile:t})}),mi=async({controllerId:e,profile:t,...r})=>rr({...r,...ot({controllerId:e,profile:t})}),_i=e=>er(e);import{Principal as mo}from"@dfinity/principal";var Nr=async({orbiter:e})=>(await ve(e)).version(),Rt=async({orbiter:e})=>(await ve(e)).list_controllers(),Pr=async({orbiter:e})=>{let{memory_size:t}=await ve(e);return t()};var xi=async e=>Nr(e),vi=async({orbiter:e,wasm_module:t,reset:r=!1})=>{let{orbiterId:n,...o}=e;if(!n)throw new Error("No orbiter principal defined.");let i=await Rt({orbiter:e}),a=We(i);await L({actor:o,code:{canister_id:mo.fromText(n),arg:new Uint8Array(a),wasm_module:t,mode:r?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},Ni=e=>Pr(e),Pi=e=>Rt(e);import{major as Vr,minor as Rr,patch as Cr}from"semver";var Ci=({currentVersion:e,selectedVersion:t})=>{let r=Vr(e),n=Vr(t),o=Rr(e),i=Rr(t),a=Cr(e),u=Cr(t);return r<n-1||o<i-1||a<u-1?{canUpgrade:!1}:{canUpgrade:!0}};var we=qt(Vt(),1);import{Principal as nn}from"@dfinity/principal";import{fromNullable as de,isNullish as Bt,nonNullish as Je}from"@junobuild/utils";import{toNullable as _o}from"@junobuild/utils";var Sr=async({config:e,satellite:t})=>{let{set_storage_config:r}=await A(t);return r(e)},Fr=async({config:e,satellite:t})=>{let{set_db_config:r}=await A(t);return r(e)},Or=async({config:e,satellite:t})=>{let{set_auth_config:r}=await A(t);return r(e)};var Ar=async({satellite:e})=>{let{get_auth_config:t}=await A(e);return t()},Er=async({satellite:e,type:t})=>(await A(e)).list_rules(t),Br=async({type:e,collection:t,rule:r,satellite:n})=>(await A(n)).set_rule(e,t,r),kr=async({satellite:e})=>{let{version:t}=await A(e);return t()},Mr=async({satellite:e})=>{let{build_version:t}=await A(e);return t()},qr=async({satellite:e})=>(await Yt(e)).list_controllers(),Ct=async({satellite:e})=>(await Qt(e)).list_controllers(),St=async({satellite:e})=>(await A(e)).list_controllers(),$r=async({satellite:e})=>{let{list_custom_domains:t}=await A(e);return t()},Ur=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await A(e);await n(t,_o(r))},jr=async({satellite:e})=>{let{memory_size:t}=await A(e);return t()},zr=async({collection:e,satellite:t})=>{let{count_docs:r}=await A(t);return r(e)},Hr=async({collection:e,satellite:t})=>{let{count_assets:r}=await A(t);return r(e)},Kr=async({collection:e,satellite:t})=>{let{del_docs:r}=await A(t);return r(e)},Wr=async({collection:e,satellite:t})=>{let{del_assets:r}=await A(t);return r(e)},Gr=async({args:e,satellite:t})=>{let{set_controllers:r}=await A(t);return r(e)};import{nonNullish as fo,toNullable as Ft}from"@junobuild/utils";var Ot=e=>Ft(fo(e)?{heap:Ft(e.heap),stable:Ft(e.stable)}:void 0);import{fromNullable as be,nonNullish as ue,toNullable as Ge}from"@junobuild/utils";var Jr={Db:null},Yr={Storage:null},Qr={Public:null},Xr={Private:null},Zr={Managed:null},Ir={Controllers:null},At={Heap:null},Dr={Stable:null};var Et=e=>e==="storage"?Yr:Jr,tn=({read:e,write:t,memory:r,maxSize:n,maxCapacity:o,version:i,mutablePermissions:a})=>({read:en(e),write:en(t),memory:ue(r)?[ho(r)]:[],version:Ge(i),max_size:Ge(ue(n)&&n>0?BigInt(n):void 0),max_capacity:Ge(ue(o)&&o>0?o:void 0),mutable_permissions:Ge(a)}),rn=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:a,max_capacity:u,memory:p,mutable_permissions:d,version:y}=t,g=a?.[0]??0n>0n?Number(be(a)):void 0,b=u?.[0]??!1?be(u):void 0,l=be(y);return{collection:e,read:Lr(r),write:Lr(n),memory:yo(be(p)??At),updatedAt:o,createdAt:i,...ue(l)&&{version:l},...ue(g)&&{maxSize:g},...ue(b)&&{maxCapacity:b},mutablePermissions:be(d)??!0}},Lr=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",en=e=>{switch(e){case"public":return Qr;case"private":return Xr;case"managed":return Zr;default:return Ir}},ho=e=>{switch(e.toLowerCase()){case"heap":return At;default:return Dr}},yo=e=>"Heap"in e?"heap":"stable";var Ji=async({config:{headers:e,rewrites:t,redirects:r,iframe:n,rawAccess:o,maxMemorySize:i},satellite:a})=>{let u=(e??[]).map(({source:b,headers:l})=>[b,l]),p=(t??[]).map(({source:b,destination:l})=>[b,l]),d=(r??[]).map(({source:b,location:l,code:m})=>[b,{status_code:m,location:l}]);return Sr({satellite:a,config:{headers:u,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:Ot(i)}})},Yi=async({config:{maxMemorySize:e},...t})=>{await Fr({config:{max_memory_size:Ot(e)},...t})},Qi=async({config:{internetIdentity:e},...t})=>{await Or({config:{internet_identity:Bt(e?.derivationOrigin)?[]:[{derivation_origin:[e.derivationOrigin]}]},...t})},Xi=async({satellite:e})=>{let t=de(await Ar({satellite:e}));if(Bt(t))return;let r=de(t.internet_identity??[]);return{...Je(r)&&{internetIdentity:{...Je(de(r.derivation_origin))&&{derivationOrigin:de(r.derivation_origin)}}}}},Zi=async({type:e,satellite:t})=>(await Er({satellite:t,type:Et(e)})).map(n=>rn(n)),Ii=async({rule:{collection:e,...t},type:r,satellite:n})=>Br({type:Et(r),rule:tn(t),satellite:n,collection:e}),Di=e=>kr(e),Li=e=>Mr(e),es=async({satellite:{satelliteId:e,...t}})=>{let r=await It({...t,canisterId:e,path:"juno:build"});return Je(r)&&["stock","extended"].includes(r)?r:void 0},ts=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n,reset:o=!1})=>{let{satelliteId:i,...a}=e;if(Bt(i))throw new Error("No satellite principal defined.");if(r){let y=await qr({satellite:e}),g=we.IDL.encode([we.IDL.Record({controllers:we.IDL.Vec(we.IDL.Principal)})],[{controllers:y}]);await L({actor:a,code:{canister_id:nn.fromText(i),arg:new Uint8Array(g),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}});return}let p=await(n?Ct:St)({satellite:e}),d=We(p);await L({actor:a,code:{canister_id:nn.fromText(i),arg:new Uint8Array(d),wasm_module:t,mode:o?{reinstall:null}:{upgrade:[{skip_pre_upgrade:[!1]}]}}})},rs=async({satellite:e})=>(await $r({satellite:e})).map(([r,n])=>{let o=de(n.version);return{domain:r,bn_id:de(n.bn_id),created_at:n.created_at,updated_at:n.updated_at,...Je(o)&&{version:o}}}),ns=async({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>Ur({satellite:e,domainName:r,boundaryNodesId:n}))),os=e=>jr(e),is=async e=>zr(e),ss=async e=>Kr(e),as=async e=>Hr(e),cs=async e=>Wr(e),ls=({deprecatedNoScope:e,...t})=>(e===!0?Ct:St)(t),us=e=>Gr(e);export{Ci as checkUpgradeVersion,as as countAssets,is as countDocs,cs as deleteAssets,ss as deleteDocs,Xi as getAuthConfig,rs as listCustomDomains,_i as listMissionControlControllers,Pi as listOrbiterControllers,Zi as listRules,ls as listSatelliteControllers,ui as missionControlVersion,Ni as orbiterMemorySize,xi as orbiterVersion,es as satelliteBuildType,Li as satelliteBuildVersion,os as satelliteMemorySize,Di as satelliteVersion,Qi as setAuthConfig,ns as setCustomDomains,Yi as setDatastoreConfig,mi as setMissionControlController,Ii as setRule,us as setSatelliteControllers,pi as setSatellitesController,Ji as setStorageConfig,di as upgradeMissionControl,vi as upgradeOrbiter,ts as upgradeSatellite};
|
|
16
16
|
//# sourceMappingURL=index.mjs.map
|