@junobuild/admin 0.0.44-next-2024-02-02 → 0.0.44-next-2024-02-02.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/declarations/satellite/satellite.did.d.ts +1 -1
- package/declarations/satellite/satellite.factory.did.js +2 -2
- package/declarations/satellite/satellite.factory.did.mjs +2 -2
- package/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +3 -3
- package/dist/declarations/satellite/satellite.did.d.ts +1 -1
- package/dist/declarations/satellite/satellite.factory.did.js +2 -2
- package/dist/declarations/satellite/satellite.factory.did.mjs +2 -2
- package/dist/node/index.mjs +1 -1
- package/dist/node/index.mjs.map +3 -3
- package/dist/types/api/satellite.api.d.ts +1 -1
- package/dist/types/services/satellite.services.d.ts +1 -1
- package/package.json +1 -1
|
@@ -194,6 +194,7 @@ export interface UploadChunkResult {
|
|
|
194
194
|
chunk_id: bigint;
|
|
195
195
|
}
|
|
196
196
|
export interface _SERVICE {
|
|
197
|
+
build_version: ActorMethod<[], string>;
|
|
197
198
|
commit_asset_upload: ActorMethod<[CommitBatch], undefined>;
|
|
198
199
|
count_assets: ActorMethod<[string], bigint>;
|
|
199
200
|
count_docs: ActorMethod<[string], bigint>;
|
|
@@ -232,6 +233,5 @@ export interface _SERVICE {
|
|
|
232
233
|
set_rule: ActorMethod<[RulesType, string, SetRule], undefined>;
|
|
233
234
|
upload_asset_chunk: ActorMethod<[UploadChunk], UploadChunkResult>;
|
|
234
235
|
version: ActorMethod<[], string>;
|
|
235
|
-
version_build: ActorMethod<[], string>;
|
|
236
236
|
}
|
|
237
237
|
export declare const idlFactory: IDL.InterfaceFactory;
|
|
@@ -194,6 +194,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
194
194
|
});
|
|
195
195
|
const UploadChunkResult = IDL.Record({chunk_id: IDL.Nat});
|
|
196
196
|
return IDL.Service({
|
|
197
|
+
build_version: IDL.Func([], [IDL.Text], ['query']),
|
|
197
198
|
commit_asset_upload: IDL.Func([CommitBatch], [], []),
|
|
198
199
|
count_assets: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
|
|
199
200
|
count_docs: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
|
|
@@ -252,8 +253,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
252
253
|
),
|
|
253
254
|
set_rule: IDL.Func([RulesType, IDL.Text, SetRule], [], []),
|
|
254
255
|
upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []),
|
|
255
|
-
version: IDL.Func([], [IDL.Text], ['query'])
|
|
256
|
-
version_build: IDL.Func([], [IDL.Text], ['query'])
|
|
256
|
+
version: IDL.Func([], [IDL.Text], ['query'])
|
|
257
257
|
});
|
|
258
258
|
};
|
|
259
259
|
// @ts-ignore
|
|
@@ -194,6 +194,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
194
194
|
});
|
|
195
195
|
const UploadChunkResult = IDL.Record({chunk_id: IDL.Nat});
|
|
196
196
|
return IDL.Service({
|
|
197
|
+
build_version: IDL.Func([], [IDL.Text], ['query']),
|
|
197
198
|
commit_asset_upload: IDL.Func([CommitBatch], [], []),
|
|
198
199
|
count_assets: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
|
|
199
200
|
count_docs: IDL.Func([IDL.Text], [IDL.Nat64], ['query']),
|
|
@@ -252,8 +253,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
252
253
|
),
|
|
253
254
|
set_rule: IDL.Func([RulesType, IDL.Text, SetRule], [], []),
|
|
254
255
|
upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []),
|
|
255
|
-
version: IDL.Func([], [IDL.Text], ['query'])
|
|
256
|
-
version_build: IDL.Func([], [IDL.Text], ['query'])
|
|
256
|
+
version: IDL.Func([], [IDL.Text], ['query'])
|
|
257
257
|
});
|
|
258
258
|
};
|
|
259
259
|
// @ts-ignore
|
package/dist/browser/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var gr=Object.defineProperty;var xr=(e,t)=>{for(var r in t)gr(e,r,{get:t[r],enumerable:!0})};import{Principal as $r}from"@dfinity/principal";import{CanisterStatus as vr}from"@dfinity/agent";import{Principal as Pr}from"@dfinity/principal";import{assertNonNullish as Vr}from"@junobuild/utils";import{Actor as Tr,HttpAgent as wr}from"@dfinity/agent";import{nonNullish as br}from"@junobuild/utils";var ve=async({canisterId:e,idlFactory:t,config:r,...n})=>{let o=await Pe(n);return Tr.createActor(t,{agent:o,canisterId:e,...r!==void 0?r:{}})},Pe=async({identity:e,fetch:t,container:r})=>{let n=br(r)&&r!==!1,o=n?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io",i=new wr({identity:e,host:o,...t&&{fetch:t}});return n&&await i.fetchRootKey(),i};import{Principal as Ge}from"@dfinity/principal";import{isNullish as Nr}from"@junobuild/utils";var qe=({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}),d=e.Record({height:e.Nat32,value:o,outpoint:c}),_=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:u,utxos:e.Vec(d)}),R=e.Record({transaction:e.Vec(e.Nat8),network:t}),a=e.Principal,p=e.Variant({from_user:e.Record({user_id:e.Principal}),from_canister:e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal})}),m=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}),g=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:p,details:m}),y=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),h=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)}),N=e.Variant({secp256k1:e.Null}),T=e.Record({value:e.Text,name:e.Text}),P=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(T)}),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],[_],[]),bitcoin_send_transaction:e.Func([R],[],[]),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(g),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:y,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))})],[]),create_canister:e.Func([e.Record({settings:e.Opt(h),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:N}),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:P})],[P],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(T)})],[P],[]),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(h),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:N}),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:h,sender_canister_version:e.Opt(e.Nat64)})],[],[])})};var je=({IDL:e})=>{let t=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),r=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),n=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Variant({Write:e.Null,Admin:e.Null}),i=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:o,expires_at:e.Opt(e.Nat64)}),s=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),l=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),u=e.Record({status:s,memory_size:e.Nat,cycles:e.Nat,settings:l,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),c=e.Record({id:e.Principal,status:u,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),d=e.Variant({Ok:c,Err:e.Text}),_=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:o,expires_at:e.Opt(e.Nat64)}),R=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),a=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,R)),satellites:e.Vec(e.Tuple(e.Principal,R)),cycles_threshold:e.Opt(e.Nat64)}),p=e.Record({orbiters:e.Opt(e.Vec(d)),satellites:e.Opt(e.Vec(d)),mission_control:d}),m=e.Record({e8s:e.Nat64});return e.Service({add_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),add_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),create_orbiter:e.Func([e.Opt(e.Text)],[t],[]),create_satellite:e.Func([e.Text],[r],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([n],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,i))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,d))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,d)))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,t))],["query"]),list_satellite_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,d)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,r))],["query"]),remove_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),remove_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),_],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[t],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[t],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),_],[],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[r],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),_],[],[]),status:e.Func([a],[p],[]),top_up:e.Func([e.Principal,m],[],[]),version:e.Func([],[e.Text],["query"])})};var ze=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:r,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({cycles:e.Nat,destination_id:e.Principal}),s=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),l=e.Record({key:e.Text,collected_at:e.Nat64}),u=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),c=e.Record({title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:u,user_agent:e.Opt(e.Text)}),d=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),_=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),R=e.Record({browsers:d,devices:_}),a=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),p=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(a,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),m=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),g=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal}),y=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),h=e.Record({updated_at:e.Nat64,created_at:e.Nat64,enabled:e.Bool}),N=e.Record({stable:e.Nat64,heap:e.Nat64}),T=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),P=e.Record({controller:T,controllers:e.Vec(e.Principal)}),v=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,satellite_id:e.Principal,device:u,user_agent:e.Opt(e.Text)}),C=e.Variant({Ok:c,Err:e.Text}),S=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(l,e.Text))}),k=e.Record({updated_at:e.Opt(e.Nat64),enabled:e.Bool}),A=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,user_agent:e.Opt(e.Text)}),J=e.Variant({Ok:g,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,n))],[]),del_satellite_config:e.Func([e.Principal,o],[],[]),deposit_cycles:e.Func([i],[],[]),get_page_views:e.Func([s],[e.Vec(e.Tuple(l,c))],["query"]),get_page_views_analytics_clients:e.Func([s],[R],["query"]),get_page_views_analytics_metrics:e.Func([s],[p],["query"]),get_page_views_analytics_top_10:e.Func([s],[m],["query"]),get_track_events:e.Func([s],[e.Vec(e.Tuple(l,g))],["query"]),get_track_events_analytics:e.Func([s],[y],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,h))],["query"]),memory_size:e.Func([],[N],["query"]),set_controllers:e.Func([P],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([l,v],[C],[]),set_page_views:e.Func([e.Vec(e.Tuple(l,v))],[S],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,k))],[e.Vec(e.Tuple(e.Principal,h))],[]),set_track_event:e.Func([l,A],[J],[]),set_track_events:e.Func([e.Vec(e.Tuple(l,A))],[S],[]),version:e.Func([],[e.Text],["query"])})};var He=({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}),d=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),_=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(d),status_code:e.Nat16}),R=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}),p=e.Record({batch_id:e.Nat}),m=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),g=e.Record({field:m,desc:e.Bool}),y=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),h=e.Record({order:e.Opt(g),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(y)}),N=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),P=e.Record({key:N,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,T)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),v=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,P))}),C=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),S=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),k=e.Variant({Db:e.Null,Storage:e.Null}),A=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),J=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:A,created_at:e.Nat64,write:A}),Y=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),D=e.Record({controller:Y,controllers:e.Vec(e.Principal)}),L=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),ee=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:A,write:A}),z=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),te=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],[_],["query"]),http_request_streaming_callback:e.Func([c],[R],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),h],[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,C))],["query"]),list_docs:e.Func([e.Text,h],[S],["query"]),list_rules:e.Func([k],[e.Vec(e.Tuple(e.Text,J))],["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,L],[l],[]),set_rule:e.Func([k,e.Text,ee],[],[]),upload_asset_chunk:e.Func([z],[te],[]),version:e.Func([],[e.Text],["query"])})};var Ke=({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}),d=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),_=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(d),status_code:e.Nat16}),R=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}),p=e.Record({batch_id:e.Nat}),m=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),g=e.Record({field:m,desc:e.Bool}),y=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),h=e.Record({order:e.Opt(g),matcher:e.Opt(e.Text),paginate:e.Opt(y)}),N=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),P=e.Record({key:N,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,T)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),v=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,P))}),C=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),S=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),k=e.Variant({Db:e.Null,Storage:e.Null}),A=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),J=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:A,created_at:e.Nat64,write:A}),Y=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),D=e.Record({controller:Y,controllers:e.Vec(e.Principal)}),L=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),ee=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:A,write:A}),z=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),te=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],[_],["query"]),http_request_streaming_callback:e.Func([c],[R],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),h],[v],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,C))],["query"]),list_docs:e.Func([e.Text,h],[S],["query"]),list_rules:e.Func([k],[e.Vec(e.Tuple(e.Text,J))],["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,L],[l],[]),set_rule:e.Func([k,e.Text,ee],[],[]),upload_asset_chunk:e.Func([z],[te],[]),version:e.Func([],[e.Text],["query"])})};var We=({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({cycles:e.Nat,destination_id:e.Principal}),u=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}),c=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),d=e.Record({key:u,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,c)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),_=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),R=e.Record({status_code:e.Nat16,location:e.Text}),a=e.Record({iframe:e.Opt(_),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),redirects:e.Opt(e.Vec(e.Tuple(e.Text,R)))}),p=e.Record({storage:a}),m=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64}),g=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),y=e.Variant({Heap:e.Null,Stable:e.Null}),h=e.Record({memory:y,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}),N=e.Variant({Callback:e.Record({token:h,callback:e.Func([],[],["query"])})}),T=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(N),status_code:e.Nat16}),P=e.Record({token:e.Opt(h),body:e.Vec(e.Nat8)}),v=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}),C=e.Record({batch_id:e.Nat}),S=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),k=e.Record({field:S,desc:e.Bool}),A=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),J=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),Y=e.Record({order:e.Opt(k),owner:e.Opt(e.Principal),matcher:e.Opt(A),paginate:e.Opt(J)}),D=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,d)),items_length:e.Nat64}),L=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),ee=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,m)),items_length:e.Nat64}),z=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),te=e.Record({memory:e.Opt(y),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:z,created_at:e.Nat64,mutable_permissions:e.Opt(e.Bool),write:z}),dr=e.Record({stable:e.Nat64,heap:e.Nat64}),mr=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),hr=e.Record({controller:mr,controllers:e.Vec(e.Principal)}),Ue=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8),description:e.Opt(e.Text)}),fr=e.Record({memory:e.Opt(y),updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:z,mutable_permissions:e.Opt(e.Bool),write:z}),_r=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),yr=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),del_docs:e.Func([e.Text],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,i))],[],[]),del_rule:e.Func([s,e.Text,i],[],[]),deposit_cycles:e.Func([l],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(d)],["query"]),get_config:e.Func([],[p],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(m)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(d)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(m)))],["query"]),http_request:e.Func([g],[T],["query"]),http_request_streaming_callback:e.Func([h],[P],["query"]),init_asset_upload:e.Func([v],[C],[]),list_assets:e.Func([e.Text,Y],[D],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,L))],["query"]),list_docs:e.Func([e.Text,Y],[ee],["query"]),list_rules:e.Func([s],[e.Vec(e.Tuple(e.Text,te))],["query"]),memory_size:e.Func([],[dr],["query"]),set_config:e.Func([p],[],[]),set_controllers:e.Func([hr],[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,Ue],[m],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ue))],[e.Vec(e.Tuple(e.Text,m))],[]),set_rule:e.Func([s,e.Text,fr],[],[]),upload_asset_chunk:e.Func([_r],[yr],[]),version:e.Func([],[e.Text],["query"]),version_build:e.Func([],[e.Text],["query"])})};var Ye=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:Ke}),O=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:We}),Qe=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:He}),Q=async({missionControlId:e,...t})=>re({canisterId:e,...t,idlFactory:je}),ae=async({orbiterId:e,...t})=>re({canisterId:e,...t,idlFactory:ze}),re=async({canisterId:e,idlFactory:t,...r})=>{if(Nr(e))throw new Error("No canister ID provided.");return ve({canisterId:e,idlFactory:t,...r})},Xe=Ge.fromText("aaaaa-aa"),Je=(e,t,r)=>{let n=t[0],o=Xe;return n&&typeof n=="object"&&n.canister_id&&(o=Ge.from(n.canister_id)),{effectiveCanisterId:o}},Ze=e=>ve({canisterId:Xe.toText(),config:{callTransform:Je,queryTransform:Je},idlFactory:qe,...e});var G=async({actor:e,code:t})=>{let{install_code:r}=await Ze(e);return r({...t,sender_canister_version:[]})},Ie=async({canisterId:e,path:t,...r})=>{Vr(e,"A canister ID must be provided to request its status.");let n=await Pe(r);return(await vr.request({canisterId:Pr.from(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]})).get(t)};var De=async({missionControl:e})=>(await Q(e)).version(),Le=async({missionControl:e})=>(await Q(e)).get_user(),et=async({missionControl:e})=>(await Q(e)).list_mission_control_controllers(),tt=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await Q(e)).set_satellites_controllers(t,r,n),rt=async({missionControl:e,controllerIds:t,controller:r})=>(await Q(e)).set_mission_control_controllers(t,r);import{Principal as Rr}from"@dfinity/principal";import{nonNullish as Sr,toNullable as Cr}from"@junobuild/utils";var Ve=({controllerId:e,profile:t})=>({controllerIds:[Rr.fromText(e)],controller:Fr(t)}),Fr=e=>({metadata:Sr(e)&&e!==""?[["profile",e]]:[],expires_at:Cr(void 0),scope:{Admin:null}});var F={};xr(F,{Bool:()=>lt,BoolClass:()=>me,ConstructType:()=>$,Empty:()=>at,EmptyClass:()=>pe,FixedIntClass:()=>j,FixedNatClass:()=>M,Float32:()=>ht,Float64:()=>ft,FloatClass:()=>oe,Func:()=>At,FuncClass:()=>se,Int:()=>dt,Int16:()=>yt,Int32:()=>gt,Int64:()=>xt,Int8:()=>_t,IntClass:()=>_e,Nat:()=>mt,Nat16:()=>wt,Nat32:()=>bt,Nat64:()=>Nt,Nat8:()=>Tt,NatClass:()=>ye,Null:()=>ut,NullClass:()=>he,Opt:()=>Rt,OptClass:()=>I,PrimitiveType:()=>E,Principal:()=>vt,PrincipalClass:()=>we,Rec:()=>Ft,RecClass:()=>W,Record:()=>St,RecordClass:()=>ie,Reserved:()=>ct,ReservedClass:()=>Z,Service:()=>Ot,ServiceClass:()=>be,Text:()=>pt,TextClass:()=>fe,Tuple:()=>Pt,TupleClass:()=>xe,Type:()=>X,Unknown:()=>Br,UnknownClass:()=>de,Variant:()=>Ct,VariantClass:()=>Te,Vec:()=>Vt,VecClass:()=>ge,Visitor:()=>ue,decode:()=>kr,encode:()=>Er});import{Principal as Or}from"@dfinity/principal";function f(...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 U=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 Ar(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function B(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 Ar(e)}function nt(){throw new Error("unexpected end of buffer")}function K(e,t){return e.byteLength<t&&nt(),e.read(t)}function H(e){let t=e.readUint8();return t===void 0&&nt(),t}function w(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 U(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 V(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 b(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 U(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 V(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 ot(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Re(e,t)}function Re(e,t){e=BigInt(e);let r=new U(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 Se(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 it(e,t){let r=Se(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function ce(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var le="DIDL",st=400;function ne(e,t,r){return e.map((n,o)=>r(n,t[o]))}var Ce=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=w(this._typs.length),r=f(...this._typs);return f(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return b(this._idx.get(t)||0)}},ue=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)}},X=class{display(){return this.name}valueToString(t){return x(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},E=class extends X{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 X{checkType(t){if(t instanceof W){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: ${x(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return b(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},de=class extends X{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: ${x(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 W?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"}},me=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: ${x(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return b(-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"}},he=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: ${x(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return b(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},Z=class extends E{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return b(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}},fe=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: ${x(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=w(r.byteLength);return f(n,r)}encodeType(){return b(-15)}decodeValue(t,r){this.checkType(r);let n=V(t),o=K(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},_e=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: ${x(t)}`)}encodeValue(t){return b(t)}encodeType(){return b(-4)}decodeValue(t,r){return this.checkType(r),q(t)}get name(){return"int"}valueToString(t){return t.toString()}},ye=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: ${x(t)}`)}encodeValue(t){return w(t)}encodeType(){return b(-3)}decodeValue(t,r){return this.checkType(r),V(t)}get name(){return"nat"}valueToString(t){return t.toString()}},oe=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: ${x(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 b(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=ce(this._bits-1)*BigInt(-1),n=ce(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: ${x(t)}`)}encodeValue(t){return Re(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return b(-9-t)}decodeValue(t,r){this.checkType(r);let n=it(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},M=class extends E{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=ce(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: ${x(t)}`)}encodeValue(t){return ot(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return b(-5-t)}decodeValue(t,r){this.checkType(r);let n=Se(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},ge=class e extends ${constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof M&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof M?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:
|
|
1
|
+
var gr=Object.defineProperty;var xr=(e,t)=>{for(var r in t)gr(e,r,{get:t[r],enumerable:!0})};import{Principal as $r}from"@dfinity/principal";import{CanisterStatus as vr}from"@dfinity/agent";import{Principal as Pr}from"@dfinity/principal";import{assertNonNullish as Vr}from"@junobuild/utils";import{Actor as Tr,HttpAgent as wr}from"@dfinity/agent";import{nonNullish as br}from"@junobuild/utils";var ve=async({canisterId:e,idlFactory:t,config:r,...n})=>{let o=await Pe(n);return Tr.createActor(t,{agent:o,canisterId:e,...r!==void 0?r:{}})},Pe=async({identity:e,fetch:t,container:r})=>{let n=br(r)&&r!==!1,o=n?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io",i=new wr({identity:e,host:o,...t&&{fetch:t}});return n&&await i.fetchRootKey(),i};import{Principal as Ge}from"@dfinity/principal";import{isNullish as Nr}from"@junobuild/utils";var qe=({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}),d=e.Record({height:e.Nat32,value:o,outpoint:c}),_=e.Record({next_page:e.Opt(e.Vec(e.Nat8)),tip_height:e.Nat32,tip_block_hash:u,utxos:e.Vec(d)}),R=e.Record({transaction:e.Vec(e.Nat8),network:t}),a=e.Principal,p=e.Variant({from_user:e.Record({user_id:e.Principal}),from_canister:e.Record({canister_version:e.Opt(e.Nat64),canister_id:e.Principal})}),m=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}),g=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:p,details:m}),y=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),h=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)}),N=e.Variant({secp256k1:e.Null}),T=e.Record({value:e.Text,name:e.Text}),P=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(T)}),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],[_],[]),bitcoin_send_transaction:e.Func([R],[],[]),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(g),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:y,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))})],[]),create_canister:e.Func([e.Record({settings:e.Opt(h),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:N}),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:P})],[P],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(T)})],[P],[]),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(h),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:N}),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:h,sender_canister_version:e.Opt(e.Nat64)})],[],[])})};var je=({IDL:e})=>{let t=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),r=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal}),n=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Variant({Write:e.Null,Admin:e.Null}),i=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:o,expires_at:e.Opt(e.Nat64)}),s=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),l=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),u=e.Record({status:s,memory_size:e.Nat,cycles:e.Nat,settings:l,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),c=e.Record({id:e.Principal,status:u,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),d=e.Variant({Ok:c,Err:e.Text}),_=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:o,expires_at:e.Opt(e.Nat64)}),R=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),a=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,R)),satellites:e.Vec(e.Tuple(e.Principal,R)),cycles_threshold:e.Opt(e.Nat64)}),p=e.Record({orbiters:e.Opt(e.Vec(d)),satellites:e.Opt(e.Vec(d)),mission_control:d}),m=e.Record({e8s:e.Nat64});return e.Service({add_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),add_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),create_orbiter:e.Func([e.Opt(e.Text)],[t],[]),create_satellite:e.Func([e.Text],[r],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([n],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,i))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,d))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,d)))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,t))],["query"]),list_satellite_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,d)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,r))],["query"]),remove_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),remove_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),_],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[t],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[t],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),_],[],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[r],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),_],[],[]),status:e.Func([a],[p],[]),top_up:e.Func([e.Principal,m],[],[]),version:e.Func([],[e.Text],["query"])})};var ze=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null}),n=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:r,expires_at:e.Opt(e.Nat64)}),o=e.Record({updated_at:e.Opt(e.Nat64)}),i=e.Record({cycles:e.Nat,destination_id:e.Principal}),s=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),l=e.Record({key:e.Text,collected_at:e.Nat64}),u=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),c=e.Record({title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:u,user_agent:e.Opt(e.Text)}),d=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),_=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),R=e.Record({browsers:d,devices:_}),a=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),p=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(a,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),m=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),g=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal}),y=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),h=e.Record({updated_at:e.Nat64,created_at:e.Nat64,enabled:e.Bool}),N=e.Record({stable:e.Nat64,heap:e.Nat64}),T=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),P=e.Record({controller:T,controllers:e.Vec(e.Principal)}),v=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,satellite_id:e.Principal,device:u,user_agent:e.Opt(e.Text)}),C=e.Variant({Ok:c,Err:e.Text}),S=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(l,e.Text))}),k=e.Record({updated_at:e.Opt(e.Nat64),enabled:e.Bool}),A=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,user_agent:e.Opt(e.Text)}),J=e.Variant({Ok:g,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,n))],[]),del_satellite_config:e.Func([e.Principal,o],[],[]),deposit_cycles:e.Func([i],[],[]),get_page_views:e.Func([s],[e.Vec(e.Tuple(l,c))],["query"]),get_page_views_analytics_clients:e.Func([s],[R],["query"]),get_page_views_analytics_metrics:e.Func([s],[p],["query"]),get_page_views_analytics_top_10:e.Func([s],[m],["query"]),get_track_events:e.Func([s],[e.Vec(e.Tuple(l,g))],["query"]),get_track_events_analytics:e.Func([s],[y],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,h))],["query"]),memory_size:e.Func([],[N],["query"]),set_controllers:e.Func([P],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([l,v],[C],[]),set_page_views:e.Func([e.Vec(e.Tuple(l,v))],[S],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,k))],[e.Vec(e.Tuple(e.Principal,h))],[]),set_track_event:e.Func([l,A],[J],[]),set_track_events:e.Func([e.Vec(e.Tuple(l,A))],[S],[]),version:e.Func([],[e.Text],["query"])})};var He=({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}),d=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),_=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(d),status_code:e.Nat16}),R=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}),p=e.Record({batch_id:e.Nat}),m=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),g=e.Record({field:m,desc:e.Bool}),y=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),h=e.Record({order:e.Opt(g),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(y)}),N=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),P=e.Record({key:N,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,T)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),v=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,P))}),C=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),S=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),k=e.Variant({Db:e.Null,Storage:e.Null}),A=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),J=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:A,created_at:e.Nat64,write:A}),Y=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),D=e.Record({controller:Y,controllers:e.Vec(e.Principal)}),L=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),ee=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:A,write:A}),z=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),te=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],[_],["query"]),http_request_streaming_callback:e.Func([c],[R],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),h],[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,C))],["query"]),list_docs:e.Func([e.Text,h],[S],["query"]),list_rules:e.Func([k],[e.Vec(e.Tuple(e.Text,J))],["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,L],[l],[]),set_rule:e.Func([k,e.Text,ee],[],[]),upload_asset_chunk:e.Func([z],[te],[]),version:e.Func([],[e.Text],["query"])})};var Ke=({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}),d=e.Variant({Callback:e.Record({token:c,callback:e.Func([],[],[])})}),_=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(d),status_code:e.Nat16}),R=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}),p=e.Record({batch_id:e.Nat}),m=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),g=e.Record({field:m,desc:e.Bool}),y=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),h=e.Record({order:e.Opt(g),matcher:e.Opt(e.Text),paginate:e.Opt(y)}),N=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),T=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),P=e.Record({key:N,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,T)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),v=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,P))}),C=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),S=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,l))}),k=e.Variant({Db:e.Null,Storage:e.Null}),A=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),J=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:A,created_at:e.Nat64,write:A}),Y=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),D=e.Record({controller:Y,controllers:e.Vec(e.Principal)}),L=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),ee=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:A,write:A}),z=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),te=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],[_],["query"]),http_request_streaming_callback:e.Func([c],[R],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),h],[v],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,C))],["query"]),list_docs:e.Func([e.Text,h],[S],["query"]),list_rules:e.Func([k],[e.Vec(e.Tuple(e.Text,J))],["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,L],[l],[]),set_rule:e.Func([k,e.Text,ee],[],[]),upload_asset_chunk:e.Func([z],[te],[]),version:e.Func([],[e.Text],["query"])})};var We=({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({cycles:e.Nat,destination_id:e.Principal}),u=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}),c=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),d=e.Record({key:u,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,c)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),_=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),R=e.Record({status_code:e.Nat16,location:e.Text}),a=e.Record({iframe:e.Opt(_),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),redirects:e.Opt(e.Vec(e.Tuple(e.Text,R)))}),p=e.Record({storage:a}),m=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64}),g=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),y=e.Variant({Heap:e.Null,Stable:e.Null}),h=e.Record({memory:y,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}),N=e.Variant({Callback:e.Record({token:h,callback:e.Func([],[],["query"])})}),T=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(N),status_code:e.Nat16}),P=e.Record({token:e.Opt(h),body:e.Vec(e.Nat8)}),v=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}),C=e.Record({batch_id:e.Nat}),S=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),k=e.Record({field:S,desc:e.Bool}),A=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),J=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),Y=e.Record({order:e.Opt(k),owner:e.Opt(e.Principal),matcher:e.Opt(A),paginate:e.Opt(J)}),D=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,d)),items_length:e.Nat64}),L=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),ee=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,m)),items_length:e.Nat64}),z=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),te=e.Record({memory:e.Opt(y),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:z,created_at:e.Nat64,mutable_permissions:e.Opt(e.Bool),write:z}),dr=e.Record({stable:e.Nat64,heap:e.Nat64}),mr=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),hr=e.Record({controller:mr,controllers:e.Vec(e.Principal)}),Ue=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8),description:e.Opt(e.Text)}),fr=e.Record({memory:e.Opt(y),updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:z,mutable_permissions:e.Opt(e.Bool),write:z}),_r=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),yr=e.Record({chunk_id:e.Nat});return e.Service({build_version:e.Func([],[e.Text],["query"]),commit_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),del_docs:e.Func([e.Text],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,i))],[],[]),del_rule:e.Func([s,e.Text,i],[],[]),deposit_cycles:e.Func([l],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(d)],["query"]),get_config:e.Func([],[p],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(m)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(d)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(m)))],["query"]),http_request:e.Func([g],[T],["query"]),http_request_streaming_callback:e.Func([h],[P],["query"]),init_asset_upload:e.Func([v],[C],[]),list_assets:e.Func([e.Text,Y],[D],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,L))],["query"]),list_docs:e.Func([e.Text,Y],[ee],["query"]),list_rules:e.Func([s],[e.Vec(e.Tuple(e.Text,te))],["query"]),memory_size:e.Func([],[dr],["query"]),set_config:e.Func([p],[],[]),set_controllers:e.Func([hr],[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,Ue],[m],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ue))],[e.Vec(e.Tuple(e.Text,m))],[]),set_rule:e.Func([s,e.Text,fr],[],[]),upload_asset_chunk:e.Func([_r],[yr],[]),version:e.Func([],[e.Text],["query"])})};var Ye=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:Ke}),O=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:We}),Qe=async({satelliteId:e,...t})=>re({canisterId:e,...t,idlFactory:He}),Q=async({missionControlId:e,...t})=>re({canisterId:e,...t,idlFactory:je}),ae=async({orbiterId:e,...t})=>re({canisterId:e,...t,idlFactory:ze}),re=async({canisterId:e,idlFactory:t,...r})=>{if(Nr(e))throw new Error("No canister ID provided.");return ve({canisterId:e,idlFactory:t,...r})},Xe=Ge.fromText("aaaaa-aa"),Je=(e,t,r)=>{let n=t[0],o=Xe;return n&&typeof n=="object"&&n.canister_id&&(o=Ge.from(n.canister_id)),{effectiveCanisterId:o}},Ze=e=>ve({canisterId:Xe.toText(),config:{callTransform:Je,queryTransform:Je},idlFactory:qe,...e});var G=async({actor:e,code:t})=>{let{install_code:r}=await Ze(e);return r({...t,sender_canister_version:[]})},Ie=async({canisterId:e,path:t,...r})=>{Vr(e,"A canister ID must be provided to request its status.");let n=await Pe(r);return(await vr.request({canisterId:Pr.from(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]})).get(t)};var De=async({missionControl:e})=>(await Q(e)).version(),Le=async({missionControl:e})=>(await Q(e)).get_user(),et=async({missionControl:e})=>(await Q(e)).list_mission_control_controllers(),tt=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await Q(e)).set_satellites_controllers(t,r,n),rt=async({missionControl:e,controllerIds:t,controller:r})=>(await Q(e)).set_mission_control_controllers(t,r);import{Principal as Rr}from"@dfinity/principal";import{nonNullish as Sr,toNullable as Cr}from"@junobuild/utils";var Ve=({controllerId:e,profile:t})=>({controllerIds:[Rr.fromText(e)],controller:Fr(t)}),Fr=e=>({metadata:Sr(e)&&e!==""?[["profile",e]]:[],expires_at:Cr(void 0),scope:{Admin:null}});var F={};xr(F,{Bool:()=>lt,BoolClass:()=>me,ConstructType:()=>$,Empty:()=>at,EmptyClass:()=>pe,FixedIntClass:()=>j,FixedNatClass:()=>M,Float32:()=>ht,Float64:()=>ft,FloatClass:()=>oe,Func:()=>At,FuncClass:()=>se,Int:()=>dt,Int16:()=>yt,Int32:()=>gt,Int64:()=>xt,Int8:()=>_t,IntClass:()=>_e,Nat:()=>mt,Nat16:()=>wt,Nat32:()=>bt,Nat64:()=>Nt,Nat8:()=>Tt,NatClass:()=>ye,Null:()=>ut,NullClass:()=>he,Opt:()=>Rt,OptClass:()=>I,PrimitiveType:()=>E,Principal:()=>vt,PrincipalClass:()=>we,Rec:()=>Ft,RecClass:()=>W,Record:()=>St,RecordClass:()=>ie,Reserved:()=>ct,ReservedClass:()=>Z,Service:()=>Ot,ServiceClass:()=>be,Text:()=>pt,TextClass:()=>fe,Tuple:()=>Pt,TupleClass:()=>xe,Type:()=>X,Unknown:()=>Br,UnknownClass:()=>de,Variant:()=>Ct,VariantClass:()=>Te,Vec:()=>Vt,VecClass:()=>ge,Visitor:()=>ue,decode:()=>kr,encode:()=>Er});import{Principal as Or}from"@dfinity/principal";function f(...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 U=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 Ar(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function B(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 Ar(e)}function nt(){throw new Error("unexpected end of buffer")}function K(e,t){return e.byteLength<t&&nt(),e.read(t)}function H(e){let t=e.readUint8();return t===void 0&&nt(),t}function w(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 U(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 V(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 b(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 U(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 V(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 ot(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Re(e,t)}function Re(e,t){e=BigInt(e);let r=new U(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 Se(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 it(e,t){let r=Se(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function ce(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var le="DIDL",st=400;function ne(e,t,r){return e.map((n,o)=>r(n,t[o]))}var Ce=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=w(this._typs.length),r=f(...this._typs);return f(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return b(this._idx.get(t)||0)}},ue=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)}},X=class{display(){return this.name}valueToString(t){return x(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},E=class extends X{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 X{checkType(t){if(t instanceof W){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: ${x(t)}`)}encodeValue(){throw new Error("Empty cannot appear as a function argument")}valueToString(){throw new Error("Empty cannot appear as a value")}encodeType(){return b(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},de=class extends X{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: ${x(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 W?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"}},me=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: ${x(t)}`)}encodeValue(t){return new Uint8Array([t?1:0])}encodeType(){return b(-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"}},he=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: ${x(t)}`)}encodeValue(){return new ArrayBuffer(0)}encodeType(){return b(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},Z=class extends E{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return b(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}},fe=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: ${x(t)}`)}encodeValue(t){let r=new TextEncoder().encode(t),n=w(r.byteLength);return f(n,r)}encodeType(){return b(-15)}decodeValue(t,r){this.checkType(r);let n=V(t),o=K(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},_e=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: ${x(t)}`)}encodeValue(t){return b(t)}encodeType(){return b(-4)}decodeValue(t,r){return this.checkType(r),q(t)}get name(){return"int"}valueToString(t){return t.toString()}},ye=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: ${x(t)}`)}encodeValue(t){return w(t)}encodeType(){return b(-3)}decodeValue(t,r){return this.checkType(r),V(t)}get name(){return"nat"}valueToString(t){return t.toString()}},oe=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: ${x(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 b(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=ce(this._bits-1)*BigInt(-1),n=ce(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: ${x(t)}`)}encodeValue(t){return Re(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return b(-9-t)}decodeValue(t,r){this.checkType(r);let n=it(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},M=class extends E{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=ce(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: ${x(t)}`)}encodeValue(t){return ot(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return b(-5-t)}decodeValue(t,r){this.checkType(r);let n=Se(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},ge=class e extends ${constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof M&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof M?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:
|
|
2
2
|
|
|
3
3
|
index ${o} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${x(t)}`)}encodeValue(t){let r=w(t.length);if(this._blobOptimization)return f(r,new Uint8Array(t));if(ArrayBuffer.isView(t))return f(r,new Uint8Array(t.buffer));let n=new U(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=b(-19),n=this._type.encodeType(t);t.add(this,f(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a vector type");let o=Number(V(t));if(this._type instanceof M){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("; ")+"}"}},I=class e 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: ${x(t)}
|
|
4
4
|
|
|
@@ -10,5 +10,5 @@ index ${n} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display
|
|
|
10
10
|
|
|
11
11
|
variant ${r} -> ${o.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${x(t)}`)}encodeValue(t){for(let r=0;r<this._fields.length;r++){let[n,o]=this._fields[r];if(t.hasOwnProperty(n)){let i=w(r),s=o.encodeValue(t[n]);return f(i,s)}}throw Error("Variant has no data: "+t)}_buildTypeTableImpl(t){this._fields.forEach(([,i])=>{i.buildTypeTable(t)});let r=b(-21),n=w(this._fields.length),o=this._fields.map(([i,s])=>f(w(B(i)),s.encodeType(t)));t.add(this,f(r,n,...o))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof e))throw new Error("Not a variant type");let o=Number(V(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(B(i)===B(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)}},W=class e extends ${constructor(){super(...arguments),this._id=e._counter++,this._type=void 0}accept(t,r){if(!this._type)throw Error("Recursive type uninitialized.");return t.visitRec(this,this._type,r)}fill(t){this._type=t}getType(){return this._type}covariant(t){if(this._type&&this._type.covariant(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${x(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)}};W._counter=0;function Fe(e){if(H(e)!==1)throw new Error("Cannot decode principal");let r=Number(V(e));return Or.fromUint8Array(new Uint8Array(K(e,r)))}var we=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: ${x(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=w(r.byteLength);return f(new Uint8Array([1]),n,r)}encodeType(){return b(-24)}decodeValue(t,r){return this.checkType(r),Fe(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: ${x(t)}`)}encodeValue([t,r]){let n=t.toUint8Array(),o=w(n.byteLength),i=f(new Uint8Array([1]),o,n),s=new TextEncoder().encode(r),l=w(s.byteLength);return f(new Uint8Array([1]),i,l,s)}_buildTypeTableImpl(t){this.argTypes.forEach(c=>c.buildTypeTable(t)),this.retTypes.forEach(c=>c.buildTypeTable(t));let r=b(-22),n=w(this.argTypes.length),o=f(...this.argTypes.map(c=>c.encodeType(t))),i=w(this.retTypes.length),s=f(...this.retTypes.map(c=>c.encodeType(t))),l=w(this.annotations.length),u=f(...this.annotations.map(c=>this.encodeAnnotation(c)));t.add(this,f(r,n,o,i,s,l,u))}decodeValue(t){if(H(t)!==1)throw new Error("Cannot decode function reference");let n=Fe(t),o=Number(V(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")}},be=class extends ${constructor(t){super(),this._fields=Object.entries(t).sort((r,n)=>r[0]<n[0]?-1:r[0]>n[0]?1:0)}accept(t,r){return t.visitService(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${x(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=w(r.length);return f(new Uint8Array([1]),n,r)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=b(-23),n=w(this._fields.length),o=this._fields.map(([i,s])=>{let l=new TextEncoder().encode(i),u=w(l.length);return f(u,l,s.encodeType(t))});t.add(this,f(r,n,...o))}decodeValue(t){return Fe(t)}get name(){return`service {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}valueToString(t){return`service "${t.toText()}"`}};function x(e){let t=JSON.stringify(e,(r,n)=>typeof n=="bigint"?`BigInt(${n})`:n);return t&&t.length>st?t.substring(0,st-3)+"...":t}function Er(e,t){if(t.length<e.length)throw Error("Wrong number of message arguments");let r=new Ce;e.forEach(u=>u.buildTypeTable(r));let n=new TextEncoder().encode(le),o=r.encode(),i=w(t.length),s=f(...e.map(u=>u.encodeType(r))),l=f(...ne(e,t,(u,c)=>{try{u.covariant(c)}catch(d){throw new Error(d.message+`
|
|
12
12
|
|
|
13
|
-
`)}return u.encodeValue(c)}));return f(n,o,i,s,l)}function kr(e,t){let r=new U(t);if(t.byteLength<le.length)throw new Error("Message length smaller than magic number");let n=K(r,le.length),o=new TextDecoder().decode(n);if(o!==le)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let p=[],m=Number(V(a));for(let h=0;h<m;h++){let N=Number(q(a));switch(N){case-18:case-19:{let T=Number(q(a));p.push([N,T]);break}case-20:case-21:{let T=[],P=Number(V(a)),v;for(;P--;){let C=Number(V(a));if(C>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof v=="number"&&v>=C)throw new Error("field id collision or not sorted");v=C;let S=Number(q(a));T.push([C,S])}p.push([N,T]);break}case-22:{let T=[],P=Number(V(a));for(;P--;)T.push(Number(q(a)));let v=[],C=Number(V(a));for(;C--;)v.push(Number(q(a)));let S=[],k=Number(V(a));for(;k--;)switch(Number(V(a))){case 1:{S.push("query");break}case 2:{S.push("oneway");break}case 3:{S.push("composite_query");break}default:throw new Error("unknown annotation")}p.push([N,[T,v,S]]);break}case-23:{let T=Number(V(a)),P=[];for(;T--;){let v=Number(V(a)),C=new TextDecoder().decode(K(a,v)),S=q(a);P.push([C,S])}p.push([N,P]);break}default:throw new Error("Illegal op_code: "+N)}}let g=[],y=Number(V(a));for(let h=0;h<y;h++)g.push(Number(q(a)));return[p,g]}let[s,l]=i(r);if(l.length<e.length)throw new Error("Wrong number of return values");let u=s.map(a=>Ft());function c(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return ut;case-2:return lt;case-3:return mt;case-4:return dt;case-5:return Tt;case-6:return wt;case-7:return bt;case-8:return Nt;case-9:return _t;case-10:return yt;case-11:return gt;case-12:return xt;case-13:return ht;case-14:return ft;case-15:return pt;case-16:return ct;case-17:return at;case-24:return vt;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return u[a]}function d(a){switch(a[0]){case-19:{let p=c(a[1]);return Vt(p)}case-18:{let p=c(a[1]);return Rt(p)}case-20:{let p={};for(let[y,h]of a[1]){let N=`_${y}_`;p[N]=c(h)}let m=St(p),g=m.tryAsTuple();return Array.isArray(g)?Pt(...g):m}case-21:{let p={};for(let[m,g]of a[1]){let y=`_${m}_`;p[y]=c(g)}return Ct(p)}case-22:{let[p,m,g]=a[1];return At(p.map(y=>c(y)),m.map(y=>c(y)),g)}case-23:{let p={},m=a[1];for(let[g,y]of m){let h=c(y);if(h instanceof W&&(h=h.getType()),!(h instanceof se))throw new Error("Illegal service definition: services can only contain functions");p[g]=h}return Ot(p)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,p)=>{if(a[0]===-22){let m=d(a);u[p].fill(m)}}),s.forEach((a,p)=>{if(a[0]!==-22){let m=d(a);u[p].fill(m)}});let _=l.map(a=>c(a)),R=e.map((a,p)=>a.decodeValue(r,_[p]));for(let a=e.length;a<_.length;a++)_[a].decodeValue(r,_[a]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return R}var at=new pe,ct=new Z,Br=new de,lt=new me,ut=new he,pt=new fe,dt=new _e,mt=new ye,ht=new oe(32),ft=new oe(64),_t=new j(8),yt=new j(16),gt=new j(32),xt=new j(64),Tt=new M(8),wt=new M(16),bt=new M(32),Nt=new M(64),vt=new we;function Pt(...e){return new xe(e)}function Vt(e){return new ge(e)}function Rt(e){return new I(e)}function St(e){return new ie(e)}function Ct(e){return new Te(e)}function Ft(){return new W}function At(e,t,r=[]){return new se(e,t,r)}function Ot(e){return new be(e)}import{Principal as zn}from"@dfinity/principal";var Et=e=>F.encode([F.Record({user:F.Principal})],[{user:e}]),Ne=e=>F.encode([F.Record({controllers:F.Vec(F.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var no=async e=>De(e),oo=async({missionControl:e,wasm_module:t})=>{let r=await Le({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=Et(r);await G({actor:o,code:{canister_id:$r.fromText(n),arg:new Uint8Array(i),wasm_module:t,mode:{upgrade:null}}})},io=async({controllerId:e,profile:t,...r})=>tt({...r,...Ve({controllerId:e,profile:t})}),so=async({controllerId:e,profile:t,...r})=>rt({...r,...Ve({controllerId:e,profile:t})}),ao=e=>et(e);import{Principal as Ur}from"@dfinity/principal";var kt=async({orbiter:e})=>(await ae(e)).version(),Ae=async({orbiter:e})=>(await ae(e)).list_controllers(),Bt=async({orbiter:e})=>{let{memory_size:t}=await ae(e);return t()};var _o=async e=>kt(e),yo=async({orbiter:e,wasm_module:t,reset:r=!1})=>{let{orbiterId:n,...o}=e;if(!n)throw new Error("No orbiter principal defined.");let i=await Ae({orbiter:e}),s=Ne(i);await G({actor:o,code:{canister_id:Ur.fromText(n),arg:new Uint8Array(s),wasm_module:t,mode:r?{reinstall:null}:{upgrade:null}}})},go=e=>Bt(e),xo=e=>Ae(e);import{major as Mt,minor as $t,patch as Ut}from"semver";var bo=({currentVersion:e,selectedVersion:t})=>{let r=Mt(e),n=Mt(t),o=$t(e),i=$t(t),s=Ut(e),l=Ut(t);return r<n-1||o<i-1||s<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as pr}from"@dfinity/principal";import{fromNullable as Kr,isNullish as Wr,nonNullish as Jr}from"@junobuild/utils";import{toNullable as qr}from"@junobuild/utils";var qt=async({config:e,satellite:t})=>(await O(t)).set_config(e),jt=async({satellite:e,type:t})=>(await O(e)).list_rules(t),zt=async({type:e,collection:t,rule:r,satellite:n})=>(await O(n)).set_rule(e,t,r),Ht=async({satellite:e})=>{let{version:t}=await O(e);return t()},Kt=async({satellite:e})=>{let{
|
|
13
|
+
`)}return u.encodeValue(c)}));return f(n,o,i,s,l)}function kr(e,t){let r=new U(t);if(t.byteLength<le.length)throw new Error("Message length smaller than magic number");let n=K(r,le.length),o=new TextDecoder().decode(n);if(o!==le)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let p=[],m=Number(V(a));for(let h=0;h<m;h++){let N=Number(q(a));switch(N){case-18:case-19:{let T=Number(q(a));p.push([N,T]);break}case-20:case-21:{let T=[],P=Number(V(a)),v;for(;P--;){let C=Number(V(a));if(C>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof v=="number"&&v>=C)throw new Error("field id collision or not sorted");v=C;let S=Number(q(a));T.push([C,S])}p.push([N,T]);break}case-22:{let T=[],P=Number(V(a));for(;P--;)T.push(Number(q(a)));let v=[],C=Number(V(a));for(;C--;)v.push(Number(q(a)));let S=[],k=Number(V(a));for(;k--;)switch(Number(V(a))){case 1:{S.push("query");break}case 2:{S.push("oneway");break}case 3:{S.push("composite_query");break}default:throw new Error("unknown annotation")}p.push([N,[T,v,S]]);break}case-23:{let T=Number(V(a)),P=[];for(;T--;){let v=Number(V(a)),C=new TextDecoder().decode(K(a,v)),S=q(a);P.push([C,S])}p.push([N,P]);break}default:throw new Error("Illegal op_code: "+N)}}let g=[],y=Number(V(a));for(let h=0;h<y;h++)g.push(Number(q(a)));return[p,g]}let[s,l]=i(r);if(l.length<e.length)throw new Error("Wrong number of return values");let u=s.map(a=>Ft());function c(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return ut;case-2:return lt;case-3:return mt;case-4:return dt;case-5:return Tt;case-6:return wt;case-7:return bt;case-8:return Nt;case-9:return _t;case-10:return yt;case-11:return gt;case-12:return xt;case-13:return ht;case-14:return ft;case-15:return pt;case-16:return ct;case-17:return at;case-24:return vt;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return u[a]}function d(a){switch(a[0]){case-19:{let p=c(a[1]);return Vt(p)}case-18:{let p=c(a[1]);return Rt(p)}case-20:{let p={};for(let[y,h]of a[1]){let N=`_${y}_`;p[N]=c(h)}let m=St(p),g=m.tryAsTuple();return Array.isArray(g)?Pt(...g):m}case-21:{let p={};for(let[m,g]of a[1]){let y=`_${m}_`;p[y]=c(g)}return Ct(p)}case-22:{let[p,m,g]=a[1];return At(p.map(y=>c(y)),m.map(y=>c(y)),g)}case-23:{let p={},m=a[1];for(let[g,y]of m){let h=c(y);if(h instanceof W&&(h=h.getType()),!(h instanceof se))throw new Error("Illegal service definition: services can only contain functions");p[g]=h}return Ot(p)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,p)=>{if(a[0]===-22){let m=d(a);u[p].fill(m)}}),s.forEach((a,p)=>{if(a[0]!==-22){let m=d(a);u[p].fill(m)}});let _=l.map(a=>c(a)),R=e.map((a,p)=>a.decodeValue(r,_[p]));for(let a=e.length;a<_.length;a++)_[a].decodeValue(r,_[a]);if(r.byteLength>0)throw new Error("decode: Left-over bytes");return R}var at=new pe,ct=new Z,Br=new de,lt=new me,ut=new he,pt=new fe,dt=new _e,mt=new ye,ht=new oe(32),ft=new oe(64),_t=new j(8),yt=new j(16),gt=new j(32),xt=new j(64),Tt=new M(8),wt=new M(16),bt=new M(32),Nt=new M(64),vt=new we;function Pt(...e){return new xe(e)}function Vt(e){return new ge(e)}function Rt(e){return new I(e)}function St(e){return new ie(e)}function Ct(e){return new Te(e)}function Ft(){return new W}function At(e,t,r=[]){return new se(e,t,r)}function Ot(e){return new be(e)}import{Principal as zn}from"@dfinity/principal";var Et=e=>F.encode([F.Record({user:F.Principal})],[{user:e}]),Ne=e=>F.encode([F.Record({controllers:F.Vec(F.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var no=async e=>De(e),oo=async({missionControl:e,wasm_module:t})=>{let r=await Le({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=Et(r);await G({actor:o,code:{canister_id:$r.fromText(n),arg:new Uint8Array(i),wasm_module:t,mode:{upgrade:null}}})},io=async({controllerId:e,profile:t,...r})=>tt({...r,...Ve({controllerId:e,profile:t})}),so=async({controllerId:e,profile:t,...r})=>rt({...r,...Ve({controllerId:e,profile:t})}),ao=e=>et(e);import{Principal as Ur}from"@dfinity/principal";var kt=async({orbiter:e})=>(await ae(e)).version(),Ae=async({orbiter:e})=>(await ae(e)).list_controllers(),Bt=async({orbiter:e})=>{let{memory_size:t}=await ae(e);return t()};var _o=async e=>kt(e),yo=async({orbiter:e,wasm_module:t,reset:r=!1})=>{let{orbiterId:n,...o}=e;if(!n)throw new Error("No orbiter principal defined.");let i=await Ae({orbiter:e}),s=Ne(i);await G({actor:o,code:{canister_id:Ur.fromText(n),arg:new Uint8Array(s),wasm_module:t,mode:r?{reinstall:null}:{upgrade:null}}})},go=e=>Bt(e),xo=e=>Ae(e);import{major as Mt,minor as $t,patch as Ut}from"semver";var bo=({currentVersion:e,selectedVersion:t})=>{let r=Mt(e),n=Mt(t),o=$t(e),i=$t(t),s=Ut(e),l=Ut(t);return r<n-1||o<i-1||s<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as pr}from"@dfinity/principal";import{fromNullable as Kr,isNullish as Wr,nonNullish as Jr}from"@junobuild/utils";import{toNullable as qr}from"@junobuild/utils";var qt=async({config:e,satellite:t})=>(await O(t)).set_config(e),jt=async({satellite:e,type:t})=>(await O(e)).list_rules(t),zt=async({type:e,collection:t,rule:r,satellite:n})=>(await O(n)).set_rule(e,t,r),Ht=async({satellite:e})=>{let{version:t}=await O(e);return t()},Kt=async({satellite:e})=>{let{build_version:t}=await O(e);return t()},Wt=async({satellite:e})=>(await Ye(e)).list_controllers(),Oe=async({satellite:e})=>(await Qe(e)).list_controllers(),Ee=async({satellite:e})=>(await O(e)).list_controllers(),Jt=async({satellite:e})=>{let{list_custom_domains:t}=await O(e);return t()},Gt=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await O(e);await n(t,qr(r))},Yt=async({satellite:e})=>{let{memory_size:t}=await O(e);return t()},Qt=async({collection:e,satellite:t})=>{let{count_docs:r}=await O(t);return r(e)},Xt=async({collection:e,satellite:t})=>{let{count_assets:r}=await O(t);return r(e)},Zt=async({collection:e,satellite:t})=>{let{del_docs:r}=await O(t);return r(e)},It=async({collection:e,satellite:t})=>{let{del_assets:r}=await O(t);return r(e)},Dt=async({args:e,satellite:t})=>{let{set_controllers:r}=await O(t);return r(e)};import{fromNullable as Be,isNullish as jr,nonNullish as Me,toNullable as sr}from"@junobuild/utils";var Lt={Db:null},er={Storage:null},tr={Public:null},rr={Private:null},nr={Managed:null},or={Controllers:null},ke={Heap:null},ir={Stable:null};var $e=e=>e==="storage"?er:Lt,lr=({read:e,write:t,memory:r,max_size:n,updated_at:o,mutablePermissions:i})=>({read:cr(e),write:cr(t),memory:Me(r)?[zr(r)]:[],updated_at:jr(o)?[]:[o],max_size:sr(Me(n)&&n>0?BigInt(n):void 0),mutable_permissions:sr(i)}),ur=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:s,memory:l,mutable_permissions:u}=t,c=s?.[0]??0n>0n?Number(Be(s)):void 0;return{collection:e,read:ar(r),write:ar(n),memory:Hr(Be(l)??ke),updated_at:o,created_at:i,...Me(c)&&{max_size:c},mutablePermissions:Be(u)??!0}},ar=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",cr=e=>{switch(e){case"public":return tr;case"private":return rr;case"managed":return nr;default:return or}},zr=e=>{switch(e){case"Stable":return ir;default:return ke}},Hr=e=>"Stable"in e?"Stable":"Heap";var Uo=async({config:{storage:{headers:e,rewrites:t,redirects:r,iframe:n}},satellite:o})=>{let i=(e??[]).map(({source:c,headers:d})=>[c,d]),s=(t??[]).map(({source:c,destination:d})=>[c,d]),l=(r??[]).map(({source:c,location:d,code:_})=>[c,{status_code:_,location:d}]);return qt({satellite:o,config:{storage:{headers:i,rewrites:s,redirects:[l],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}]}}})},qo=async({type:e,satellite:t})=>(await jt({satellite:t,type:$e(e)})).map(n=>ur(n)),jo=async({rule:{collection:e,...t},type:r,satellite:n})=>zt({type:$e(r),rule:lr(t),satellite:n,collection:e}),zo=e=>Ht(e),Ho=e=>Kt(e),Ko=async({satellite:{satelliteId:e,...t}})=>{let r=await Ie({...t,canisterId:e,path:"juno:build"});return Jr(r)&&["stock","extended"].includes(r)?r:void 0},Wo=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n,reset:o=!1})=>{let{satelliteId:i,...s}=e;if(Wr(i))throw new Error("No satellite principal defined.");if(r){let d=await Wt({satellite:e}),_=F.encode([F.Record({controllers:F.Vec(F.Principal)})],[{controllers:d}]);await G({actor:s,code:{canister_id:pr.fromText(i),arg:new Uint8Array(_),wasm_module:t,mode:o?{reinstall:null}:{upgrade:null}}});return}let u=await(n?Oe:Ee)({satellite:e}),c=Ne(u);await G({actor:s,code:{canister_id:pr.fromText(i),arg:new Uint8Array(c),wasm_module:t,mode:o?{reinstall:null}:{upgrade:null}}})},Jo=async({satellite:e})=>(await Jt({satellite:e})).map(([r,n])=>({domain:r,bn_id:Kr(n.bn_id),created_at:n.created_at,updated_at:n.updated_at})),Go=async({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>Gt({satellite:e,domainName:r,boundaryNodesId:n}))),Yo=e=>Yt(e),Qo=async e=>Qt(e),Xo=async e=>Zt(e),Zo=async e=>Xt(e),Io=async e=>It(e),Do=({deprecatedNoScope:e,...t})=>(e===!0?Oe:Ee)(t),Lo=e=>Dt(e);export{bo as checkUpgradeVersion,Zo as countAssets,Qo as countDocs,Io as deleteAssets,Xo as deleteDocs,Jo as listCustomDomains,ao as listMissionControlControllers,xo as listOrbiterControllers,qo as listRules,Do as listSatelliteControllers,no as missionControlVersion,go as orbiterMemorySize,_o as orbiterVersion,Ko as satelliteBuildType,Ho as satelliteBuildVersion,Yo as satelliteMemorySize,zo as satelliteVersion,Uo as setConfig,Go as setCustomDomains,so as setMissionControlController,jo as setRule,Lo as setSatelliteControllers,io as setSatellitesController,oo as upgradeMissionControl,yo as upgradeOrbiter,Wo as upgradeSatellite};
|
|
14
14
|
//# sourceMappingURL=index.js.map
|