@junobuild/admin 0.0.21 → 0.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +12 -30
- package/dist/browser/index.js.map +4 -4
- package/dist/node/index.mjs +7 -63
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/index.d.ts +2 -0
- package/dist/types/services/releases.services.d.ts +6 -0
- package/dist/types/types/releases.types.d.ts +12 -0
- package/package.json +8 -6
- package/dist/browser/canisterStatus-MAYNIE3Q.js +0 -2
- package/dist/browser/canisterStatus-MAYNIE3Q.js.map +0 -7
- package/dist/browser/chunk-ZTILA2YH.js +0 -35
- package/dist/browser/chunk-ZTILA2YH.js.map +0 -7
package/dist/browser/index.js
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
import{a as jt,b as er,c as Ht,d as h,e as $t,f as y,g as rr,h as rt,i as v,j as zt,k as Tt,l as nr,m as st,n as ct,o as Kt}from"./chunk-ZTILA2YH.js";var It=jt(lt=>{"use strict";lt.byteLength=ir;lt.toByteArray=sr;lt.fromByteArray=ur;var P=[],T=[],or=typeof Uint8Array<"u"?Uint8Array:Array,Rt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(j=0,Xt=Rt.length;j<Xt;++j)P[j]=Rt[j],T[Rt.charCodeAt(j)]=j;var j,Xt;T["-".charCodeAt(0)]=62;T["_".charCodeAt(0)]=63;function Zt(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function ir(t){var e=Zt(t),r=e[0],n=e[1];return(r+n)*3/4-n}function ar(t,e,r){return(e+r)*3/4-r}function sr(t){var e,r=Zt(t),n=r[0],o=r[1],i=new or(ar(t,n,o)),a=0,c=o>0?n-4:n,l;for(l=0;l<c;l+=4)e=T[t.charCodeAt(l)]<<18|T[t.charCodeAt(l+1)]<<12|T[t.charCodeAt(l+2)]<<6|T[t.charCodeAt(l+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return o===2&&(e=T[t.charCodeAt(l)]<<2|T[t.charCodeAt(l+1)]>>4,i[a++]=e&255),o===1&&(e=T[t.charCodeAt(l)]<<10|T[t.charCodeAt(l+1)]<<4|T[t.charCodeAt(l+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function cr(t){return P[t>>18&63]+P[t>>12&63]+P[t>>6&63]+P[t&63]}function lr(t,e,r){for(var n,o=[],i=e;i<r;i+=3)n=(t[i]<<16&16711680)+(t[i+1]<<8&65280)+(t[i+2]&255),o.push(cr(n));return o.join("")}function ur(t){for(var e,r=t.length,n=r%3,o=[],i=16383,a=0,c=r-n;a<c;a+=i)o.push(lr(t,a,a+i>c?c:a+i));return n===1?(e=t[r-1],o.push(P[e>>2]+P[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],o.push(P[e>>10]+P[e>>4&63]+P[e<<2&63]+"=")),o.join("")}});var ue=jt(G=>{"use strict";var Nt=It(),W=rr(),Dt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;G.Buffer=s;G.SlowBuffer=_r;G.INSPECT_MAX_BYTES=50;var ut=2147483647;G.kMaxLength=ut;s.TYPED_ARRAY_SUPPORT=pr();!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function pr(){try{var t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}});Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function k(t){if(t>ut)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return Object.setPrototypeOf(e,s.prototype),e}function s(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return bt(t)}return ee(t,e,r)}s.poolSize=8192;function ee(t,e,r){if(typeof t=="string")return fr(t,e);if(ArrayBuffer.isView(t))return hr(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(O(t,ArrayBuffer)||t&&O(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(O(t,SharedArrayBuffer)||t&&O(t.buffer,SharedArrayBuffer)))return Ft(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return s.from(n,e,r);var o=mr(t);if(o)return o;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return s.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}s.from=function(t,e,r){return ee(t,e,r)};Object.setPrototypeOf(s.prototype,Uint8Array.prototype);Object.setPrototypeOf(s,Uint8Array);function re(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function dr(t,e,r){return re(t),t<=0?k(t):e!==void 0?typeof r=="string"?k(t).fill(e,r):k(t).fill(e):k(t)}s.alloc=function(t,e,r){return dr(t,e,r)};function bt(t){return re(t),k(t<0?0:St(t)|0)}s.allocUnsafe=function(t){return bt(t)};s.allocUnsafeSlow=function(t){return bt(t)};function fr(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!s.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=ne(t,e)|0,n=k(r),o=n.write(t,e);return o!==r&&(n=n.slice(0,o)),n}function Ct(t){for(var e=t.length<0?0:St(t.length)|0,r=k(e),n=0;n<e;n+=1)r[n]=t[n]&255;return r}function hr(t){if(O(t,Uint8Array)){var e=new Uint8Array(t);return Ft(e.buffer,e.byteOffset,e.byteLength)}return Ct(t)}function Ft(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,s.prototype),n}function mr(t){if(s.isBuffer(t)){var e=St(t.length)|0,r=k(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Pt(t.length)?k(0):Ct(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ct(t.data)}function St(t){if(t>=ut)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ut.toString(16)+" bytes");return t|0}function _r(t){return+t!=t&&(t=0),s.alloc(+t)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype};s.compare=function(e,r){if(O(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),O(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(e)||!s.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;for(var n=e.length,o=r.length,i=0,a=Math.min(n,o);i<a;++i)if(e[i]!==r[i]){n=e[i],o=r[i];break}return n<o?-1:o<n?1:0};s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};s.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return s.alloc(0);var n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;var o=s.allocUnsafe(r),i=0;for(n=0;n<e.length;++n){var a=e[n];if(O(a,Uint8Array))i+a.length>o.length?s.from(a).copy(o,i):Uint8Array.prototype.set.call(o,a,i);else if(s.isBuffer(a))a.copy(o,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=a.length}return o};function ne(t,e){if(s.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||O(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;for(var o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return At(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return le(t).length;default:if(o)return n?-1:At(t).length;e=(""+e).toLowerCase(),o=!0}}s.byteLength=ne;function yr(t,e,r){var n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return br(this,e,r);case"utf8":case"utf-8":return ie(this,e,r);case"ascii":return Fr(this,e,r);case"latin1":case"binary":return Ar(this,e,r);case"base64":return Nr(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Sr(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}s.prototype._isBuffer=!0;function H(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}s.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<e;r+=2)H(this,r,r+1);return this};s.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<e;r+=4)H(this,r,r+3),H(this,r+1,r+2);return this};s.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<e;r+=8)H(this,r,r+7),H(this,r+1,r+6),H(this,r+2,r+5),H(this,r+3,r+4);return this};s.prototype.toString=function(){var e=this.length;return e===0?"":arguments.length===0?ie(this,0,e):yr.apply(this,arguments)};s.prototype.toLocaleString=s.prototype.toString;s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:s.compare(this,e)===0};s.prototype.inspect=function(){var e="",r=G.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Dt&&(s.prototype[Dt]=s.prototype.inspect);s.prototype.compare=function(e,r,n,o,i){if(O(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),o===void 0&&(o=0),i===void 0&&(i=this.length),r<0||n>e.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&r>=n)return 0;if(o>=i)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,o>>>=0,i>>>=0,this===e)return 0;for(var a=i-o,c=n-r,l=Math.min(a,c),u=this.slice(o,i),p=e.slice(r,n),d=0;d<l;++d)if(u[d]!==p[d]){a=u[d],c=p[d];break}return a<c?-1:c<a?1:0};function oe(t,e,r,n,o){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Pt(r)&&(r=o?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(o)return-1;r=t.length-1}else if(r<0)if(o)r=0;else return-1;if(typeof e=="string"&&(e=s.from(e,n)),s.isBuffer(e))return e.length===0?-1:Lt(t,e,r,n,o);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?o?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Lt(t,[e],r,n,o);throw new TypeError("val must be string, number or Buffer")}function Lt(t,e,r,n,o){var i=1,a=t.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;i=2,a/=2,c/=2,r/=2}function l(f,_){return i===1?f[_]:f.readUInt16BE(_*i)}var u;if(o){var p=-1;for(u=r;u<a;u++)if(l(t,u)===l(e,p===-1?0:u-p)){if(p===-1&&(p=u),u-p+1===c)return p*i}else p!==-1&&(u-=u-p),p=-1}else for(r+c>a&&(r=a-c),u=r;u>=0;u--){for(var d=!0,m=0;m<c;m++)if(l(t,u+m)!==l(e,m)){d=!1;break}if(d)return u}return-1}s.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};s.prototype.indexOf=function(e,r,n){return oe(this,e,r,n,!0)};s.prototype.lastIndexOf=function(e,r,n){return oe(this,e,r,n,!1)};function xr(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n),n>o&&(n=o)):n=o;var i=e.length;n>i/2&&(n=i/2);for(var a=0;a<n;++a){var c=parseInt(e.substr(a*2,2),16);if(Pt(c))return a;t[r+a]=c}return a}function gr(t,e,r,n){return pt(At(e,t.length-r),t,r,n)}function wr(t,e,r,n){return pt(Er(e),t,r,n)}function Tr(t,e,r,n){return pt(le(e),t,r,n)}function Rr(t,e,r,n){return pt(Vr(e,t.length-r),t,r,n)}s.prototype.write=function(e,r,n,o){if(r===void 0)o="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")o=r,n=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(n)?(n=n>>>0,o===void 0&&(o="utf8")):(o=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i=this.length-r;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var a=!1;;)switch(o){case"hex":return xr(this,e,r,n);case"utf8":case"utf-8":return gr(this,e,r,n);case"ascii":case"latin1":case"binary":return wr(this,e,r,n);case"base64":return Tr(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Rr(this,e,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),a=!0}};s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Nr(t,e,r){return e===0&&r===t.length?Nt.fromByteArray(t):Nt.fromByteArray(t.slice(e,r))}function ie(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i=t[o],a=null,c=i>239?4:i>223?3:i>191?2:1;if(o+c<=r){var l,u,p,d;switch(c){case 1:i<128&&(a=i);break;case 2:l=t[o+1],(l&192)===128&&(d=(i&31)<<6|l&63,d>127&&(a=d));break;case 3:l=t[o+1],u=t[o+2],(l&192)===128&&(u&192)===128&&(d=(i&15)<<12|(l&63)<<6|u&63,d>2047&&(d<55296||d>57343)&&(a=d));break;case 4:l=t[o+1],u=t[o+2],p=t[o+3],(l&192)===128&&(u&192)===128&&(p&192)===128&&(d=(i&15)<<18|(l&63)<<12|(u&63)<<6|p&63,d>65535&&d<1114112&&(a=d))}}a===null?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|a&1023),n.push(a),o+=c}return Cr(n)}var te=4096;function Cr(t){var e=t.length;if(e<=te)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=te));return r}function Fr(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]&127);return n}function Ar(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function br(t,e,r){var n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=e;i<r;++i)o+=vr[t[i]];return o}function Sr(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length-1;i+=2)o+=String.fromCharCode(n[i]+n[i+1]*256);return o}s.prototype.slice=function(e,r){var n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);var o=this.subarray(e,r);return Object.setPrototypeOf(o,s.prototype),o};function x(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||x(e,r,this.length);for(var o=this[e],i=1,a=0;++a<r&&(i*=256);)o+=this[e+a]*i;return o};s.prototype.readUintBE=s.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||x(e,r,this.length);for(var o=this[e+--r],i=1;r>0&&(i*=256);)o+=this[e+--r]*i;return o};s.prototype.readUint8=s.prototype.readUInt8=function(e,r){return e=e>>>0,r||x(e,1,this.length),this[e]};s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||x(e,2,this.length),this[e]|this[e+1]<<8};s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||x(e,2,this.length),this[e]<<8|this[e+1]};s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||x(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||x(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};s.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||x(e,r,this.length);for(var o=this[e],i=1,a=0;++a<r&&(i*=256);)o+=this[e+a]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*r)),o};s.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||x(e,r,this.length);for(var o=r,i=1,a=this[e+--o];o>0&&(i*=256);)a+=this[e+--o]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*r)),a};s.prototype.readInt8=function(e,r){return e=e>>>0,r||x(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};s.prototype.readInt16LE=function(e,r){e=e>>>0,r||x(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};s.prototype.readInt16BE=function(e,r){e=e>>>0,r||x(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};s.prototype.readInt32LE=function(e,r){return e=e>>>0,r||x(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};s.prototype.readInt32BE=function(e,r){return e=e>>>0,r||x(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};s.prototype.readFloatLE=function(e,r){return e=e>>>0,r||x(e,4,this.length),W.read(this,e,!0,23,4)};s.prototype.readFloatBE=function(e,r){return e=e>>>0,r||x(e,4,this.length),W.read(this,e,!1,23,4)};s.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||x(e,8,this.length),W.read(this,e,!0,52,8)};s.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||x(e,8,this.length),W.read(this,e,!1,52,8)};function w(t,e,r,n,o,i){if(!s.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){var i=Math.pow(2,8*n)-1;w(this,e,r,n,i,0)}var a=1,c=0;for(this[r]=e&255;++c<n&&(a*=256);)this[r+c]=e/a&255;return r+n};s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,n=n>>>0,!o){var i=Math.pow(2,8*n)-1;w(this,e,r,n,i,0)}var a=n-1,c=1;for(this[r+a]=e&255;--a>=0&&(c*=256);)this[r+a]=e/c&255;return r+n};s.prototype.writeUint8=s.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,1,255,0),this[r]=e&255,r+1};s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};s.prototype.writeIntLE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){var i=Math.pow(2,8*n-1);w(this,e,r,n,i-1,-i)}var a=0,c=1,l=0;for(this[r]=e&255;++a<n&&(c*=256);)e<0&&l===0&&this[r+a-1]!==0&&(l=1),this[r+a]=(e/c>>0)-l&255;return r+n};s.prototype.writeIntBE=function(e,r,n,o){if(e=+e,r=r>>>0,!o){var i=Math.pow(2,8*n-1);w(this,e,r,n,i-1,-i)}var a=n-1,c=1,l=0;for(this[r+a]=e&255;--a>=0&&(c*=256);)e<0&&l===0&&this[r+a+1]!==0&&(l=1),this[r+a]=(e/c>>0)-l&255;return r+n};s.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};s.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};s.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};s.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};s.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||w(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function ae(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function se(t,e,r,n,o){return e=+e,r=r>>>0,o||ae(t,e,r,4,34028234663852886e22,-34028234663852886e22),W.write(t,e,r,n,23,4),r+4}s.prototype.writeFloatLE=function(e,r,n){return se(this,e,r,!0,n)};s.prototype.writeFloatBE=function(e,r,n){return se(this,e,r,!1,n)};function ce(t,e,r,n,o){return e=+e,r=r>>>0,o||ae(t,e,r,8,17976931348623157e292,-17976931348623157e292),W.write(t,e,r,n,52,8),r+8}s.prototype.writeDoubleLE=function(e,r,n){return ce(this,e,r,!0,n)};s.prototype.writeDoubleBE=function(e,r,n){return ce(this,e,r,!1,n)};s.prototype.copy=function(e,r,n,o){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!o&&o!==0&&(o=this.length),r>=e.length&&(r=e.length),r||(r=0),o>0&&o<n&&(o=n),o===n||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-r<o-n&&(o=e.length-r+n);var i=o-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,o):Uint8Array.prototype.set.call(e,this.subarray(n,o),r),i};s.prototype.fill=function(e,r,n,o){if(typeof e=="string"){if(typeof r=="string"?(o=r,r=0,n=this.length):typeof n=="string"&&(o=n,n=this.length),o!==void 0&&typeof o!="string")throw new TypeError("encoding must be a string");if(typeof o=="string"&&!s.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(e.length===1){var i=e.charCodeAt(0);(o==="utf8"&&i<128||o==="latin1")&&(e=i)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);var a;if(typeof e=="number")for(a=r;a<n;++a)this[a]=e;else{var c=s.isBuffer(e)?e:s.from(e,o),l=c.length;if(l===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-r;++a)this[a+r]=c[a%l]}return this};var Pr=/[^+/0-9A-Za-z-_]/g;function Or(t){if(t=t.split("=")[0],t=t.trim().replace(Pr,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function At(t,e){e=e||1/0;for(var r,n=t.length,o=null,i=[],a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}else if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return i}function Er(t){for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Vr(t,e){for(var r,n,o,i=[],a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,o=r%256,i.push(o),i.push(n);return i}function le(t){return Nt.toByteArray(Or(t))}function pt(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function O(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Pt(t){return t!==t}var vr=function(){for(var t="0123456789abcdef",e=new Array(256),r=0;r<16;++r)for(var n=r*16,o=0;o<16;++o)e[n+o]=t[r]+t[o];return e}()});var Wt=({IDL:t})=>{let e=t.Variant({mainnet:t.Null,testnet:t.Null}),r=t.Text,n=t.Record({network:e,address:r,min_confirmations:t.Opt(t.Nat32)}),o=t.Nat64,i=t.Record({network:e}),a=t.Nat64,c=t.Record({network:e,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:r}),l=t.Vec(t.Nat8),u=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),p=t.Record({height:t.Nat32,value:o,outpoint:u}),d=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:t.Nat32,tip_block_hash:l,utxos:t.Vec(p)}),m=t.Record({transaction:t.Vec(t.Nat8),network:e}),f=t.Principal,_=t.Variant({from_user:t.Record({user_id:t.Principal}),from_canister:t.Record({canister_version:t.Opt(t.Nat64),canister_id:t.Principal})}),F=t.Variant({creation:t.Record({controllers:t.Vec(t.Principal)}),code_deployment:t.Record({mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),module_hash:t.Vec(t.Nat8)}),controllers_change:t.Record({controllers:t.Vec(t.Principal)}),code_uninstall:t.Null}),V=t.Record({timestamp_nanos:t.Nat64,canister_version:t.Nat64,origin:_,details:F}),A=t.Record({freezing_threshold:t.Nat,controllers:t.Vec(t.Principal),memory_allocation:t.Nat,compute_allocation:t.Nat}),g=t.Record({freezing_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),b=t.Variant({secp256k1:t.Null}),N=t.Record({value:t.Text,name:t.Text}),S=t.Record({status:t.Nat,body:t.Vec(t.Nat8),headers:t.Vec(N)}),q=t.Vec(t.Nat8);return t.Service({bitcoin_get_balance:t.Func([n],[o],[]),bitcoin_get_current_fee_percentiles:t.Func([i],[t.Vec(a)],[]),bitcoin_get_utxos:t.Func([c],[d],[]),bitcoin_send_transaction:t.Func([m],[],[]),canister_info:t.Func([t.Record({canister_id:f,num_requested_changes:t.Opt(t.Nat64)})],[t.Record({controllers:t.Vec(t.Principal),module_hash:t.Opt(t.Vec(t.Nat8)),recent_changes:t.Vec(V),total_num_changes:t.Nat64})],[]),canister_status:t.Func([t.Record({canister_id:f})],[t.Record({status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:A,idle_cycles_burned_per_day:t.Nat,module_hash:t.Opt(t.Vec(t.Nat8))})],[]),create_canister:t.Func([t.Record({settings:t.Opt(g),sender_canister_version:t.Opt(t.Nat64)})],[t.Record({canister_id:f})],[]),delete_canister:t.Func([t.Record({canister_id:f})],[],[]),deposit_cycles:t.Func([t.Record({canister_id:f})],[],[]),ecdsa_public_key:t.Func([t.Record({key_id:t.Record({name:t.Text,curve:b}),canister_id:t.Opt(f),derivation_path:t.Vec(t.Vec(t.Nat8))})],[t.Record({public_key:t.Vec(t.Nat8),chain_code:t.Vec(t.Nat8)})],[]),http_request:t.Func([t.Record({url:t.Text,method:t.Variant({get:t.Null,head:t.Null,post:t.Null}),max_response_bytes:t.Opt(t.Nat64),body:t.Opt(t.Vec(t.Nat8)),transform:t.Opt(t.Record({function:t.Func([t.Record({context:t.Vec(t.Nat8),response:S})],[S],["query"]),context:t.Vec(t.Nat8)})),headers:t.Vec(N)})],[S],[]),install_code:t.Func([t.Record({arg:t.Vec(t.Nat8),wasm_module:q,mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),canister_id:f,sender_canister_version:t.Opt(t.Nat64)})],[],[]),provisional_create_canister_with_cycles:t.Func([t.Record({settings:t.Opt(g),specified_id:t.Opt(f),amount:t.Opt(t.Nat)})],[t.Record({canister_id:f})],[]),provisional_top_up_canister:t.Func([t.Record({canister_id:f,amount:t.Nat})],[],[]),raw_rand:t.Func([],[t.Vec(t.Nat8)],[]),sign_with_ecdsa:t.Func([t.Record({key_id:t.Record({name:t.Text,curve:b}),derivation_path:t.Vec(t.Vec(t.Nat8)),message_hash:t.Vec(t.Nat8)})],[t.Record({signature:t.Vec(t.Nat8)})],[]),start_canister:t.Func([t.Record({canister_id:f})],[],[]),stop_canister:t.Func([t.Record({canister_id:f})],[],[]),uninstall_code:t.Func([t.Record({canister_id:f,sender_canister_version:t.Opt(t.Nat64)})],[],[]),update_settings:t.Func([t.Record({canister_id:t.Principal,settings:g,sender_canister_version:t.Opt(t.Nat64)})],[],[])})};var Gt=({IDL:t})=>{let e=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,satellite_id:t.Principal}),r=t.Variant({Write:t.Null,Admin:t.Null}),n=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:r,expires_at:t.Opt(t.Nat64)}),o=t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),i=t.Record({freezing_threshold:t.Nat,controllers:t.Vec(t.Principal),memory_allocation:t.Nat,compute_allocation:t.Nat}),a=t.Record({status:o,memory_size:t.Nat,cycles:t.Nat,settings:i,idle_cycles_burned_per_day:t.Nat,module_hash:t.Opt(t.Vec(t.Nat8))}),c=t.Record({id:t.Principal,status:a,metadata:t.Opt(t.Vec(t.Tuple(t.Text,t.Text))),status_at:t.Nat64}),l=t.Variant({Ok:c,Err:t.Text}),u=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:r,expires_at:t.Opt(t.Nat64)}),p=t.Record({enabled:t.Bool,cycles_threshold:t.Opt(t.Nat64)}),d=t.Record({mission_control_cycles_threshold:t.Opt(t.Nat64),satellites:t.Vec(t.Tuple(t.Principal,p)),cycles_threshold:t.Opt(t.Nat64)}),m=t.Record({satellites:t.Opt(t.Vec(l)),mission_control:l}),f=t.Record({e8s:t.Nat64});return t.Service({add_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),add_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),create_satellite:t.Func([t.Text],[e],[]),del_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),del_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),get_user:t.Func([],[t.Principal],["query"]),list_mission_control_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,n))],["query"]),list_mission_control_statuses:t.Func([],[t.Vec(t.Tuple(t.Nat64,l))],["query"]),list_satellite_statuses:t.Func([t.Principal],[t.Opt(t.Vec(t.Tuple(t.Nat64,l)))],["query"]),list_satellites:t.Func([],[t.Vec(t.Tuple(t.Principal,e))],["query"]),remove_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),remove_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),set_metadata:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[],[]),set_mission_control_controllers:t.Func([t.Vec(t.Principal),u],[],[]),set_satellite_metadata:t.Func([t.Principal,t.Vec(t.Tuple(t.Text,t.Text))],[e],[]),set_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal),u],[],[]),status:t.Func([d],[m],[]),top_up:t.Func([t.Principal,f],[],[]),version:t.Func([],[t.Text],["query"])})};var Yt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),n=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),o=t.Record({updated_at:t.Opt(t.Nat64)}),i=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),a=t.Record({storage:i}),c=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),l=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),u=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),p=t.Variant({Callback:t.Record({token:u,callback:t.Func([],[],[])})}),d=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(p),status_code:t.Nat16}),m=t.Record({token:t.Opt(u),body:t.Vec(t.Nat8)}),f=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),_=t.Record({batch_id:t.Nat}),F=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),V=t.Record({field:F,desc:t.Bool}),A=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),g=t.Record({order:t.Opt(V),owner:t.Opt(t.Principal),matcher:t.Opt(t.Text),paginate:t.Opt(A)}),b=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),N=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),S=t.Record({key:b,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,N)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),q=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,S))}),Q=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),X=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,c))}),M=t.Variant({Db:t.Null,Storage:t.Null}),C=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),Z=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:C,created_at:t.Nat64,write:C}),U=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),I=t.Record({controller:U,controllers:t.Vec(t.Principal)}),D=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),L=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:C,write:C}),tt=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),et=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,n))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,o],[],[]),get_config:t.Func([],[a],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(c)],["query"]),http_request:t.Func([l],[d],["query"]),http_request_streaming_callback:t.Func([u],[m],["query"]),init_asset_upload:t.Func([f],[_],[]),list_assets:t.Func([t.Opt(t.Text),g],[q],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,n))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,Q))],["query"]),list_docs:t.Func([t.Text,g],[X],["query"]),list_rules:t.Func([M],[t.Vec(t.Tuple(t.Text,Z))],["query"]),set_config:t.Func([a],[],[]),set_controllers:t.Func([I],[t.Vec(t.Tuple(t.Principal,n))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,D],[c],[]),set_rule:t.Func([M,t.Text,L],[],[]),upload_asset_chunk:t.Func([tt],[et],[]),version:t.Func([],[t.Text],["query"])})};var Jt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),n=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),o=t.Record({updated_at:t.Opt(t.Nat64)}),i=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),a=t.Record({storage:i}),c=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),l=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),u=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),p=t.Variant({Callback:t.Record({token:u,callback:t.Func([],[],[])})}),d=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(p),status_code:t.Nat16}),m=t.Record({token:t.Opt(u),body:t.Vec(t.Nat8)}),f=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),_=t.Record({batch_id:t.Nat}),F=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),V=t.Record({field:F,desc:t.Bool}),A=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),g=t.Record({order:t.Opt(V),matcher:t.Opt(t.Text),paginate:t.Opt(A)}),b=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),N=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),S=t.Record({key:b,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,N)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),q=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,S))}),Q=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),X=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,c))}),M=t.Variant({Db:t.Null,Storage:t.Null}),C=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),Z=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:C,created_at:t.Nat64,write:C}),U=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),I=t.Record({controller:U,controllers:t.Vec(t.Principal)}),D=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),L=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:C,write:C}),tt=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),et=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,n))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,o],[],[]),get_config:t.Func([],[a],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(c)],["query"]),http_request:t.Func([l],[d],["query"]),http_request_streaming_callback:t.Func([u],[m],["query"]),init_asset_upload:t.Func([f],[_],[]),list_assets:t.Func([t.Opt(t.Text),g],[q],["query"]),list_controllers:t.Func([],[t.Vec(t.Principal)],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,Q))],["query"]),list_docs:t.Func([t.Text,g],[X],["query"]),list_rules:t.Func([M],[t.Vec(t.Tuple(t.Text,Z))],["query"]),set_config:t.Func([a],[],[]),set_controllers:t.Func([I],[t.Vec(t.Tuple(t.Principal,n))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,D],[c],[]),set_rule:t.Func([M,t.Text,L],[],[]),upload_asset_chunk:t.Func([tt],[et],[]),version:t.Func([],[t.Text],["query"])})};var Qt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),n=t.Variant({Write:t.Null,Admin:t.Null}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:n,expires_at:t.Opt(t.Nat64)}),i=t.Record({updated_at:t.Opt(t.Nat64)}),a=t.Variant({Db:t.Null,Storage:t.Null}),c=t.Record({rewrites:t.Vec(t.Tuple(t.Text,t.Text)),headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),l=t.Record({storage:c}),u=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),description:t.Opt(t.Text),created_at:t.Nat64}),p=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),d=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),m=t.Variant({Callback:t.Record({token:d,callback:t.Func([],[],[])})}),f=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(m),status_code:t.Nat16}),_=t.Record({token:t.Opt(d),body:t.Vec(t.Nat8)}),F=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,description:t.Opt(t.Text),encoding_type:t.Opt(t.Text),full_path:t.Text}),V=t.Record({batch_id:t.Nat}),A=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),g=t.Record({field:A,desc:t.Bool}),b=t.Record({key:t.Opt(t.Text),description:t.Opt(t.Text)}),N=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),S=t.Record({order:t.Opt(g),owner:t.Opt(t.Principal),matcher:t.Opt(b),paginate:t.Opt(N)}),q=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,description:t.Opt(t.Text),full_path:t.Text}),Q=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),X=t.Record({key:q,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,Q)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),M=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,X)),items_length:t.Nat64}),C=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),Z=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,u)),items_length:t.Nat64}),U=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),I=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:U,created_at:t.Nat64,write:U}),D=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:n,expires_at:t.Opt(t.Nat64)}),L=t.Record({controller:D,controllers:t.Vec(t.Principal)}),tt=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8),description:t.Opt(t.Text)}),et=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:U,write:U}),Le=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat,order_id:t.Opt(t.Nat)}),tr=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Text],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,o))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,i],[],[]),del_rule:t.Func([a,t.Text,i],[],[]),get_config:t.Func([],[l],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(u)],["query"]),http_request:t.Func([p],[f],["query"]),http_request_streaming_callback:t.Func([d],[_],["query"]),init_asset_upload:t.Func([F],[V],[]),list_assets:t.Func([t.Text,S],[M],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,o))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,C))],["query"]),list_docs:t.Func([t.Text,S],[Z],["query"]),list_rules:t.Func([a],[t.Vec(t.Tuple(t.Text,I))],["query"]),set_config:t.Func([l],[],[]),set_controllers:t.Func([L],[t.Vec(t.Tuple(t.Principal,o))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,tt],[u],[]),set_rule:t.Func([a,t.Text,et],[],[]),upload_asset_chunk:t.Func([Le],[tr],[]),version:t.Func([],[t.Text],["query"])})};var Ne=Ht(ue());var dt;(function(t){t[t.SysFatal=1]="SysFatal",t[t.SysTransient=2]="SysTransient",t[t.DestinationInvalid=3]="DestinationInvalid",t[t.CanisterReject=4]="CanisterReject",t[t.CanisterError=5]="CanisterError"})(dt||(dt={}));var dn=new TextEncoder().encode(`
|
|
2
|
-
ic-request`);var ft=class{getPrincipal(){return h.anonymous()}async transformRequest(e){return Object.assign(Object.assign({},e),{body:{content:e.body}})}};var pe=Ht(nr());var ht;(function(t){t.Call="call"})(ht||(ht={}));function nt(){let t=new ArrayBuffer(16),e=new DataView(t),r=BigInt(+Date.now()),n=Math.floor(Math.random()*4294967295),o=Math.floor(Math.random()*4294967295);if(typeof e.setBigUint64=="function")e.setBigUint64(0,r);else{let i=BigInt(1)<<BigInt(32);e.setUint32(0,Number(r>>BigInt(32))),e.setUint32(4,Number(r%i))}return e.setUint32(8,n),e.setUint32(12,o),t}var kr=BigInt(1e6),Br=BigInt(60*1e3),$=class{constructor(e){this._value=(BigInt(Date.now())+BigInt(e)-Br)*kr}toCBOR(){return pe.value.u64(this._value.toString(16),16)}toHash(){return $t(this._value)}};function de(t=nt){return async e=>{let r=t(),n=e.request.headers?new Headers(e.request.headers):new Headers;e.request.headers=n,e.endpoint==="call"&&(e.body.nonce=t())}}var E;(function(t){t.Received="received",t.Processing="processing",t.Replied="replied",t.Rejected="rejected",t.Unknown="unknown",t.Done="done"})(E||(E={}));var mt=5*60*1e3,qr="308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae",Mr="ic0.app",jr=".ic0.app",Hr="icp0.io",$r=".icp0.io",zr="icp-api.io",Kr=".icp-api.io",ot=class extends rt{constructor(e){super(e),this.message=e}},Y=class extends rt{constructor(e){super(e),this.message=e}};function Wr(){let t;if(typeof window<"u")if(window.fetch)t=window.fetch.bind(window);else throw new ot("Fetch implementation was not available. You appear to be in a browser context, but window.fetch was not present.");else if(typeof globalThis<"u")if(globalThis.fetch)t=globalThis.fetch.bind(globalThis);else throw new ot("Fetch implementation was not available. You appear to be in a Node.js context, but global.fetch was not available.");else typeof self<"u"&&self.fetch&&(t=self.fetch.bind(self));if(t)return t;throw new ot("Fetch implementation was not available. Please provide fetch to the HttpAgent constructor, or ensure it is available in the window or global context.")}var z=class{constructor(e={}){if(this.rootKey=zt(qr),this._pipeline=[],this._timeDiffMsecs=0,this._rootKeyFetched=!1,this._retryTimes=3,this._isAgent=!0,e.source){if(!(e.source instanceof z))throw new Error("An Agent's source can only be another HttpAgent");this._pipeline=[...e.source._pipeline],this._identity=e.source._identity,this._fetch=e.source._fetch,this._host=e.source._host,this._credentials=e.source._credentials}else this._fetch=e.fetch||Wr()||fetch.bind(globalThis),this._fetchOptions=e.fetchOptions,this._callOptions=e.callOptions;if(e.host!==void 0)!e.host.match(/^[a-z]+:/)&&typeof window<"u"?this._host=new URL(window.location.protocol+"//"+e.host):this._host=new URL(e.host);else if(e.source!==void 0)this._host=e.source._host;else{let r=typeof window<"u"?window.location:void 0;if(!r)throw new Error("Must specify a host to connect to.");this._host=new URL(r+"")}if(e.retryTimes!==void 0&&(this._retryTimes=e.retryTimes),this._host.hostname.endsWith(jr)?this._host.hostname=Mr:this._host.hostname.endsWith($r)?this._host.hostname=Hr:this._host.hostname.endsWith(Kr)&&(this._host.hostname=zr),e.credentials){let{name:r,password:n}=e.credentials;this._credentials=`${r}${n?":"+n:""}`}this._identity=Promise.resolve(e.identity||new ft),e.disableNonce||this.addTransform(de(nt))}isLocal(){let e=this._host.hostname;return e==="127.0.0.1"||e.endsWith("localhost")}addTransform(e,r=e.priority||0){let n=this._pipeline.findIndex(o=>(o.priority||0)<r);this._pipeline.splice(n>=0?n:this._pipeline.length,0,Object.assign(e,{priority:r}))}async getPrincipal(){if(!this._identity)throw new Y("This identity has expired due this application's security policy. Please refresh your authentication.");return(await this._identity).getPrincipal()}async call(e,r,n){let o=await(n!==void 0?await n:await this._identity);if(!o)throw new Y("This identity has expired due this application's security policy. Please refresh your authentication.");let i=h.from(e),a=r.effectiveCanisterId?h.from(r.effectiveCanisterId):i,c=o.getPrincipal()||h.anonymous(),l=new $(mt);Math.abs(this._timeDiffMsecs)>1e3*30&&(l=new $(mt+this._timeDiffMsecs));let u={request_type:ht.Call,canister_id:i,method_name:r.methodName,arg:r.arg,sender:c,ingress_expiry:l},p=await this._transform({request:{body:null,method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"call",body:u});p=await o.transformRequest(p);let d=st(p.body),m=this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${a.toText()}/call`,this._host),Object.assign(Object.assign(Object.assign({},this._callOptions),p.request),{body:d}))),[f,_]=await Promise.all([m,Tt(u)]);return{requestId:_,response:{ok:f.ok,status:f.status,statusText:f.statusText}}}async _requestAndRetry(e,r=0){if(r>this._retryTimes&&this._retryTimes!==0)throw new Error(`AgentError: Exceeded configured limit of ${this._retryTimes} retry attempts. Please check your network connection or try again in a few moments`);let n=await e();if(!n.ok){let o=await n.clone().text(),i=`Server returned an error:
|
|
3
|
-
Code: ${n.status} (${n.statusText})
|
|
4
|
-
Body: ${o}
|
|
5
|
-
`;if(this._retryTimes>r)return console.warn(i+" Retrying request."),await this._requestAndRetry(e,r+1);throw new Error(i)}return n}async query(e,r,n){let o=await(n!==void 0?await n:await this._identity);if(!o)throw new Y("This identity has expired due this application's security policy. Please refresh your authentication.");let i=typeof e=="string"?h.fromText(e):e,a=o?.getPrincipal()||h.anonymous(),c={request_type:"query",canister_id:i,method_name:r.methodName,arg:r.arg,sender:a,ingress_expiry:new $(mt)},l=await this._transform({request:{method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"read",body:c});l=await o?.transformRequest(l);let u=st(l.body),p=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${i.toText()}/query`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),l.request),{body:u})));return ct(await p.arrayBuffer())}async createReadStateRequest(e,r){let n=await(r!==void 0?await r:await this._identity);if(!n)throw new Y("This identity has expired due this application's security policy. Please refresh your authentication.");let o=n?.getPrincipal()||h.anonymous(),i=await this._transform({request:{method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"read_state",body:{request_type:"read_state",paths:e.paths,sender:o,ingress_expiry:new $(mt)}});return n?.transformRequest(i)}async readState(e,r,n,o){let i=typeof e=="string"?h.fromText(e):e,a=o??await this.createReadStateRequest(r,n),c=st(a.body),l=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${i}/read_state`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),a.request),{body:c})));if(!l.ok)throw new Error(`Server returned an error:
|
|
6
|
-
Code: ${l.status} (${l.statusText})
|
|
7
|
-
Body: ${await l.text()}
|
|
8
|
-
`);return ct(await l.arrayBuffer())}async syncTime(e){let r=await import("./canisterStatus-MAYNIE3Q.js"),n=Date.now();try{e||console.log("Syncing time with the IC. No canisterId provided, so falling back to ryjl3-tyaaa-aaaaa-aaaba-cai");let i=(await r.request({canisterId:e??h.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:this,paths:["time"]})).get("time");i&&(this._timeDiffMsecs=Number(i)-Number(n))}catch(o){console.error("Caught exception while attempting to sync time:",o)}}async status(){let e=this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{},r=await this._requestAndRetry(()=>this._fetch(""+new URL("/api/v2/status",this._host),Object.assign({headers:e},this._fetchOptions)));return ct(await r.arrayBuffer())}async fetchRootKey(){return this._rootKeyFetched||(this.rootKey=(await this.status()).root_key,this._rootKeyFetched=!0),this.rootKey}invalidateIdentity(){this._identity=null}replaceIdentity(e){this._identity=Promise.resolve(e)}_transform(e){let r=Promise.resolve(e);for(let n of this._pipeline)r=r.then(o=>n(o).then(i=>i||o));return r}};var fe;(function(t){t.Error="err",t.GetPrincipal="gp",t.GetPrincipalResponse="gpr",t.Query="q",t.QueryResponse="qr",t.Call="c",t.CallResponse="cr",t.ReadState="rs",t.ReadStateResponse="rsr",t.Status="s",t.StatusResponse="sr"})(fe||(fe={}));function Ot(){let t=typeof window>"u"?typeof globalThis>"u"?typeof self>"u"?void 0:self.ic.agent:globalThis.ic.agent:window.ic.agent;if(!t)throw new Error("No Agent could be found.");return t}var _t={};er(_t,{backoff:()=>xe,chain:()=>ge,conditionalDelay:()=>_e,defaultStrategy:()=>he,maxAttempts:()=>Yr,once:()=>me,throttle:()=>Jr,timeout:()=>ye});var Gr=5*60*1e3;function he(){return ge(_e(me(),1e3),xe(1e3,1.2),ye(Gr))}function me(){let t=!0;return async()=>t?(t=!1,!0):!1}function _e(t,e){return async(r,n,o)=>{if(await t(r,n,o))return new Promise(i=>setTimeout(i,e))}}function Yr(t){let e=t;return async(r,n,o)=>{if(--e<=0)throw new Error(`Failed to retrieve a reply for request after ${t} attempts:
|
|
9
|
-
Request ID: ${v(n)}
|
|
10
|
-
Request status: ${o}
|
|
11
|
-
`)}}function Jr(t){return()=>new Promise(e=>setTimeout(e,t))}function ye(t){let e=Date.now()+t;return async(r,n,o)=>{if(Date.now()>e)throw new Error(`Request timed out after ${t} msec:
|
|
12
|
-
Request ID: ${v(n)}
|
|
13
|
-
Request status: ${o}
|
|
14
|
-
`)}}function xe(t,e){let r=t;return()=>new Promise(n=>setTimeout(()=>{r*=e,n()},r))}function ge(...t){return async(e,r,n)=>{for(let o of t)await o(e,r,n)}}async function Et(t,e,r,n,o,i){var a;let c=[new TextEncoder().encode("request_status"),r],l=o??await((a=t.createReadStateRequest)===null||a===void 0?void 0:a.call(t,{paths:[c]})),u=await t.readState(e,{paths:[c]},void 0,l);if(t.rootKey==null)throw new Error("Agent root key not initialized before polling");let p=await Kt.create({certificate:u.certificate,rootKey:t.rootKey,canisterId:e,blsVerify:i}),d=p.lookup([...c,new TextEncoder().encode("status")]),m;switch(typeof d>"u"?m=E.Unknown:m=new TextDecoder().decode(d),m){case E.Replied:return p.lookup([...c,"reply"]);case E.Received:case E.Unknown:case E.Processing:return await n(e,r,m),Et(t,e,r,n,l);case E.Rejected:{let f=new Uint8Array(p.lookup([...c,"reject_code"]))[0],_=new TextDecoder().decode(p.lookup([...c,"reject_message"]));throw new Error(`Call was rejected:
|
|
15
|
-
Request ID: ${v(r)}
|
|
16
|
-
Reject code: ${f}
|
|
17
|
-
Reject text: ${_}
|
|
18
|
-
`)}case E.Done:throw new Error(`Call was marked as done but we never saw the reply:
|
|
19
|
-
Request ID: ${v(r)}
|
|
20
|
-
`)}throw new Error("unreachable")}var we=({IDL:t})=>{let e=t.Principal,r=t.Record({controllers:t.Vec(t.Principal),freezing_threshold:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),n=t.Record({controllers:t.Opt(t.Vec(t.Principal)),freezing_threshold:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),o=t.Vec(t.Nat8);return t.Service({canister_status:t.Func([t.Record({canister_id:e})],[t.Record({status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:r,module_hash:t.Opt(t.Vec(t.Nat8))})],[]),create_canister:t.Func([t.Record({settings:t.Opt(n)})],[t.Record({canister_id:e})],[]),delete_canister:t.Func([t.Record({canister_id:e})],[],[]),deposit_cycles:t.Func([t.Record({canister_id:e})],[],[]),install_code:t.Func([t.Record({arg:t.Vec(t.Nat8),wasm_module:o,mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),canister_id:e})],[],[]),provisional_create_canister_with_cycles:t.Func([t.Record({settings:t.Opt(n),amount:t.Opt(t.Nat)})],[t.Record({canister_id:e})],[]),provisional_top_up_canister:t.Func([t.Record({canister_id:e,amount:t.Nat})],[],[]),raw_rand:t.Func([],[t.Vec(t.Nat8)],[]),start_canister:t.Func([t.Record({canister_id:e})],[],[]),stop_canister:t.Func([t.Record({canister_id:e})],[],[]),uninstall_code:t.Func([t.Record({canister_id:e})],[],[]),update_settings:t.Func([t.Record({canister_id:t.Principal,settings:n})],[],[])})};var yt=class extends rt{constructor(e,r,n,o){super(["Call failed:",` Canister: ${e.toText()}`,` Method: ${r} (${n})`,...Object.getOwnPropertyNames(o).map(i=>` "${i}": ${JSON.stringify(o[i])}`)].join(`
|
|
21
|
-
`)),this.canisterId=e,this.methodName=r,this.type=n,this.props=o}},Vt=class extends yt{constructor(e,r,n){var o;super(e,r,"query",{Status:n.status,Code:(o=dt[n.reject_code])!==null&&o!==void 0?o:`Unknown Code "${n.reject_code}"`,Message:n.reject_message}),this.result=n}},vt=class extends yt{constructor(e,r,n,o){super(e,r,"update",{"Request ID":v(n),"HTTP status code":o.status.toString(),"HTTP status text":o.statusText}),this.requestId=n,this.response=o}},kt;(function(t){t.Install="install",t.Reinstall="reinstall",t.Upgrade="upgrade"})(kt||(kt={}));var R=Symbol.for("ic-agent-metadata"),B=class{constructor(e){this[R]=Object.freeze(e)}static agentOf(e){return e[R].config.agent}static interfaceOf(e){return e[R].service}static canisterIdOf(e){return h.from(e[R].config.canisterId)}static async install(e,r){let n=e.mode===void 0?kt.Install:e.mode,o=e.arg?[...new Uint8Array(e.arg)]:[],i=[...new Uint8Array(e.module)],a=typeof r.canisterId=="string"?h.fromText(r.canisterId):r.canisterId;await Re(r).install_code({mode:{[n]:null},arg:o,wasm_module:i,canister_id:a})}static async createCanister(e){let{canister_id:r}=await Re(e||{}).provisional_create_canister_with_cycles({amount:[],settings:[]});return r}static async createAndInstallCanister(e,r,n){let o=await this.createCanister(n);return await this.install(Object.assign({},r),Object.assign(Object.assign({},n),{canisterId:o})),this.createActor(e,Object.assign(Object.assign({},n),{canisterId:o}))}static createActorClass(e){let r=e({IDL:y});class n extends B{constructor(i){let a=typeof i.canisterId=="string"?h.fromText(i.canisterId):i.canisterId;super({config:Object.assign(Object.assign(Object.assign({},Ce),i),{canisterId:a}),service:r});for(let[c,l]of r._fields)this[c]=Xr(this,c,l,i.blsVerify)}}return n}static createActor(e,r){return new(this.createActorClass(e))(r)}};function Te(t,e){let r=y.decode(t,Ne.Buffer.from(e));switch(r.length){case 0:return;case 1:return r[0];default:return r}}var Ce={pollingStrategyFactory:_t.defaultStrategy};function Xr(t,e,r,n){let o;r.annotations.includes("query")?o=async(a,...c)=>{var l,u;a=Object.assign(Object.assign({},a),(u=(l=t[R].config).queryTransform)===null||u===void 0?void 0:u.call(l,e,c,Object.assign(Object.assign({},t[R].config),a)));let p=a.agent||t[R].config.agent||Ot(),d=h.from(a.canisterId||t[R].config.canisterId),m=y.encode(r.argTypes,c),f=await p.query(d,{methodName:e,arg:m});switch(f.status){case"rejected":throw new Vt(d,e,f);case"replied":return Te(r.retTypes,f.reply.arg)}}:o=async(a,...c)=>{var l,u;a=Object.assign(Object.assign({},a),(u=(l=t[R].config).callTransform)===null||u===void 0?void 0:u.call(l,e,c,Object.assign(Object.assign({},t[R].config),a)));let p=a.agent||t[R].config.agent||Ot(),{canisterId:d,effectiveCanisterId:m,pollingStrategyFactory:f}=Object.assign(Object.assign(Object.assign({},Ce),t[R].config),a),_=h.from(d),F=m!==void 0?h.from(m):_,V=y.encode(r.argTypes,c),{requestId:A,response:g}=await p.call(_,{methodName:e,arg:V,effectiveCanisterId:F});if(!g.ok)throw new vt(_,e,A,g);let b=f(),N=await Et(p,F,A,b,n);if(N!==void 0)return Te(r.retTypes,N);if(r.retTypes.length===0)return;throw new Error(`Call was returned undefined, but type [${r.retTypes.join(",")}].`)};let i=(...a)=>o({},...a);return i.withOptions=a=>(...c)=>o(a,...c),i}function Re(t){function e(r,n,o){let i=n[0],a=h.fromHex("");return i&&typeof i=="object"&&i.canister_id&&(a=h.from(i.canister_id)),{effectiveCanisterId:a}}return B.createActor(we,Object.assign(Object.assign(Object.assign({},t),{canisterId:h.fromHex("")}),{callTransform:e,queryTransform:e}))}var Bt=async({canisterId:t,idlFactory:e,identity:r,fetch:n,env:o="prod",config:i})=>{let a=o==="dev"?"http://127.0.0.1:8000/":"https://icp0.io",c=new z({identity:r,...a&&{host:a},...n&&{fetch:n}});return o==="dev"&&await c.fetchRootKey(),B.createActor(e,{agent:c,canisterId:t,...i!==void 0?i:{}})};var Ae=async({satelliteId:t,...e})=>xt({canisterId:t,...e,idlFactory:Jt}),K=async({satelliteId:t,...e})=>xt({canisterId:t,...e,idlFactory:Qt}),be=async({satelliteId:t,...e})=>xt({canisterId:t,...e,idlFactory:Yt}),it=async({missionControlId:t,...e})=>xt({canisterId:t,...e,idlFactory:Gt});var xt=async({canisterId:t,idlFactory:e,...r})=>{if(!t)throw new Error("No canister ID provided.");return Bt({canisterId:t,idlFactory:e,...r})},Se=h.fromText("aaaaa-aa"),Fe=(t,e,r)=>{let n=e[0],o=Se;return n&&typeof n=="object"&&n.canister_id&&(o=h.from(n.canister_id)),{effectiveCanisterId:o}},Pe=t=>Bt({canisterId:Se.toText(),config:{callTransform:Fe,queryTransform:Fe},idlFactory:Wt,...t});var at=async({actor:t,code:e})=>{let{install_code:r}=await Pe(t);return r({...e,mode:{upgrade:null},sender_canister_version:[]})};var Oe=async({missionControl:t})=>(await it(t)).version(),Ee=async({missionControl:t})=>(await it(t)).get_user();var Ve=async({missionControl:t,satelliteIds:e,controllerIds:r,controller:n})=>(await it(t)).set_satellites_controllers(e,r,n),ve=async({missionControl:t,controllerIds:e,controller:r})=>(await it(t)).set_mission_control_controllers(e,r);var Ut=t=>t==null,J=t=>!Ut(t);var gt=t=>J(t)?[t]:[],wt=t=>t?.[0];var qt=({controllerId:t,profile:e})=>({controllerIds:[h.fromText(t)],controller:Ir(e)}),Ir=t=>({metadata:J(t)&&t!==""?[["profile",t]]:[],expires_at:gt(void 0),scope:{Admin:null}});var zo=async t=>Oe(t),Ko=async({missionControl:t,wasm_module:e})=>{let r=await Ee({missionControl:t}),{missionControlId:n,...o}=t;if(!n)throw new Error("No mission control principal defined.");let i=y.encode([y.Record({user:y.Principal})],[{user:r}]);await at({actor:o,code:{canister_id:h.fromText(n),arg:new Uint8Array(i),wasm_module:e}})},Wo=async({controllerId:t,profile:e,...r})=>Ve({...r,...qt({controllerId:t,profile:e})}),Go=async({controllerId:t,profile:e,...r})=>ve({...r,...qt({controllerId:t,profile:e})});var ke=async({config:t,satellite:e})=>(await K(e)).set_config(t),Be=async({satellite:t,type:e})=>(await K(t)).list_rules(e),Ue=async({type:t,collection:e,rule:r,satellite:n})=>(await K(n)).set_rule(t,e,r),qe=async({satellite:t})=>(await K(t)).version(),Me=async({satellite:t})=>(await Ae(t)).list_controllers(),je=async({satellite:t})=>(await be(t)).list_controllers(),He=async({satellite:t})=>(await K(t)).list_controllers(),$e=async({satellite:t})=>(await K(t)).list_custom_domains();var ze=[{source:"**",destination:"/index.html"}];var Ke={Db:null},We={Storage:null},Ge={Public:null},Ye={Private:null},Je={Managed:null},Qe={Controllers:null};var Mt=t=>t==="storage"?We:Ke,Ie=({read:t,write:e,max_size:r,updated_at:n})=>({read:Ze(t),write:Ze(e),updated_at:Ut(n)?[]:[n],max_size:gt(J(r)&&r>0?BigInt(r):void 0)}),De=([t,e])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:a}=e,c=a?.[0]??0n>0n?Number(wt(a)):void 0;return{collection:t,read:Xe(r),write:Xe(n),updated_at:o,created_at:i,...J(c)&&{max_size:c}}},Xe=t=>"Public"in t?"public":"Private"in t?"private":"Managed"in t?"managed":"controllers",Ze=t=>{switch(t){case"public":return Ge;case"private":return Ye;case"managed":return Je;default:return Qe}};var si=async({config:{storage:{headers:t,rewrites:e}},satellite:r})=>{let n=(t??[]).map(({source:i,headers:a})=>[i,a]),o=(e??ze).map(({source:i,destination:a})=>[i,a]);return ke({satellite:r,config:{storage:{headers:n,rewrites:o}}})},ci=async({type:t,satellite:e})=>(await Be({satellite:e,type:Mt(t)})).map(n=>De(n)),li=async({rule:{collection:t,...e},type:r,satellite:n})=>Ue({type:Mt(r),rule:Ie(e),satellite:n,collection:t}),ui=async t=>qe(t),pi=async({satellite:t,wasm_module:e,deprecated:r,deprecatedNoScope:n})=>{let{satelliteId:o,...i}=t;if(!o)throw new Error("No satellite principal defined.");if(r){let u=await Me({satellite:t}),p=y.encode([y.Record({controllers:y.Vec(y.Principal)})],[{controllers:u}]);await at({actor:i,code:{canister_id:h.fromText(o),arg:new Uint8Array(p),wasm_module:e}});return}let c=await(n?je:He)({satellite:t}),l=y.encode([y.Record({controllers:y.Vec(y.Principal)})],[{controllers:c.map(([u,p])=>u)}]);await at({actor:i,code:{canister_id:h.fromText(o),arg:new Uint8Array(l),wasm_module:e}})},di=async({satellite:t})=>(await $e({satellite:t})).map(([r,n])=>({domain:r,bn_id:wt(n.bn_id),created_at:n.created_at,updated_at:n.updated_at}));export{di as listCustomDomains,ci as listRules,zo as missionControlVersion,ui as satelliteVersion,si as setConfig,Go as setMissionControlController,li as setRule,Wo as setSatellitesController,Ko as upgradeMissionControl,pi as upgradeSatellite};
|
|
22
|
-
/*! Bundled license information:
|
|
1
|
+
var Jt=Object.defineProperty;var Yt=(e,t)=>{for(var r in t)Jt(e,r,{get:t[r],enumerable:!0})};var P={};Yt(P,{Bool:()=>$e,BoolClass:()=>he,ConstructType:()=>$,Empty:()=>Oe,EmptyClass:()=>pe,FixedIntClass:()=>j,FixedNatClass:()=>k,Float32:()=>je,Float64:()=>ze,FloatClass:()=>ie,Func:()=>nt,FuncClass:()=>se,Int:()=>Me,Int16:()=>Ke,Int32:()=>We,Int64:()=>Ge,Int8:()=>He,IntClass:()=>ye,Nat:()=>qe,Nat16:()=>Ye,Nat32:()=>Qe,Nat64:()=>Xe,Nat8:()=>Je,NatClass:()=>ge,Null:()=>Be,NullClass:()=>fe,Opt:()=>De,OptClass:()=>W,PrimitiveType:()=>E,Principal:()=>Ze,PrincipalClass:()=>xe,Rec:()=>rt,RecClass:()=>B,Record:()=>et,RecordClass:()=>G,Reserved:()=>ke,ReservedClass:()=>Q,Service:()=>ot,ServiceClass:()=>Te,Text:()=>Ue,TextClass:()=>_e,Tuple:()=>Ie,TupleClass:()=>Z,Type:()=>Y,Unknown:()=>Lt,UnknownClass:()=>me,Variant:()=>tt,VariantClass:()=>I,Vec:()=>Le,VecClass:()=>X,Visitor:()=>de,decode:()=>It,encode:()=>Zt});import{Principal as Xt}from"@dfinity/principal";function p(...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}var M=class{constructor(t,r=t?.byteLength||0){this._buffer=t||new ArrayBuffer(0),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return 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}};function Qt(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function A(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 Qt(e)}function Se(){throw new Error("unexpected end of buffer")}function K(e,t){return e.byteLength<t&&Se(),e.read(t)}function H(e){let t=e.readUint8();return t===void 0&&Se(),t}function g(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 M(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}function N(e){let t=BigInt(1),r=BigInt(0),n;do n=H(e),r+=BigInt(n&127).valueOf()*t,t*=BigInt(128);while(n>=128);return r}function x(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 M(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 s=i%BigInt(128);return Number(t?BigInt(128)-s-BigInt(1):s)}return n.buffer}function q(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return N(e);break}let n=new Uint8Array(K(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)}function Fe(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return ve(e,t)}function ve(e,t){e=BigInt(e);let r=new M(new ArrayBuffer(Math.min(1,t)),0),n=0,o=BigInt(256),i=BigInt(0),s=Number(e%o);for(r.write(new Uint8Array([s]));++n<t;)e<0&&i===BigInt(0)&&s!==0&&(i=BigInt(1)),s=Number((e/o-i)%BigInt(256)),r.write(new Uint8Array([s])),o*=BigInt(256);return r.buffer}function Ne(e,t){let r=BigInt(H(e)),n=BigInt(1),o=0;for(;++o<t;){n*=BigInt(256);let i=BigInt(H(e));r=r+n*i}return r}function Ee(e,t){let r=Ne(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function le(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var ue="DIDL",Ae=400;function oe(e,t,r){return e.map((n,o)=>r(n,t[o]))}var be=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=g(this._typs.length),r=p(...this._typs);return p(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return x(this._idx.get(t)||0)}},de=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,s)=>[`_${s}_`,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)}},Y=class{display(){return this.name}valueToString(t){return _(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},E=class extends Y{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){}},$=class extends Y{checkType(t){if(t instanceof B){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)}},pe=class extends E{accept(t,r){return t.visitEmpty(this,r)}covariant(t){throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return x(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},me=class extends Y{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: ${_(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 B?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"}},he=class extends E{accept(t,r){return t.visitBool(this,r)}covariant(t){if(typeof t=="boolean")return!0;throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return x(-2)}decodeValue(t,r){switch(this.checkType(r),H(t)){case 0:return!1;case 1:return!0;default:throw new Error("Boolean value out of range")}}get name(){return"bool"}},fe=class extends E{accept(t,r){return t.visitNull(this,r)}covariant(t){if(t===null)return!0;throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return x(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},Q=class extends E{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return x(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}},_e=class extends E{accept(t,r){return t.visitText(this,r)}covariant(t){if(typeof t=="string")return!0;throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=g(r.byteLength);return p(n,r)}encodeType(){return x(-15)}decodeValue(t,r){this.checkType(r);let n=N(t),o=K(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},ye=class extends E{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: ${_(t)}`)}encodeValue(t){return x(t)}encodeType(){return x(-4)}decodeValue(t,r){return this.checkType(r),q(t)}get name(){return"int"}valueToString(t){return t.toString()}},ge=class extends E{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: ${_(t)}`)}encodeValue(t){return g(t)}encodeType(){return x(-3)}decodeValue(t,r){return this.checkType(r),N(t)}get name(){return"nat"}valueToString(t){return t.toString()}},ie=class extends E{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: ${_(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 x(t)}decodeValue(t,r){this.checkType(r);let n=K(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()}},j=class extends E{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=le(this._bits-1)*BigInt(-1),n=le(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: ${_(t)}`)}encodeValue(t){return ve(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return x(-9-t)}decodeValue(t,r){this.checkType(r);let n=Ee(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},k=class extends E{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=le(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: ${_(t)}`)}encodeValue(t){return Fe(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return x(-5-t)}decodeValue(t,r){this.checkType(r);let n=Ne(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},X=class extends ${constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof k&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof k?this._type._bits:this._type instanceof j?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:
|
|
23
2
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
3
|
+
index ${o} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(t){let r=g(t.length);if(this._blobOptimization)return p(r,new Uint8Array(t));if(ArrayBuffer.isView(t))return p(r,new Uint8Array(t.buffer));let n=new M(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=x(-19),n=this._type.encodeType(t);t.add(this,p(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof X))throw new Error("Not a vector type");let o=Number(N(t));if(this._type instanceof k){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 j){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 s=0;s<o;s++)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("; ")+"}"}},W=class extends ${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: ${_(t)}
|
|
4
|
+
|
|
5
|
+
-> ${r.message}`)}throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(t){return t.length===0?new Uint8Array([0]):p(new Uint8Array([1]),this._type.encodeValue(t[0]))}_buildTypeTableImpl(t){this._type.buildTypeTable(t);let r=x(-18),n=this._type.encodeType(t);t.add(this,p(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof W))throw new Error("Not an option type");switch(H(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])}`}},G=class extends ${constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>A(r[0])-A(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:
|
|
6
|
+
|
|
7
|
+
field ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(t){let r=this._fields.map(([o])=>t[o]),n=oe(this._fields,r,([,o],i)=>o.encodeValue(i));return p(...n)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=x(-20),n=g(this._fields.length),o=this._fields.map(([i,s])=>p(g(A(i)),s.encodeType(t)));t.add(this,p(r,n,p(...o)))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof G))throw new Error("Not a record type");let o={},i=0,s=0;for(;s<n._fields.length;){let[l,u]=n._fields[s];if(i>=this._fields.length){u.decodeValue(t,u),s++;continue}let[c,f]=this._fields[i],y=A(this._fields[i][0]),C=A(l);if(y===C)o[c]=f.decodeValue(t,u),i++,s++;else if(C>y)if(f instanceof W||f instanceof Q)o[c]=[],i++;else throw new Error("Cannot find required field "+c);else u.decodeValue(t,u),s++}for(let[l,u]of this._fields.slice(i))if(u instanceof W||u instanceof Q)o[l]=[];else throw new Error("Cannot find required field "+l);return o}get name(){return`record {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`record {${this._fields.map(([r,n])=>r+":"+n.display()).join("; ")}}`}valueToString(t){let r=this._fields.map(([o])=>t[o]);return`record {${oe(this._fields,r,([o,i],s)=>o+"="+i.valueToString(s)).join("; ")}}`}},Z=class extends G{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:
|
|
8
|
+
|
|
9
|
+
index ${n} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(t){let r=oe(this._components,t,(n,o)=>n.encodeValue(o));return p(...r)}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof Z))throw new Error("not a tuple type");if(n._components.length<this._components.length)throw new Error("tuple mismatch");let o=[];for(let[i,s]of n._components.entries())i>=this._components.length?s.decodeValue(t,s):o.push(this._components[i].decodeValue(t,s));return o}display(){return`record {${this._components.map(r=>r.display()).join("; ")}}`}valueToString(t){return`record {${oe(this._components,t,(n,o)=>n.valueToString(o)).join("; ")}}`}},I=class extends ${constructor(t={}){super(),this._fields=Object.entries(t).sort((r,n)=>A(r[0])-A(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:
|
|
10
|
+
|
|
11
|
+
variant ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(t){for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(t.hasOwnProperty(n)){let i=g(r),s=o.encodeValue(t[n]);return p(i,s)}}throw Error("Variant has no data: "+t)}_buildTypeTableImpl(t){this._fields.forEach(([,i])=>{i.buildTypeTable(t)});let r=x(-21),n=g(this._fields.length),o=this._fields.map(([i,s])=>p(g(A(i)),s.encodeType(t)));t.add(this,p(r,n,...o))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof I))throw new Error("Not a variant type");let o=Number(N(t));if(o>=n._fields.length)throw Error("Invalid variant index: "+o);let[i,s]=n._fields[o];for(let[l,u]of this._fields)if(A(i)===A(l)){let c=u.decodeValue(t,s);return{[l]:c}}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)}},B=class extends ${constructor(){super(...arguments),this._id=B._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: ${_(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)}};B._counter=0;function Re(e){if(H(e)!==1)throw new Error("Cannot decode principal");let r=Number(N(e));return Xt.fromUint8Array(new Uint8Array(K(e,r)))}var xe=class extends E{accept(t,r){return t.visitPrincipal(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=g(r.byteLength);return p(new Uint8Array([1]),n,r)}encodeType(){return x(-24)}decodeValue(t,r){return this.checkType(r),Re(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}},se=class extends ${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: ${_(t)}`)}encodeValue([t,r]){let n=t.toUint8Array(),o=g(n.byteLength),i=p(new Uint8Array([1]),o,n),s=new TextEncoder().encode(r),l=g(s.byteLength);return p(new Uint8Array([1]),i,l,s)}_buildTypeTableImpl(t){this.argTypes.forEach(c=>c.buildTypeTable(t)),this.retTypes.forEach(c=>c.buildTypeTable(t));let r=x(-22),n=g(this.argTypes.length),o=p(...this.argTypes.map(c=>c.encodeType(t))),i=g(this.retTypes.length),s=p(...this.retTypes.map(c=>c.encodeType(t))),l=g(this.annotations.length),u=p(...this.annotations.map(c=>this.encodeAnnotation(c)));t.add(this,p(r,n,o,i,s,l,u))}decodeValue(t){if(H(t)!==1)throw new Error("Cannot decode function reference");let n=Re(t),o=Number(N(t)),i=K(t,o),l=new TextDecoder("utf8",{fatal:!0}).decode(i);return[n,l]}get name(){let t=this.argTypes.map(o=>o.name).join(", "),r=this.retTypes.map(o=>o.name).join(", "),n=" "+this.annotations.join(" ");return`(${t}) -> (${r})${n}`}valueToString([t,r]){return`func "${t.toText()}".${r}`}display(){let t=this.argTypes.map(o=>o.display()).join(", "),r=this.retTypes.map(o=>o.display()).join(", "),n=" "+this.annotations.join(" ");return`(${t}) \u2192 (${r})${n}`}encodeAnnotation(t){if(t==="query")return new Uint8Array([1]);if(t==="oneway")return new Uint8Array([2]);if(t==="composite_query")return new Uint8Array([3]);throw new Error("Illegal function annotation")}},Te=class extends ${constructor(t){super(),this._fields=Object.entries(t).sort((r,n)=>A(r[0])-A(n[0]))}accept(t,r){return t.visitService(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${_(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=g(r.length);return p(new Uint8Array([1]),n,r)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=x(-23),n=g(this._fields.length),o=this._fields.map(([i,s])=>{let l=new TextEncoder().encode(i),u=g(l.length);return p(u,l,s.encodeType(t))});t.add(this,p(r,n,...o))}decodeValue(t){return Re(t)}get name(){return`service {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}valueToString(t){return`service "${t.toText()}"`}};function _(e){let t=JSON.stringify(e,(r,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>Ae?t.substring(0,Ae-3)+"...":t}function Zt(e,t){if(t.length<e.length)throw Error("Wrong number of message arguments");let r=new be;e.forEach(u=>u.buildTypeTable(r));let n=new TextEncoder().encode(ue),o=r.encode(),i=g(t.length),s=p(...e.map(u=>u.encodeType(r))),l=p(...oe(e,t,(u,c)=>{try{u.covariant(c)}catch(f){throw new Error(f.message+`
|
|
12
|
+
|
|
13
|
+
`)}return u.encodeValue(c)}));return p(n,o,i,s,l)}function It(e,t){let r=new M(t);if(t.byteLength<ue.length)throw new Error("Message length smaller than magic number");let n=K(r,ue.length),o=new TextDecoder().decode(n);if(o!==ue)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let d=[],h=Number(N(a));for(let m=0;m<h;m++){let b=Number(q(a));switch(b){case-18:case-19:{let v=Number(q(a));d.push([b,v]);break}case-20:case-21:{let v=[],R=Number(N(a)),V;for(;R--;){let S=Number(N(a));if(S>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof V=="number"&&V>=S)throw new Error("field id collision or not sorted");V=S;let F=Number(q(a));v.push([S,F])}d.push([b,v]);break}case-22:{let v=[],R=Number(N(a));for(;R--;)v.push(Number(q(a)));let V=[],S=Number(N(a));for(;S--;)V.push(Number(q(a)));let F=[],U=Number(N(a));for(;U--;)switch(Number(N(a))){case 1:{F.push("query");break}case 2:{F.push("oneway");break}case 3:{F.push("composite_query");break}default:throw new Error("unknown annotation")}d.push([b,[v,V,F]]);break}case-23:{let v=Number(N(a)),R=[];for(;v--;){let V=Number(N(a)),S=new TextDecoder().decode(K(a,V)),F=q(a);R.push([S,F])}d.push([b,R]);break}default:throw new Error("Illegal op_code: "+b)}}let T=[],w=Number(N(a));for(let m=0;m<w;m++)T.push(Number(q(a)));return[d,T]}let[s,l]=i(r);if(l.length<e.length)throw new Error("Wrong number of return values");let u=s.map(a=>rt());function c(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return Be;case-2:return $e;case-3:return qe;case-4:return Me;case-5:return Je;case-6:return Ye;case-7:return Qe;case-8:return Xe;case-9:return He;case-10:return Ke;case-11:return We;case-12:return Ge;case-13:return je;case-14:return ze;case-15:return Ue;case-16:return ke;case-17:return Oe;case-24:return Ze;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return u[a]}function f(a){switch(a[0]){case-19:{let d=c(a[1]);return Le(d)}case-18:{let d=c(a[1]);return De(d)}case-20:{let d={};for(let[w,m]of a[1]){let b=`_${w}_`;d[b]=c(m)}let h=et(d),T=h.tryAsTuple();return Array.isArray(T)?Ie(...T):h}case-21:{let d={};for(let[h,T]of a[1]){let w=`_${h}_`;d[w]=c(T)}return tt(d)}case-22:{let[d,h,T]=a[1];return nt(d.map(w=>c(w)),h.map(w=>c(w)),T)}case-23:{let d={},h=a[1];for(let[T,w]of h){let m=c(w);if(m instanceof B&&(m=m.getType()),!(m instanceof se))throw new Error("Illegal service definition: services can only contain functions");d[T]=m}return ot(d)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,d)=>{if(a[0]===-22){let h=f(a);u[d].fill(h)}}),s.forEach((a,d)=>{if(a[0]!==-22){let h=f(a);u[d].fill(h)}});let y=l.map(a=>c(a)),C=e.map((a,d)=>a.decodeValue(r,y[d]));for(let a=e.length;a<y.length;a++)y[a].decodeValue(r,y[a]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return C}var Oe=new pe,ke=new Q,Lt=new me,$e=new he,Be=new fe,Ue=new _e,Me=new ye,qe=new ge,je=new ie(32),ze=new ie(64),He=new j(8),Ke=new j(16),We=new j(32),Ge=new j(64),Je=new k(8),Ye=new k(16),Qe=new k(32),Xe=new k(64),Ze=new xe;function Ie(...e){return new Z(e)}function Le(e){return new X(e)}function De(e){return new W(e)}function et(e){return new G(e)}function tt(e){return new I(e)}function rt(){return new B}function nt(e,t,r=[]){return new se(e,t,r)}function ot(e){return new Te(e)}import{Principal as Sr}from"@dfinity/principal";import{Principal as sr}from"@dfinity/principal";import{Principal as dt}from"@dfinity/principal";var it=({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=e.Record({network:t}),s=e.Nat64,l=e.Record({network:t,filter:e.Opt(e.Variant({page:e.Vec(e.Nat8),min_confirmations:e.Nat32})),address:r}),u=e.Vec(e.Nat8),c=e.Record({txid:e.Vec(e.Nat8),vout:e.Nat32}),f=e.Record({height:e.Nat32,value:o,outpoint:c}),y=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:u,utxos:e.Vec(f)}),C=e.Record({transaction:e.Vec(e.Nat8),network:t}),a=e.Principal,d=e.Variant({from_user:e.Record({user_id:e.Principal}),from_canister:e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal})}),h=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}),T=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:d,details:h}),w=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),m=e.Record({freezing_threshold:e.Opt(e.Nat),controllers:e.Opt(e.Vec(e.Principal)),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),b=e.Variant({secp256k1:e.Null}),v=e.Record({value:e.Text,name:e.Text}),R=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(v)}),V=e.Vec(e.Nat8);return e.Service({bitcoin_get_balance:e.Func([n],[o],[]),bitcoin_get_current_fee_percentiles:e.Func([i],[e.Vec(s)],[]),bitcoin_get_utxos:e.Func([l],[y],[]),bitcoin_send_transaction:e.Func([C],[],[]),canister_info:e.Func([e.Record({canister_id:a,num_requested_changes:e.Opt(e.Nat64)})],[e.Record({controllers:e.Vec(e.Principal),module_hash:e.Opt(e.Vec(e.Nat8)),recent_changes:e.Vec(T),total_num_changes:e.Nat64})],[]),canister_status:e.Func([e.Record({canister_id:a})],[e.Record({status:e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),memory_size:e.Nat,cycles:e.Nat,settings:w,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))})],[]),create_canister:e.Func([e.Record({settings:e.Opt(m),sender_canister_version:e.Opt(e.Nat64)})],[e.Record({canister_id:a})],[]),delete_canister:e.Func([e.Record({canister_id:a})],[],[]),deposit_cycles:e.Func([e.Record({canister_id:a})],[],[]),ecdsa_public_key:e.Func([e.Record({key_id:e.Record({name:e.Text,curve:b}),canister_id:e.Opt(a),derivation_path:e.Vec(e.Vec(e.Nat8))})],[e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)})],[]),http_request:e.Func([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:R})],[R],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(v)})],[R],[]),install_code:e.Func([e.Record({arg:e.Vec(e.Nat8),wasm_module:V,mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),canister_id:a,sender_canister_version:e.Opt(e.Nat64)})],[],[]),provisional_create_canister_with_cycles:e.Func([e.Record({settings:e.Opt(m),specified_id:e.Opt(a),amount:e.Opt(e.Nat)})],[e.Record({canister_id:a})],[]),provisional_top_up_canister:e.Func([e.Record({canister_id:a,amount:e.Nat})],[],[]),raw_rand:e.Func([],[e.Vec(e.Nat8)],[]),sign_with_ecdsa:e.Func([e.Record({key_id:e.Record({name:e.Text,curve:b}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)})],[e.Record({signature:e.Vec(e.Nat8)})],[]),start_canister:e.Func([e.Record({canister_id:a})],[],[]),stop_canister:e.Func([e.Record({canister_id:a})],[],[]),uninstall_code:e.Func([e.Record({canister_id:a,sender_canister_version:e.Opt(e.Nat64)})],[],[]),update_settings:e.Func([e.Record({canister_id:e.Principal,settings:m,sender_canister_version:e.Opt(e.Nat64)})],[],[])})};var st=({IDL:e})=>{let t=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id: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.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),i=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),s=e.Record({status:o,memory_size:e.Nat,cycles:e.Nat,settings:i,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),l=e.Record({id:e.Principal,status:s,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),u=e.Variant({Ok:l,Err:e.Text}),c=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),f=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),y=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),satellites:e.Vec(e.Tuple(e.Principal,f)),cycles_threshold:e.Opt(e.Nat64)}),C=e.Record({satellites:e.Opt(e.Vec(u)),mission_control:u}),a=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_satellite:e.Func([e.Text],[t],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,u))],["query"]),list_satellite_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,u)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,t))],["query"]),remove_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),remove_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),c],[],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[t],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),c],[],[]),status:e.Func([y],[C],[]),top_up:e.Func([e.Principal,a],[],[]),version:e.Func([],[e.Text],["query"])})};var at=({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))))}),s=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),u=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),c=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}),f=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),y=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(f),status_code:e.Nat16}),C=e.Record({token:e.Opt(c),body:e.Vec(e.Nat8)}),a=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),d=e.Record({batch_id:e.Nat}),h=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),T=e.Record({field:h,desc:e.Bool}),w=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),m=e.Record({order:e.Opt(T),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(w)}),b=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),R=e.Record({key:b,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),V=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,R))}),S=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),F=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),U=e.Variant({Db:e.Null,Storage:e.Null}),O=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),L=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:O,created_at:e.Nat64,write:O}),z=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),D=e.Record({controller:z,controllers:e.Vec(e.Principal)}),ee=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),te=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:O,write:O}),re=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),ne=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([],[s],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(l)],["query"]),http_request:e.Func([u],[y],["query"]),http_request_streaming_callback:e.Func([c],[C],["query"]),init_asset_upload:e.Func([a],[d],[]),list_assets:e.Func([e.Opt(e.Text),m],[V],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,S))],["query"]),list_docs:e.Func([e.Text,m],[F],["query"]),list_rules:e.Func([U],[e.Vec(e.Tuple(e.Text,L))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([D],[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,ee],[l],[]),set_rule:e.Func([U,e.Text,te],[],[]),upload_asset_chunk:e.Func([re],[ne],[]),version:e.Func([],[e.Text],["query"])})};var ct=({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))))}),s=e.Record({storage:i}),l=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),u=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),c=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}),f=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),y=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(f),status_code:e.Nat16}),C=e.Record({token:e.Opt(c),body:e.Vec(e.Nat8)}),a=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),d=e.Record({batch_id:e.Nat}),h=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),T=e.Record({field:h,desc:e.Bool}),w=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),m=e.Record({order:e.Opt(T),matcher:e.Opt(e.Text),paginate:e.Opt(w)}),b=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),R=e.Record({key:b,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),V=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,R))}),S=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),F=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),U=e.Variant({Db:e.Null,Storage:e.Null}),O=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),L=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:O,created_at:e.Nat64,write:O}),z=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),D=e.Record({controller:z,controllers:e.Vec(e.Principal)}),ee=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),te=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:O,write:O}),re=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),ne=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([],[s],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(l)],["query"]),http_request:e.Func([u],[y],["query"]),http_request_streaming_callback:e.Func([c],[C],["query"]),init_asset_upload:e.Func([a],[d],[]),list_assets:e.Func([e.Opt(e.Text),m],[V],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,S))],["query"]),list_docs:e.Func([e.Text,m],[F],["query"]),list_rules:e.Func([U],[e.Vec(e.Tuple(e.Text,L))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([D],[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,ee],[l],[]),set_rule:e.Func([U,e.Text,te],[],[]),upload_asset_chunk:e.Func([re],[ne],[]),version:e.Func([],[e.Text],["query"])})};var lt=({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({updated_at:e.Opt(e.Nat64)}),s=e.Variant({Db:e.Null,Storage:e.Null}),l=e.Record({rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),u=e.Record({storage:l}),c=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at: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))}),y=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}),C=e.Variant({Callback:e.Record({token:y,callback:e.Func([],[],[])})}),a=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(C),status_code:e.Nat16}),d=e.Record({token:e.Opt(y),body:e.Vec(e.Nat8)}),h=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}),T=e.Record({batch_id:e.Nat}),w=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),m=e.Record({field:w,desc:e.Bool}),b=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),v=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),R=e.Record({order:e.Opt(m),owner:e.Opt(e.Principal),matcher:e.Opt(b),paginate:e.Opt(v)}),V=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}),S=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),F=e.Record({key:V,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}),U=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,F)),items_length:e.Nat64}),O=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),L=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,c)),items_length:e.Nat64}),z=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),D=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:z,created_at:e.Nat64,write:z}),ee=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),te=e.Record({controller:ee,controllers:e.Vec(e.Principal)}),re=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8),description:e.Opt(e.Text)}),ne=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:z,write:z}),Wt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Gt=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.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_rule:e.Func([s,e.Text,i],[],[]),get_config:e.Func([],[u],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(c)],["query"]),http_request:e.Func([f],[a],["query"]),http_request_streaming_callback:e.Func([y],[d],["query"]),init_asset_upload:e.Func([h],[T],[]),list_assets:e.Func([e.Text,R],[U],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,O))],["query"]),list_docs:e.Func([e.Text,R],[L],["query"]),list_rules:e.Func([s],[e.Vec(e.Tuple(e.Text,D))],["query"]),set_config:e.Func([u],[],[]),set_controllers:e.Func([te],[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,re],[c],[]),set_rule:e.Func([s,e.Text,ne],[],[]),upload_asset_chunk:e.Func([Wt],[Gt],[]),version:e.Func([],[e.Text],["query"])})};import{Actor as er,HttpAgent as tr}from"@dfinity/agent";var Ve=async({canisterId:e,idlFactory:t,identity:r,fetch:n,env:o="prod",config:i})=>{let s=o==="dev"?"http://127.0.0.1:8000/":"https://icp0.io",l=new tr({identity:r,...s&&{host:s},...n&&{fetch:n}});return o==="dev"&&await l.fetchRootKey(),er.createActor(t,{agent:l,canisterId:e,...i!==void 0?i:{}})};var pt=async({satelliteId:e,...t})=>we({canisterId:e,...t,idlFactory:ct}),J=async({satelliteId:e,...t})=>we({canisterId:e,...t,idlFactory:lt}),mt=async({satelliteId:e,...t})=>we({canisterId:e,...t,idlFactory:at}),ae=async({missionControlId:e,...t})=>we({canisterId:e,...t,idlFactory:st});var we=async({canisterId:e,idlFactory:t,...r})=>{if(!e)throw new Error("No canister ID provided.");return Ve({canisterId:e,idlFactory:t,...r})},ht=dt.fromText("aaaaa-aa"),ut=(e,t,r)=>{let n=t[0],o=ht;return n&&typeof n=="object"&&n.canister_id&&(o=dt.from(n.canister_id)),{effectiveCanisterId:o}},ft=e=>Ve({canisterId:ht.toText(),config:{callTransform:ut,queryTransform:ut},idlFactory:it,...e});var ce=async({actor:e,code:t})=>{let{install_code:r}=await ft(e);return r({...t,mode:{upgrade:null},sender_canister_version:[]})};var _t=async({missionControl:e})=>(await ae(e)).version(),yt=async({missionControl:e})=>(await ae(e)).get_user();var gt=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await ae(e)).set_satellites_controllers(t,r,n),xt=async({missionControl:e,controllerIds:t,controller:r})=>(await ae(e)).set_mission_control_controllers(t,r);import{Principal as rr}from"@dfinity/principal";import{nonNullish as nr,toNullable as or}from"@junobuild/utils";var Pe=({controllerId:e,profile:t})=>({controllerIds:[rr.fromText(e)],controller:ir(t)}),ir=e=>({metadata:nr(e)&&e!==""?[["profile",e]]:[],expires_at:or(void 0),scope:{Admin:null}});var fn=async e=>_t(e),_n=async({missionControl:e,wasm_module:t})=>{let r=await yt({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=P.encode([P.Record({user:P.Principal})],[{user:r}]);await ce({actor:o,code:{canister_id:sr.fromText(n),arg:new Uint8Array(i),wasm_module:t}})},yn=async({controllerId:e,profile:t,...r})=>gt({...r,...Pe({controllerId:e,profile:t})}),gn=async({controllerId:e,profile:t,...r})=>xt({...r,...Pe({controllerId:e,profile:t})});import{major as Tt,minor as wt,patch as vt}from"semver";var wn=({currentVersion:e,selectedVersion:t})=>{let r=Tt(e),n=Tt(t),o=wt(e),i=wt(t),s=vt(e),l=vt(t);return r<n-1||o<i-1||s<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as Kt}from"@dfinity/principal";import{fromNullable as ur}from"@junobuild/utils";var Nt=async({config:e,satellite:t})=>(await J(t)).set_config(e),bt=async({satellite:e,type:t})=>(await J(e)).list_rules(t),Rt=async({type:e,collection:t,rule:r,satellite:n})=>(await J(n)).set_rule(e,t,r),Vt=async({satellite:e})=>(await J(e)).version(),Pt=async({satellite:e})=>(await pt(e)).list_controllers(),Ct=async({satellite:e})=>(await mt(e)).list_controllers(),St=async({satellite:e})=>(await J(e)).list_controllers(),Ft=async({satellite:e})=>(await J(e)).list_custom_domains();var Et=[{source:"**",destination:"/index.html"}];import{fromNullable as ar,isNullish as cr,nonNullish as jt,toNullable as lr}from"@junobuild/utils";var At={Db:null},Ot={Storage:null},kt={Public:null},$t={Private:null},Bt={Managed:null},Ut={Controllers:null};var Ce=e=>e==="storage"?Ot:At,zt=({read:e,write:t,max_size:r,updated_at:n})=>({read:qt(e),write:qt(t),updated_at:cr(n)?[]:[n],max_size:lr(jt(r)&&r>0?BigInt(r):void 0)}),Ht=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:s}=t,l=s?.[0]??0n>0n?Number(ar(s)):void 0;return{collection:e,read:Mt(r),write:Mt(n),updated_at:o,created_at:i,...jt(l)&&{max_size:l}}},Mt=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",qt=e=>{switch(e){case"public":return kt;case"private":return $t;case"managed":return Bt;default:return Ut}};var Un=async({config:{storage:{headers:e,rewrites:t}},satellite:r})=>{let n=(e??[]).map(({source:i,headers:s})=>[i,s]),o=(t??Et).map(({source:i,destination:s})=>[i,s]);return Nt({satellite:r,config:{storage:{headers:n,rewrites:o}}})},Mn=async({type:e,satellite:t})=>(await bt({satellite:t,type:Ce(e)})).map(n=>Ht(n)),qn=async({rule:{collection:e,...t},type:r,satellite:n})=>Rt({type:Ce(r),rule:zt(t),satellite:n,collection:e}),jn=async e=>Vt(e),zn=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n})=>{let{satelliteId:o,...i}=e;if(!o)throw new Error("No satellite principal defined.");if(r){let c=await Pt({satellite:e}),f=P.encode([P.Record({controllers:P.Vec(P.Principal)})],[{controllers:c}]);await ce({actor:i,code:{canister_id:Kt.fromText(o),arg:new Uint8Array(f),wasm_module:t}});return}let l=await(n?Ct:St)({satellite:e}),u=P.encode([P.Record({controllers:P.Vec(P.Principal)})],[{controllers:l.map(([c,f])=>c)}]);await ce({actor:i,code:{canister_id:Kt.fromText(o),arg:new Uint8Array(u),wasm_module:t}})},Hn=async({satellite:e})=>(await Ft({satellite:e})).map(([r,n])=>({domain:r,bn_id:ur(n.bn_id),created_at:n.created_at,updated_at:n.updated_at}));export{wn as checkUpgradeVersion,Hn as listCustomDomains,Mn as listRules,fn as missionControlVersion,jn as satelliteVersion,Un as setConfig,gn as setMissionControlController,qn as setRule,yn as setSatellitesController,_n as upgradeMissionControl,zn as upgradeSatellite};
|
|
32
14
|
//# sourceMappingURL=index.js.map
|