@junobuild/admin 0.0.27 → 0.0.28

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.
@@ -14,7 +14,7 @@ export interface Controller {
14
14
  expires_at: [] | [bigint];
15
15
  }
16
16
  export type ControllerScope = {Write: null} | {Admin: null};
17
- export interface DelOriginConfig {
17
+ export interface DelSatelliteConfig {
18
18
  updated_at: [] | [bigint];
19
19
  }
20
20
  export interface DeleteControllersArgs {
@@ -25,12 +25,6 @@ export interface GetAnalytics {
25
25
  from: [] | [bigint];
26
26
  satellite_id: [] | [Principal];
27
27
  }
28
- export interface OriginConfig {
29
- key: Principal;
30
- updated_at: bigint;
31
- created_at: bigint;
32
- filter: string;
33
- }
34
28
  export interface PageView {
35
29
  title: string;
36
30
  updated_at: bigint;
@@ -47,8 +41,13 @@ export interface PageViewDevice {
47
41
  inner_width: number;
48
42
  }
49
43
  export type Result = {Ok: PageView} | {Err: string};
50
- export type Result_1 = {Ok: null} | {Err: string};
44
+ export type Result_1 = {Ok: null} | {Err: Array<[AnalyticKey, string]>};
51
45
  export type Result_2 = {Ok: TrackEvent} | {Err: string};
46
+ export interface SatelliteConfig {
47
+ updated_at: bigint;
48
+ created_at: bigint;
49
+ enabled: boolean;
50
+ }
52
51
  export interface SetController {
53
52
  metadata: Array<[string, string]>;
54
53
  scope: ControllerScope;
@@ -58,11 +57,6 @@ export interface SetControllersArgs {
58
57
  controller: SetController;
59
58
  controllers: Array<Principal>;
60
59
  }
61
- export interface SetOriginConfig {
62
- key: Principal;
63
- updated_at: [] | [bigint];
64
- filter: string;
65
- }
66
60
  export interface SetPageView {
67
61
  title: string;
68
62
  updated_at: [] | [bigint];
@@ -73,6 +67,10 @@ export interface SetPageView {
73
67
  user_agent: [] | [string];
74
68
  collected_at: bigint;
75
69
  }
70
+ export interface SetSatelliteConfig {
71
+ updated_at: [] | [bigint];
72
+ enabled: boolean;
73
+ }
76
74
  export interface SetTrackEvent {
77
75
  updated_at: [] | [bigint];
78
76
  metadata: [] | [Array<[string, string]>];
@@ -89,15 +87,18 @@ export interface TrackEvent {
89
87
  }
90
88
  export interface _SERVICE {
91
89
  del_controllers: ActorMethod<[DeleteControllersArgs], Array<[Principal, Controller]>>;
92
- del_origin_config: ActorMethod<[Principal, DelOriginConfig], undefined>;
90
+ del_satellite_config: ActorMethod<[Principal, DelSatelliteConfig], undefined>;
93
91
  get_page_views: ActorMethod<[GetAnalytics], Array<[AnalyticKey, PageView]>>;
94
92
  get_track_events: ActorMethod<[GetAnalytics], Array<[AnalyticKey, TrackEvent]>>;
95
93
  list_controllers: ActorMethod<[], Array<[Principal, Controller]>>;
96
- list_origin_configs: ActorMethod<[], Array<[Principal, OriginConfig]>>;
94
+ list_satellite_configs: ActorMethod<[], Array<[Principal, SatelliteConfig]>>;
97
95
  set_controllers: ActorMethod<[SetControllersArgs], Array<[Principal, Controller]>>;
98
- set_origin_config: ActorMethod<[Principal, SetOriginConfig], OriginConfig>;
99
96
  set_page_view: ActorMethod<[AnalyticKey, SetPageView], Result>;
100
97
  set_page_views: ActorMethod<[Array<[AnalyticKey, SetPageView]>], Result_1>;
98
+ set_satellite_configs: ActorMethod<
99
+ [Array<[Principal, SetSatelliteConfig]>],
100
+ Array<[Principal, SatelliteConfig]>
101
+ >;
101
102
  set_track_event: ActorMethod<[AnalyticKey, SetTrackEvent], Result_2>;
102
103
  set_track_events: ActorMethod<[Array<[AnalyticKey, SetTrackEvent]>], Result_1>;
103
104
  version: ActorMethod<[], string>;
@@ -14,7 +14,7 @@ export const idlFactory = ({IDL}) => {
14
14
  scope: ControllerScope,
15
15
  expires_at: IDL.Opt(IDL.Nat64)
16
16
  });
17
- const DelOriginConfig = IDL.Record({updated_at: IDL.Opt(IDL.Nat64)});
17
+ const DelSatelliteConfig = IDL.Record({updated_at: IDL.Opt(IDL.Nat64)});
18
18
  const GetAnalytics = IDL.Record({
19
19
  to: IDL.Opt(IDL.Nat64),
20
20
  from: IDL.Opt(IDL.Nat64),
@@ -47,11 +47,10 @@ export const idlFactory = ({IDL}) => {
47
47
  created_at: IDL.Nat64,
48
48
  collected_at: IDL.Nat64
49
49
  });
50
- const OriginConfig = IDL.Record({
51
- key: IDL.Principal,
50
+ const SatelliteConfig = IDL.Record({
52
51
  updated_at: IDL.Nat64,
53
52
  created_at: IDL.Nat64,
54
- filter: IDL.Text
53
+ enabled: IDL.Bool
55
54
  });
56
55
  const SetController = IDL.Record({
57
56
  metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
@@ -62,11 +61,6 @@ export const idlFactory = ({IDL}) => {
62
61
  controller: SetController,
63
62
  controllers: IDL.Vec(IDL.Principal)
64
63
  });
65
- const SetOriginConfig = IDL.Record({
66
- key: IDL.Principal,
67
- updated_at: IDL.Opt(IDL.Nat64),
68
- filter: IDL.Text
69
- });
70
64
  const SetPageView = IDL.Record({
71
65
  title: IDL.Text,
72
66
  updated_at: IDL.Opt(IDL.Nat64),
@@ -78,7 +72,14 @@ export const idlFactory = ({IDL}) => {
78
72
  collected_at: IDL.Nat64
79
73
  });
80
74
  const Result = IDL.Variant({Ok: PageView, Err: IDL.Text});
81
- const Result_1 = IDL.Variant({Ok: IDL.Null, Err: IDL.Text});
75
+ const Result_1 = IDL.Variant({
76
+ Ok: IDL.Null,
77
+ Err: IDL.Vec(IDL.Tuple(AnalyticKey, IDL.Text))
78
+ });
79
+ const SetSatelliteConfig = IDL.Record({
80
+ updated_at: IDL.Opt(IDL.Nat64),
81
+ enabled: IDL.Bool
82
+ });
82
83
  const SetTrackEvent = IDL.Record({
83
84
  updated_at: IDL.Opt(IDL.Nat64),
84
85
  metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
@@ -93,7 +94,7 @@ export const idlFactory = ({IDL}) => {
93
94
  [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
94
95
  []
95
96
  ),
96
- del_origin_config: IDL.Func([IDL.Principal, DelOriginConfig], [], []),
97
+ del_satellite_config: IDL.Func([IDL.Principal, DelSatelliteConfig], [], []),
97
98
  get_page_views: IDL.Func(
98
99
  [GetAnalytics],
99
100
  [IDL.Vec(IDL.Tuple(AnalyticKey, PageView))],
@@ -105,15 +106,23 @@ export const idlFactory = ({IDL}) => {
105
106
  ['query']
106
107
  ),
107
108
  list_controllers: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], ['query']),
108
- list_origin_configs: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, OriginConfig))], ['query']),
109
+ list_satellite_configs: IDL.Func(
110
+ [],
111
+ [IDL.Vec(IDL.Tuple(IDL.Principal, SatelliteConfig))],
112
+ ['query']
113
+ ),
109
114
  set_controllers: IDL.Func(
110
115
  [SetControllersArgs],
111
116
  [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
112
117
  []
113
118
  ),
114
- set_origin_config: IDL.Func([IDL.Principal, SetOriginConfig], [OriginConfig], []),
115
119
  set_page_view: IDL.Func([AnalyticKey, SetPageView], [Result], []),
116
120
  set_page_views: IDL.Func([IDL.Vec(IDL.Tuple(AnalyticKey, SetPageView))], [Result_1], []),
121
+ set_satellite_configs: IDL.Func(
122
+ [IDL.Vec(IDL.Tuple(IDL.Principal, SetSatelliteConfig))],
123
+ [IDL.Vec(IDL.Tuple(IDL.Principal, SatelliteConfig))],
124
+ []
125
+ ),
117
126
  set_track_event: IDL.Func([AnalyticKey, SetTrackEvent], [Result_2], []),
118
127
  set_track_events: IDL.Func([IDL.Vec(IDL.Tuple(AnalyticKey, SetTrackEvent))], [Result_1], []),
119
128
  version: IDL.Func([], [IDL.Text], ['query'])
@@ -1,4 +1,4 @@
1
- var Lt=Object.defineProperty;var Dt=(e,t)=>{for(var r in t)Lt(e,r,{get:t[r],enumerable:!0})};import{Principal as dr}from"@dfinity/principal";import{Principal as Me}from"@dfinity/principal";var Oe=({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}),h=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(h)}),V=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})}),f=e.Variant({creation:e.Record({controllers:e.Vec(e.Principal)}),code_deployment:e.Record({mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),module_hash:e.Vec(e.Nat8)}),controllers_change:e.Record({controllers:e.Vec(e.Principal)}),code_uninstall:e.Null}),y=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:p,details:f}),g=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),m=e.Record({freezing_threshold:e.Opt(e.Nat),controllers:e.Opt(e.Vec(e.Principal)),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),v=e.Variant({secp256k1:e.Null}),N=e.Record({value:e.Text,name:e.Text}),R=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(N)}),P=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([V],[],[]),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(y),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:g,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))})],[]),create_canister:e.Func([e.Record({settings:e.Opt(m),sender_canister_version:e.Opt(e.Nat64)})],[e.Record({canister_id:a})],[]),delete_canister:e.Func([e.Record({canister_id:a})],[],[]),deposit_cycles:e.Func([e.Record({canister_id:a})],[],[]),ecdsa_public_key:e.Func([e.Record({key_id:e.Record({name:e.Text,curve:v}),canister_id:e.Opt(a),derivation_path:e.Vec(e.Vec(e.Nat8))})],[e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)})],[]),http_request:e.Func([e.Record({url:e.Text,method:e.Variant({get:e.Null,head:e.Null,post:e.Null}),max_response_bytes:e.Opt(e.Nat64),body:e.Opt(e.Vec(e.Nat8)),transform:e.Opt(e.Record({function:e.Func([e.Record({context:e.Vec(e.Nat8),response:R})],[R],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(N)})],[R],[]),install_code:e.Func([e.Record({arg:e.Vec(e.Nat8),wasm_module:P,mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),canister_id:a,sender_canister_version:e.Opt(e.Nat64)})],[],[]),provisional_create_canister_with_cycles:e.Func([e.Record({settings:e.Opt(m),specified_id:e.Opt(a),amount:e.Opt(e.Nat)})],[e.Record({canister_id:a})],[]),provisional_top_up_canister:e.Func([e.Record({canister_id:a,amount:e.Nat})],[],[]),raw_rand:e.Func([],[e.Vec(e.Nat8)],[]),sign_with_ecdsa:e.Func([e.Record({key_id:e.Record({name:e.Text,curve:v}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)})],[e.Record({signature:e.Vec(e.Nat8)})],[]),start_canister:e.Func([e.Record({canister_id:a})],[],[]),stop_canister:e.Func([e.Record({canister_id:a})],[],[]),uninstall_code:e.Func([e.Record({canister_id:a,sender_canister_version:e.Opt(e.Nat64)})],[],[]),update_settings:e.Func([e.Record({canister_id:e.Principal,settings:m,sender_canister_version:e.Opt(e.Nat64)})],[],[])})};var Ae=({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.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.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),s=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),l=e.Record({status:i,memory_size:e.Nat,cycles:e.Nat,settings:s,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),u=e.Record({id:e.Principal,status:l,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),c=e.Variant({Ok:u,Err:e.Text}),h=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),_=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),V=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,_)),satellites:e.Vec(e.Tuple(e.Principal,_)),cycles_threshold:e.Opt(e.Nat64)}),a=e.Record({orbiters:e.Opt(e.Vec(c)),satellites:e.Opt(e.Vec(c)),mission_control:c}),p=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_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,c))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,c)))],["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,c)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,r))],["query"]),remove_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),remove_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),h],[],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[t],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),h],[],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[r],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),h],[],[]),status:e.Func([V],[a],[]),top_up:e.Func([e.Principal,p],[],[]),version:e.Func([],[e.Text],["query"])})};var Ee=({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({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),s=e.Record({key:e.Text,session_id:e.Text,satellite_id:e.Principal}),l=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),u=e.Record({title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,href:e.Text,created_at:e.Nat64,device:l,user_agent:e.Opt(e.Text),collected_at:e.Nat64}),c=e.Record({updated_at:e.Nat64,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,collected_at:e.Nat64}),h=e.Record({key:e.Principal,updated_at:e.Nat64,created_at:e.Nat64,filter:e.Text}),_=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),V=e.Record({controller:_,controllers:e.Vec(e.Principal)}),a=e.Record({key:e.Principal,updated_at:e.Opt(e.Nat64),filter:e.Text}),p=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,href:e.Text,device:l,user_agent:e.Opt(e.Text),collected_at:e.Nat64}),f=e.Variant({Ok:u,Err:e.Text}),y=e.Variant({Ok:e.Null,Err:e.Text}),g=e.Record({updated_at:e.Opt(e.Nat64),metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,user_agent:e.Opt(e.Text),collected_at:e.Nat64}),m=e.Variant({Ok:c,Err:e.Text});return e.Service({del_controllers:e.Func([t],[e.Vec(e.Tuple(e.Principal,n))],[]),del_origin_config:e.Func([e.Principal,o],[],[]),get_page_views:e.Func([i],[e.Vec(e.Tuple(s,u))],["query"]),get_track_events:e.Func([i],[e.Vec(e.Tuple(s,c))],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_origin_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,h))],["query"]),set_controllers:e.Func([V],[e.Vec(e.Tuple(e.Principal,n))],[]),set_origin_config:e.Func([e.Principal,a],[h],[]),set_page_view:e.Func([s,p],[f],[]),set_page_views:e.Func([e.Vec(e.Tuple(s,p))],[y],[]),set_track_event:e.Func([s,g],[m],[]),set_track_events:e.Func([e.Vec(e.Tuple(s,g))],[y],[]),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}),h=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(h),status_code:e.Nat16}),V=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}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),y=e.Record({field:f,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),m=e.Record({order:e.Opt(y),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),v=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),N=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),R=e.Record({key:v,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,N)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,R))}),F=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))}),U=e.Variant({Db:e.Null,Storage:e.Null}),E=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),D=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:E,created_at:e.Nat64,write:E}),z=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),ee=e.Record({controller:z,controllers:e.Vec(e.Principal)}),te=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),re=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:E,write:E}),ne=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),oe=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],[V],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),m],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,F))],["query"]),list_docs:e.Func([e.Text,m],[S],["query"]),list_rules:e.Func([U],[e.Vec(e.Tuple(e.Text,D))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([ee],[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,te],[l],[]),set_rule:e.Func([U,e.Text,re],[],[]),upload_asset_chunk:e.Func([ne],[oe],[]),version:e.Func([],[e.Text],["query"])})};var $e=({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}),h=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(h),status_code:e.Nat16}),V=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}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),y=e.Record({field:f,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),m=e.Record({order:e.Opt(y),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),v=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),N=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),R=e.Record({key:v,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,N)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,R))}),F=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))}),U=e.Variant({Db:e.Null,Storage:e.Null}),E=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),D=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:E,created_at:e.Nat64,write:E}),z=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),ee=e.Record({controller:z,controllers:e.Vec(e.Principal)}),te=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),re=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:E,write:E}),ne=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),oe=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],[V],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),m],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,F))],["query"]),list_docs:e.Func([e.Text,m],[S],["query"]),list_rules:e.Func([U],[e.Vec(e.Tuple(e.Text,D))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([ee],[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,te],[l],[]),set_rule:e.Func([U,e.Text,re],[],[]),upload_asset_chunk:e.Func([ne],[oe],[]),version:e.Func([],[e.Text],["query"])})};var Be=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Variant({Write:e.Null,Admin:e.Null}),o=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:n,expires_at:e.Opt(e.Nat64)}),i=e.Record({updated_at:e.Opt(e.Nat64)}),s=e.Variant({Db:e.Null,Storage:e.Null}),l=e.Record({rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),u=e.Record({storage:l}),c=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64}),h=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),_=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}),V=e.Variant({Callback:e.Record({token:_,callback:e.Func([],[],["query"])})}),a=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(V),status_code:e.Nat16}),p=e.Record({token:e.Opt(_),body:e.Vec(e.Nat8)}),f=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}),y=e.Record({batch_id:e.Nat}),g=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),m=e.Record({field:g,desc:e.Bool}),v=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),N=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),R=e.Record({order:e.Opt(m),owner:e.Opt(e.Principal),matcher:e.Opt(v),paginate:e.Opt(N)}),P=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),F=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),S=e.Record({key:P,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,F)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),U=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,S)),items_length:e.Nat64}),E=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),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,c)),items_length:e.Nat64}),z=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),ee=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:z,created_at:e.Nat64,write:z}),te=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),re=e.Record({controller:te,controllers:e.Vec(e.Principal)}),ne=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8),description:e.Opt(e.Text)}),oe=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:z,write:z}),Zt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),It=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),del_rule:e.Func([s,e.Text,i],[],[]),get_config:e.Func([],[u],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(c)],["query"]),http_request:e.Func([h],[a],["query"]),http_request_streaming_callback:e.Func([_],[p],["query"]),init_asset_upload:e.Func([f],[y],[]),list_assets:e.Func([e.Text,R],[U],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,E))],["query"]),list_docs:e.Func([e.Text,R],[D],["query"]),list_rules:e.Func([s],[e.Vec(e.Tuple(e.Text,ee))],["query"]),set_config:e.Func([u],[],[]),set_controllers:e.Func([re],[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,ne],[c],[]),set_rule:e.Func([s,e.Text,oe],[],[]),upload_asset_chunk:e.Func([Zt],[It],[]),version:e.Func([],[e.Text],["query"])})};import{Actor as er,HttpAgent as tr}from"@dfinity/agent";var be=async({canisterId:e,idlFactory:t,identity:r,fetch:n,env:o="prod",config:i})=>{let s=o==="dev"?"http://127.0.0.1:8000/":"https://icp-api.io",l=new tr({identity:r,...s&&{host:s},...n&&{fetch:n}});return o==="dev"&&await l.fetchRootKey(),er.createActor(t,{agent:l,canisterId:e,...i!==void 0?i:{}})};var qe=async({satelliteId:e,...t})=>se({canisterId:e,...t,idlFactory:$e}),G=async({satelliteId:e,...t})=>se({canisterId:e,...t,idlFactory:Be}),je=async({satelliteId:e,...t})=>se({canisterId:e,...t,idlFactory:ke}),ie=async({missionControlId:e,...t})=>se({canisterId:e,...t,idlFactory:Ae}),ve=async({orbiterId:e,...t})=>se({canisterId:e,...t,idlFactory:Ee});var se=async({canisterId:e,idlFactory:t,...r})=>{if(!e)throw new Error("No canister ID provided.");return be({canisterId:e,idlFactory:t,...r})},ze=Me.fromText("aaaaa-aa"),Ue=(e,t,r)=>{let n=t[0],o=ze;return n&&typeof n=="object"&&n.canister_id&&(o=Me.from(n.canister_id)),{effectiveCanisterId:o}},He=e=>be({canisterId:ze.toText(),config:{callTransform:Ue,queryTransform:Ue},idlFactory:Oe,...e});var J=async({actor:e,code:t})=>{let{install_code:r}=await He(e);return r({...t,mode:{upgrade:null},sender_canister_version:[]})};var Ke=async({missionControl:e})=>(await ie(e)).version(),We=async({missionControl:e})=>(await ie(e)).get_user();var Ge=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await ie(e)).set_satellites_controllers(t,r,n),Je=async({missionControl:e,controllerIds:t,controller:r})=>(await ie(e)).set_mission_control_controllers(t,r);import{Principal as rr}from"@dfinity/principal";import{nonNullish as nr,toNullable as or}from"@junobuild/utils";var Re=({controllerId:e,profile:t})=>({controllerIds:[rr.fromText(e)],controller:ir(t)}),ir=e=>({metadata:nr(e)&&e!==""?[["profile",e]]:[],expires_at:or(void 0),scope:{Admin:null}});var C={};Dt(C,{Bool:()=>De,BoolClass:()=>fe,ConstructType:()=>$,Empty:()=>Ie,EmptyClass:()=>me,FixedIntClass:()=>j,FixedNatClass:()=>k,Float32:()=>ot,Float64:()=>it,FloatClass:()=>ce,Func:()=>wt,FuncClass:()=>le,Int:()=>rt,Int16:()=>at,Int32:()=>ct,Int64:()=>lt,Int8:()=>st,IntClass:()=>ge,Nat:()=>nt,Nat16:()=>pt,Nat32:()=>dt,Nat64:()=>mt,Nat8:()=>ut,NatClass:()=>xe,Null:()=>et,NullClass:()=>_e,Opt:()=>yt,OptClass:()=>W,PrimitiveType:()=>O,Principal:()=>ht,PrincipalClass:()=>Te,Rec:()=>Tt,RecClass:()=>B,Record:()=>gt,RecordClass:()=>Y,Reserved:()=>Le,ReservedClass:()=>X,Service:()=>Nt,ServiceClass:()=>we,Text:()=>tt,TextClass:()=>ye,Tuple:()=>ft,TupleClass:()=>I,Type:()=>Q,Unknown:()=>ur,UnknownClass:()=>he,Variant:()=>xt,VariantClass:()=>L,Vec:()=>_t,VecClass:()=>Z,Visitor:()=>de,decode:()=>lr,encode:()=>cr});import{Principal as ar}from"@dfinity/principal";function d(...e){let t=new Uint8Array(e.reduce((n,o)=>n+o.byteLength,0)),r=0;for(let n of e)t.set(new Uint8Array(n),r),r+=n.byteLength;return t}var M=class{constructor(t,r=t?.byteLength||0){this._buffer=t||new ArrayBuffer(0),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return this._view.slice()}get byteLength(){return this._view.byteLength}read(t){let r=this._view.subarray(0,t);return this._view=this._view.subarray(t),r.slice().buffer}readUint8(){let t=this._view[0];return this._view=this._view.subarray(1),t}write(t){let r=new Uint8Array(t),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+r.byteLength>=this._buffer.byteLength?this.alloc(r.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+r.byteLength),this._view.set(r,n)}get end(){return this._view.byteLength===0}alloc(t){let r=new ArrayBuffer((this._buffer.byteLength+t)*1.2|0),n=new Uint8Array(r,0,this._view.byteLength+t);n.set(this._view),this._buffer=r,this._view=n}};function sr(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function A(e){if(/^_\d+_$/.test(e)||/^_0x[0-9a-fA-F]+_$/.test(e)){let t=+e.slice(1,-1);if(Number.isSafeInteger(t)&&t>=0&&t<2**32)return t}return sr(e)}function Ye(){throw new Error("unexpected end of buffer")}function K(e,t){return e.byteLength<t&&Ye(),e.read(t)}function H(e){let t=e.readUint8();return t===void 0&&Ye(),t}function T(e){if(typeof e=="number"&&(e=BigInt(e)),e<BigInt(0))throw new Error("Cannot leb encode negative values.");let t=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,r=new M(new ArrayBuffer(t),0);for(;;){let n=Number(e&BigInt(127));if(e/=BigInt(128),e===BigInt(0)){r.write(new Uint8Array([n]));break}else r.write(new Uint8Array([n|128]))}return r.buffer}function b(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 w(e){typeof e=="number"&&(e=BigInt(e));let t=e<BigInt(0);t&&(e=-e-BigInt(1));let r=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,n=new M(new ArrayBuffer(r),0);for(;;){let i=o(e);if(e/=BigInt(128),t&&e===BigInt(0)&&i&64||!t&&e===BigInt(0)&&!(i&64)){n.write(new Uint8Array([i]));break}else n.write(new Uint8Array([i|128]))}function o(i){let s=i%BigInt(128);return Number(t?BigInt(128)-s-BigInt(1):s)}return n.buffer}function q(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return b(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 Qe(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Ve(e,t)}function Ve(e,t){e=BigInt(e);let r=new M(new ArrayBuffer(Math.min(1,t)),0),n=0,o=BigInt(256),i=BigInt(0),s=Number(e%o);for(r.write(new Uint8Array([s]));++n<t;)e<0&&i===BigInt(0)&&s!==0&&(i=BigInt(1)),s=Number((e/o-i)%BigInt(256)),r.write(new Uint8Array([s])),o*=BigInt(256);return r.buffer}function Pe(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 Xe(e,t){let r=Pe(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function ue(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var pe="DIDL",Ze=400;function ae(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=T(this._typs.length),r=d(...this._typs);return d(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return w(this._idx.get(t)||0)}},de=class{visitType(t,r){throw new Error("Not implemented")}visitPrimitive(t,r){return this.visitType(t,r)}visitEmpty(t,r){return this.visitPrimitive(t,r)}visitBool(t,r){return this.visitPrimitive(t,r)}visitNull(t,r){return this.visitPrimitive(t,r)}visitReserved(t,r){return this.visitPrimitive(t,r)}visitText(t,r){return this.visitPrimitive(t,r)}visitNumber(t,r){return this.visitPrimitive(t,r)}visitInt(t,r){return this.visitNumber(t,r)}visitNat(t,r){return this.visitNumber(t,r)}visitFloat(t,r){return this.visitPrimitive(t,r)}visitFixedInt(t,r){return this.visitNumber(t,r)}visitFixedNat(t,r){return this.visitNumber(t,r)}visitPrincipal(t,r){return this.visitPrimitive(t,r)}visitConstruct(t,r){return this.visitType(t,r)}visitVec(t,r,n){return this.visitConstruct(t,n)}visitOpt(t,r,n){return this.visitConstruct(t,n)}visitRecord(t,r,n){return this.visitConstruct(t,n)}visitTuple(t,r,n){let o=r.map((i,s)=>[`_${s}_`,i]);return this.visitRecord(t,o,n)}visitVariant(t,r,n){return this.visitConstruct(t,n)}visitRec(t,r,n){return this.visitConstruct(r,n)}visitFunc(t,r){return this.visitConstruct(t,r)}visitService(t,r){return this.visitConstruct(t,r)}},Q=class{display(){return this.name}valueToString(t){return x(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},O=class extends Q{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 Q{checkType(t){if(t instanceof B){let r=t.getType();if(typeof r>"u")throw new Error("type mismatch with uninitialized type");return r}throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`)}encodeType(t){return t.indexOf(this.name)}},me=class extends O{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 w(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},he=class extends Q{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 B?o=()=>r.getType():o=()=>r,Object.defineProperty(n,"type",{value:o,writable:!0,enumerable:!1,configurable:!0}),n}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}},fe=class extends O{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 w(-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"}},_e=class extends O{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 w(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},X=class extends O{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return w(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}},ye=class extends O{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=T(r.byteLength);return d(n,r)}encodeType(){return w(-15)}decodeValue(t,r){this.checkType(r);let n=b(t),o=K(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},ge=class extends O{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 w(t)}encodeType(){return w(-4)}decodeValue(t,r){return this.checkType(r),q(t)}get name(){return"int"}valueToString(t){return t.toString()}},xe=class extends O{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 T(t)}encodeType(){return w(-3)}decodeValue(t,r){return this.checkType(r),b(t)}get name(){return"nat"}valueToString(t){return t.toString()}},ce=class extends O{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 w(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 O{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=ue(this._bits-1)*BigInt(-1),n=ue(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 Ve(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return w(-9-t)}decodeValue(t,r){this.checkType(r);let n=Xe(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},k=class extends O{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=ue(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 Qe(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return w(-5-t)}decodeValue(t,r){this.checkType(r);let n=Pe(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},Z=class extends ${constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof k&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof k?this._type._bits:this._type instanceof j?this._type._bits:0;if(ArrayBuffer.isView(t)&&r==t.BYTES_PER_ELEMENT*8||Array.isArray(t)&&t.every((n,o)=>{try{return this._type.covariant(n)}catch(i){throw new Error(`Invalid ${this.display()} argument:
1
+ var Lt=Object.defineProperty;var Dt=(e,t)=>{for(var r in t)Lt(e,r,{get:t[r],enumerable:!0})};import{Principal as dr}from"@dfinity/principal";import{Principal as Me}from"@dfinity/principal";var Oe=({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}),h=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(h)}),V=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})}),f=e.Variant({creation:e.Record({controllers:e.Vec(e.Principal)}),code_deployment:e.Record({mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),module_hash:e.Vec(e.Nat8)}),controllers_change:e.Record({controllers:e.Vec(e.Principal)}),code_uninstall:e.Null}),g=e.Record({timestamp_nanos:e.Nat64,canister_version:e.Nat64,origin:p,details:f}),y=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),m=e.Record({freezing_threshold:e.Opt(e.Nat),controllers:e.Opt(e.Vec(e.Principal)),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),v=e.Variant({secp256k1:e.Null}),N=e.Record({value:e.Text,name:e.Text}),R=e.Record({status:e.Nat,body:e.Vec(e.Nat8),headers:e.Vec(N)}),P=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([V],[],[]),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(m),sender_canister_version:e.Opt(e.Nat64)})],[e.Record({canister_id:a})],[]),delete_canister:e.Func([e.Record({canister_id:a})],[],[]),deposit_cycles:e.Func([e.Record({canister_id:a})],[],[]),ecdsa_public_key:e.Func([e.Record({key_id:e.Record({name:e.Text,curve:v}),canister_id:e.Opt(a),derivation_path:e.Vec(e.Vec(e.Nat8))})],[e.Record({public_key:e.Vec(e.Nat8),chain_code:e.Vec(e.Nat8)})],[]),http_request:e.Func([e.Record({url:e.Text,method:e.Variant({get:e.Null,head:e.Null,post:e.Null}),max_response_bytes:e.Opt(e.Nat64),body:e.Opt(e.Vec(e.Nat8)),transform:e.Opt(e.Record({function:e.Func([e.Record({context:e.Vec(e.Nat8),response:R})],[R],["query"]),context:e.Vec(e.Nat8)})),headers:e.Vec(N)})],[R],[]),install_code:e.Func([e.Record({arg:e.Vec(e.Nat8),wasm_module:P,mode:e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),canister_id:a,sender_canister_version:e.Opt(e.Nat64)})],[],[]),provisional_create_canister_with_cycles:e.Func([e.Record({settings:e.Opt(m),specified_id:e.Opt(a),amount:e.Opt(e.Nat)})],[e.Record({canister_id:a})],[]),provisional_top_up_canister:e.Func([e.Record({canister_id:a,amount:e.Nat})],[],[]),raw_rand:e.Func([],[e.Vec(e.Nat8)],[]),sign_with_ecdsa:e.Func([e.Record({key_id:e.Record({name:e.Text,curve:v}),derivation_path:e.Vec(e.Vec(e.Nat8)),message_hash:e.Vec(e.Nat8)})],[e.Record({signature:e.Vec(e.Nat8)})],[]),start_canister:e.Func([e.Record({canister_id:a})],[],[]),stop_canister:e.Func([e.Record({canister_id:a})],[],[]),uninstall_code:e.Func([e.Record({canister_id:a,sender_canister_version:e.Opt(e.Nat64)})],[],[]),update_settings:e.Func([e.Record({canister_id:e.Principal,settings:m,sender_canister_version:e.Opt(e.Nat64)})],[],[])})};var Ae=({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.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.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),s=e.Record({freezing_threshold:e.Nat,controllers:e.Vec(e.Principal),memory_allocation:e.Nat,compute_allocation:e.Nat}),l=e.Record({status:i,memory_size:e.Nat,cycles:e.Nat,settings:s,idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),u=e.Record({id:e.Principal,status:l,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),status_at:e.Nat64}),c=e.Variant({Ok:u,Err:e.Text}),h=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),_=e.Record({enabled:e.Bool,cycles_threshold:e.Opt(e.Nat64)}),V=e.Record({mission_control_cycles_threshold:e.Opt(e.Nat64),orbiters:e.Vec(e.Tuple(e.Principal,_)),satellites:e.Vec(e.Tuple(e.Principal,_)),cycles_threshold:e.Opt(e.Nat64)}),a=e.Record({orbiters:e.Opt(e.Vec(c)),satellites:e.Opt(e.Vec(c)),mission_control:c}),p=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_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),get_user:e.Func([],[e.Principal],["query"]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_mission_control_statuses:e.Func([],[e.Vec(e.Tuple(e.Nat64,c))],["query"]),list_orbiter_statuses:e.Func([e.Principal],[e.Opt(e.Vec(e.Tuple(e.Nat64,c)))],["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,c)))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,r))],["query"]),remove_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),remove_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),h],[],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[t],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),h],[],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[r],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),h],[],[]),status:e.Func([V],[a],[]),top_up:e.Func([e.Principal,p],[],[]),version:e.Func([],[e.Text],["query"])})};var Ee=({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({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),s=e.Record({key:e.Text,session_id:e.Text,satellite_id:e.Principal}),l=e.Record({inner_height:e.Nat16,inner_width:e.Nat16}),u=e.Record({title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,href:e.Text,created_at:e.Nat64,device:l,user_agent:e.Opt(e.Text),collected_at:e.Nat64}),c=e.Record({updated_at:e.Nat64,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,collected_at:e.Nat64}),h=e.Record({updated_at:e.Nat64,created_at:e.Nat64,enabled:e.Bool}),_=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),V=e.Record({controller:_,controllers:e.Vec(e.Principal)}),a=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,href:e.Text,device:l,user_agent:e.Opt(e.Text),collected_at:e.Nat64}),p=e.Variant({Ok:u,Err:e.Text}),f=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(s,e.Text))}),g=e.Record({updated_at:e.Opt(e.Nat64),enabled:e.Bool}),y=e.Record({updated_at:e.Opt(e.Nat64),metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,user_agent:e.Opt(e.Text),collected_at:e.Nat64}),m=e.Variant({Ok:c,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],[],[]),get_page_views:e.Func([i],[e.Vec(e.Tuple(s,u))],["query"]),get_track_events:e.Func([i],[e.Vec(e.Tuple(s,c))],["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"]),set_controllers:e.Func([V],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([s,a],[p],[]),set_page_views:e.Func([e.Vec(e.Tuple(s,a))],[f],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,g))],[e.Vec(e.Tuple(e.Principal,h))],[]),set_track_event:e.Func([s,y],[m],[]),set_track_events:e.Func([e.Vec(e.Tuple(s,y))],[f],[]),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}),h=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(h),status_code:e.Nat16}),V=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}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),g=e.Record({field:f,desc:e.Bool}),y=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),m=e.Record({order:e.Opt(g),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(y)}),v=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),N=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),R=e.Record({key:v,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,N)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,R))}),F=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))}),U=e.Variant({Db:e.Null,Storage:e.Null}),E=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),D=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:E,created_at:e.Nat64,write:E}),z=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),ee=e.Record({controller:z,controllers:e.Vec(e.Principal)}),te=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),re=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:E,write:E}),ne=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),oe=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],[V],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),m],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,F))],["query"]),list_docs:e.Func([e.Text,m],[S],["query"]),list_rules:e.Func([U],[e.Vec(e.Tuple(e.Text,D))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([ee],[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,te],[l],[]),set_rule:e.Func([U,e.Text,re],[],[]),upload_asset_chunk:e.Func([ne],[oe],[]),version:e.Func([],[e.Text],["query"])})};var $e=({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}),h=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(h),status_code:e.Nat16}),V=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}),f=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),g=e.Record({field:f,desc:e.Bool}),y=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),m=e.Record({order:e.Opt(g),matcher:e.Opt(e.Text),paginate:e.Opt(y)}),v=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),N=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),R=e.Record({key:v,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,N)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),P=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,R))}),F=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))}),U=e.Variant({Db:e.Null,Storage:e.Null}),E=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),D=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:E,created_at:e.Nat64,write:E}),z=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),ee=e.Record({controller:z,controllers:e.Vec(e.Principal)}),te=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),re=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:E,write:E}),ne=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),oe=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],[V],["query"]),init_asset_upload:e.Func([a],[p],[]),list_assets:e.Func([e.Opt(e.Text),m],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,F))],["query"]),list_docs:e.Func([e.Text,m],[S],["query"]),list_rules:e.Func([U],[e.Vec(e.Tuple(e.Text,D))],["query"]),set_config:e.Func([s],[],[]),set_controllers:e.Func([ee],[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,te],[l],[]),set_rule:e.Func([U,e.Text,re],[],[]),upload_asset_chunk:e.Func([ne],[oe],[]),version:e.Func([],[e.Text],["query"])})};var Be=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Record({controllers:e.Vec(e.Principal)}),n=e.Variant({Write:e.Null,Admin:e.Null}),o=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:n,expires_at:e.Opt(e.Nat64)}),i=e.Record({updated_at:e.Opt(e.Nat64)}),s=e.Variant({Db:e.Null,Storage:e.Null}),l=e.Record({rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),u=e.Record({storage:l}),c=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64}),h=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),_=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}),V=e.Variant({Callback:e.Record({token:_,callback:e.Func([],[],["query"])})}),a=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(V),status_code:e.Nat16}),p=e.Record({token:e.Opt(_),body:e.Vec(e.Nat8)}),f=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}),g=e.Record({batch_id:e.Nat}),y=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),m=e.Record({field:y,desc:e.Bool}),v=e.Record({key:e.Opt(e.Text),description:e.Opt(e.Text)}),N=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),R=e.Record({order:e.Opt(m),owner:e.Opt(e.Principal),matcher:e.Opt(v),paginate:e.Opt(N)}),P=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),F=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),S=e.Record({key:P,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,F)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64}),U=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,S)),items_length:e.Nat64}),E=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),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,c)),items_length:e.Nat64}),z=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),ee=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:z,created_at:e.Nat64,write:z}),te=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:n,expires_at:e.Opt(e.Nat64)}),re=e.Record({controller:te,controllers:e.Vec(e.Principal)}),ne=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8),description:e.Opt(e.Text)}),oe=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:z,write:z}),Zt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),It=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,o))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),del_rule:e.Func([s,e.Text,i],[],[]),get_config:e.Func([],[u],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(c)],["query"]),http_request:e.Func([h],[a],["query"]),http_request_streaming_callback:e.Func([_],[p],["query"]),init_asset_upload:e.Func([f],[g],[]),list_assets:e.Func([e.Text,R],[U],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,E))],["query"]),list_docs:e.Func([e.Text,R],[D],["query"]),list_rules:e.Func([s],[e.Vec(e.Tuple(e.Text,ee))],["query"]),set_config:e.Func([u],[],[]),set_controllers:e.Func([re],[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,ne],[c],[]),set_rule:e.Func([s,e.Text,oe],[],[]),upload_asset_chunk:e.Func([Zt],[It],[]),version:e.Func([],[e.Text],["query"])})};import{Actor as er,HttpAgent as tr}from"@dfinity/agent";var be=async({canisterId:e,idlFactory:t,identity:r,fetch:n,env:o="prod",config:i})=>{let s=o==="dev"?"http://127.0.0.1:8000/":"https://icp-api.io",l=new tr({identity:r,...s&&{host:s},...n&&{fetch:n}});return o==="dev"&&await l.fetchRootKey(),er.createActor(t,{agent:l,canisterId:e,...i!==void 0?i:{}})};var qe=async({satelliteId:e,...t})=>se({canisterId:e,...t,idlFactory:$e}),G=async({satelliteId:e,...t})=>se({canisterId:e,...t,idlFactory:Be}),je=async({satelliteId:e,...t})=>se({canisterId:e,...t,idlFactory:ke}),ie=async({missionControlId:e,...t})=>se({canisterId:e,...t,idlFactory:Ae}),ve=async({orbiterId:e,...t})=>se({canisterId:e,...t,idlFactory:Ee});var se=async({canisterId:e,idlFactory:t,...r})=>{if(!e)throw new Error("No canister ID provided.");return be({canisterId:e,idlFactory:t,...r})},ze=Me.fromText("aaaaa-aa"),Ue=(e,t,r)=>{let n=t[0],o=ze;return n&&typeof n=="object"&&n.canister_id&&(o=Me.from(n.canister_id)),{effectiveCanisterId:o}},He=e=>be({canisterId:ze.toText(),config:{callTransform:Ue,queryTransform:Ue},idlFactory:Oe,...e});var J=async({actor:e,code:t})=>{let{install_code:r}=await He(e);return r({...t,mode:{upgrade:null},sender_canister_version:[]})};var Ke=async({missionControl:e})=>(await ie(e)).version(),We=async({missionControl:e})=>(await ie(e)).get_user();var Ge=async({missionControl:e,satelliteIds:t,controllerIds:r,controller:n})=>(await ie(e)).set_satellites_controllers(t,r,n),Je=async({missionControl:e,controllerIds:t,controller:r})=>(await ie(e)).set_mission_control_controllers(t,r);import{Principal as rr}from"@dfinity/principal";import{nonNullish as nr,toNullable as or}from"@junobuild/utils";var Re=({controllerId:e,profile:t})=>({controllerIds:[rr.fromText(e)],controller:ir(t)}),ir=e=>({metadata:nr(e)&&e!==""?[["profile",e]]:[],expires_at:or(void 0),scope:{Admin:null}});var C={};Dt(C,{Bool:()=>De,BoolClass:()=>fe,ConstructType:()=>$,Empty:()=>Ie,EmptyClass:()=>me,FixedIntClass:()=>j,FixedNatClass:()=>k,Float32:()=>ot,Float64:()=>it,FloatClass:()=>ce,Func:()=>wt,FuncClass:()=>le,Int:()=>rt,Int16:()=>at,Int32:()=>ct,Int64:()=>lt,Int8:()=>st,IntClass:()=>ge,Nat:()=>nt,Nat16:()=>pt,Nat32:()=>dt,Nat64:()=>mt,Nat8:()=>ut,NatClass:()=>xe,Null:()=>et,NullClass:()=>_e,Opt:()=>yt,OptClass:()=>W,PrimitiveType:()=>O,Principal:()=>ht,PrincipalClass:()=>Te,Rec:()=>Tt,RecClass:()=>B,Record:()=>gt,RecordClass:()=>Y,Reserved:()=>Le,ReservedClass:()=>X,Service:()=>Nt,ServiceClass:()=>we,Text:()=>tt,TextClass:()=>ye,Tuple:()=>ft,TupleClass:()=>I,Type:()=>Q,Unknown:()=>ur,UnknownClass:()=>he,Variant:()=>xt,VariantClass:()=>L,Vec:()=>_t,VecClass:()=>Z,Visitor:()=>de,decode:()=>lr,encode:()=>cr});import{Principal as ar}from"@dfinity/principal";function d(...e){let t=new Uint8Array(e.reduce((n,o)=>n+o.byteLength,0)),r=0;for(let n of e)t.set(new Uint8Array(n),r),r+=n.byteLength;return t}var M=class{constructor(t,r=t?.byteLength||0){this._buffer=t||new ArrayBuffer(0),this._view=new Uint8Array(this._buffer,0,r)}get buffer(){return this._view.slice()}get byteLength(){return this._view.byteLength}read(t){let r=this._view.subarray(0,t);return this._view=this._view.subarray(t),r.slice().buffer}readUint8(){let t=this._view[0];return this._view=this._view.subarray(1),t}write(t){let r=new Uint8Array(t),n=this._view.byteLength;this._view.byteOffset+this._view.byteLength+r.byteLength>=this._buffer.byteLength?this.alloc(r.byteLength):this._view=new Uint8Array(this._buffer,this._view.byteOffset,this._view.byteLength+r.byteLength),this._view.set(r,n)}get end(){return this._view.byteLength===0}alloc(t){let r=new ArrayBuffer((this._buffer.byteLength+t)*1.2|0),n=new Uint8Array(r,0,this._view.byteLength+t);n.set(this._view),this._buffer=r,this._view=n}};function sr(e){let r=new TextEncoder().encode(e),n=0;for(let o of r)n=(n*223+o)%2**32;return n}function A(e){if(/^_\d+_$/.test(e)||/^_0x[0-9a-fA-F]+_$/.test(e)){let t=+e.slice(1,-1);if(Number.isSafeInteger(t)&&t>=0&&t<2**32)return t}return sr(e)}function Ye(){throw new Error("unexpected end of buffer")}function K(e,t){return e.byteLength<t&&Ye(),e.read(t)}function H(e){let t=e.readUint8();return t===void 0&&Ye(),t}function T(e){if(typeof e=="number"&&(e=BigInt(e)),e<BigInt(0))throw new Error("Cannot leb encode negative values.");let t=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,r=new M(new ArrayBuffer(t),0);for(;;){let n=Number(e&BigInt(127));if(e/=BigInt(128),e===BigInt(0)){r.write(new Uint8Array([n]));break}else r.write(new Uint8Array([n|128]))}return r.buffer}function b(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 w(e){typeof e=="number"&&(e=BigInt(e));let t=e<BigInt(0);t&&(e=-e-BigInt(1));let r=(e===BigInt(0)?0:Math.ceil(Math.log2(Number(e))))+1,n=new M(new ArrayBuffer(r),0);for(;;){let i=o(e);if(e/=BigInt(128),t&&e===BigInt(0)&&i&64||!t&&e===BigInt(0)&&!(i&64)){n.write(new Uint8Array([i]));break}else n.write(new Uint8Array([i|128]))}function o(i){let s=i%BigInt(128);return Number(t?BigInt(128)-s-BigInt(1):s)}return n.buffer}function q(e){let t=new Uint8Array(e.buffer),r=0;for(;r<t.byteLength;r++)if(t[r]<128){if(!(t[r]&64))return b(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 Qe(e,t){if(BigInt(e)<BigInt(0))throw new Error("Cannot write negative values.");return Ve(e,t)}function Ve(e,t){e=BigInt(e);let r=new M(new ArrayBuffer(Math.min(1,t)),0),n=0,o=BigInt(256),i=BigInt(0),s=Number(e%o);for(r.write(new Uint8Array([s]));++n<t;)e<0&&i===BigInt(0)&&s!==0&&(i=BigInt(1)),s=Number((e/o-i)%BigInt(256)),r.write(new Uint8Array([s])),o*=BigInt(256);return r.buffer}function Pe(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 Xe(e,t){let r=Pe(e,t),n=BigInt(2)**(BigInt(8)*BigInt(t-1)+BigInt(7));return r>=n&&(r-=n*BigInt(2)),r}function ue(e){let t=BigInt(e);if(e<0)throw new RangeError("Input must be non-negative");return BigInt(1)<<t}var pe="DIDL",Ze=400;function ae(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=T(this._typs.length),r=d(...this._typs);return d(t,r)}indexOf(t){if(!this._idx.has(t))throw new Error("Missing type index for "+t);return w(this._idx.get(t)||0)}},de=class{visitType(t,r){throw new Error("Not implemented")}visitPrimitive(t,r){return this.visitType(t,r)}visitEmpty(t,r){return this.visitPrimitive(t,r)}visitBool(t,r){return this.visitPrimitive(t,r)}visitNull(t,r){return this.visitPrimitive(t,r)}visitReserved(t,r){return this.visitPrimitive(t,r)}visitText(t,r){return this.visitPrimitive(t,r)}visitNumber(t,r){return this.visitPrimitive(t,r)}visitInt(t,r){return this.visitNumber(t,r)}visitNat(t,r){return this.visitNumber(t,r)}visitFloat(t,r){return this.visitPrimitive(t,r)}visitFixedInt(t,r){return this.visitNumber(t,r)}visitFixedNat(t,r){return this.visitNumber(t,r)}visitPrincipal(t,r){return this.visitPrimitive(t,r)}visitConstruct(t,r){return this.visitType(t,r)}visitVec(t,r,n){return this.visitConstruct(t,n)}visitOpt(t,r,n){return this.visitConstruct(t,n)}visitRecord(t,r,n){return this.visitConstruct(t,n)}visitTuple(t,r,n){let o=r.map((i,s)=>[`_${s}_`,i]);return this.visitRecord(t,o,n)}visitVariant(t,r,n){return this.visitConstruct(t,n)}visitRec(t,r,n){return this.visitConstruct(r,n)}visitFunc(t,r){return this.visitConstruct(t,r)}visitService(t,r){return this.visitConstruct(t,r)}},Q=class{display(){return this.name}valueToString(t){return x(t)}buildTypeTable(t){t.has(this)||this._buildTypeTableImpl(t)}},O=class extends Q{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 Q{checkType(t){if(t instanceof B){let r=t.getType();if(typeof r>"u")throw new Error("type mismatch with uninitialized type");return r}throw new Error(`type mismatch: type on the wire ${t.name}, expect type ${this.name}`)}encodeType(t){return t.indexOf(this.name)}},me=class extends O{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 w(-17)}decodeValue(){throw new Error("Empty cannot appear as an output")}get name(){return"empty"}},he=class extends Q{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 B?o=()=>r.getType():o=()=>r,Object.defineProperty(n,"type",{value:o,writable:!0,enumerable:!1,configurable:!0}),n}_buildTypeTableImpl(){throw new Error("Unknown cannot be serialized")}get name(){return"Unknown"}},fe=class extends O{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 w(-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"}},_e=class extends O{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 w(-1)}decodeValue(t,r){return this.checkType(r),null}get name(){return"null"}},X=class extends O{accept(t,r){return t.visitReserved(this,r)}covariant(t){return!0}encodeValue(){return new ArrayBuffer(0)}encodeType(){return w(-16)}decodeValue(t,r){return r.name!==this.name&&r.decodeValue(t,r),null}get name(){return"reserved"}},ye=class extends O{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=T(r.byteLength);return d(n,r)}encodeType(){return w(-15)}decodeValue(t,r){this.checkType(r);let n=b(t),o=K(t,Number(n));return new TextDecoder("utf8",{fatal:!0}).decode(o)}get name(){return"text"}valueToString(t){return'"'+t+'"'}},ge=class extends O{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 w(t)}encodeType(){return w(-4)}decodeValue(t,r){return this.checkType(r),q(t)}get name(){return"int"}valueToString(t){return t.toString()}},xe=class extends O{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 T(t)}encodeType(){return w(-3)}decodeValue(t,r){return this.checkType(r),b(t)}get name(){return"nat"}valueToString(t){return t.toString()}},ce=class extends O{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 w(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 O{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedInt(this,r)}covariant(t){let r=ue(this._bits-1)*BigInt(-1),n=ue(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 Ve(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return w(-9-t)}decodeValue(t,r){this.checkType(r);let n=Xe(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`int${this._bits}`}valueToString(t){return t.toString()}},k=class extends O{constructor(t){super(),this._bits=t}accept(t,r){return t.visitFixedNat(this,r)}covariant(t){let r=ue(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 Qe(t,this._bits/8)}encodeType(){let t=Math.log2(this._bits)-3;return w(-5-t)}decodeValue(t,r){this.checkType(r);let n=Pe(t,this._bits/8);return this._bits<=32?Number(n):n}get name(){return`nat${this._bits}`}valueToString(t){return t.toString()}},Z=class extends ${constructor(t){super(),this._type=t,this._blobOptimization=!1,t instanceof k&&t._bits===8&&(this._blobOptimization=!0)}accept(t,r){return t.visitVec(this,this._type,r)}covariant(t){let r=this._type instanceof k?this._type._bits:this._type instanceof j?this._type._bits:0;if(ArrayBuffer.isView(t)&&r==t.BYTES_PER_ELEMENT*8||Array.isArray(t)&&t.every((n,o)=>{try{return this._type.covariant(n)}catch(i){throw new Error(`Invalid ${this.display()} argument:
2
2
 
3
3
  index ${o} -> ${i.message}`)}}))return!0;throw new Error(`Invalid ${this.display()} argument: ${x(t)}`)}encodeValue(t){let r=T(t.length);if(this._blobOptimization)return d(r,new Uint8Array(t));if(ArrayBuffer.isView(t))return d(r,new Uint8Array(t.buffer));let n=new M(new ArrayBuffer(r.byteLength+t.length),0);n.write(r);for(let o of t){let i=this._type.encodeValue(o);n.write(new Uint8Array(i))}return n.buffer}_buildTypeTableImpl(t){this._type.buildTypeTable(t);let r=w(-19),n=this._type.encodeType(t);t.add(this,d(r,n))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof Z))throw new Error("Not a vector type");let o=Number(b(t));if(this._type instanceof k){if(this._type._bits==8)return new Uint8Array(t.read(o));if(this._type._bits==16)return new Uint16Array(t.read(o*2));if(this._type._bits==32)return new Uint32Array(t.read(o*4));if(this._type._bits==64)return new BigUint64Array(t.read(o*8))}if(this._type instanceof j){if(this._type._bits==8)return new Int8Array(t.read(o));if(this._type._bits==16)return new Int16Array(t.read(o*2));if(this._type._bits==32)return new Int32Array(t.read(o*4));if(this._type._bits==64)return new BigInt64Array(t.read(o*8))}let i=[];for(let s=0;s<o;s++)i.push(this._type.decodeValue(t,n._type));return i}get name(){return`vec ${this._type.name}`}display(){return`vec ${this._type.display()}`}valueToString(t){return"vec {"+t.map(n=>this._type.valueToString(n)).join("; ")+"}"}},W=class extends ${constructor(t){super(),this._type=t}accept(t,r){return t.visitOpt(this,this._type,r)}covariant(t){try{if(Array.isArray(t)&&(t.length===0||t.length===1&&this._type.covariant(t[0])))return!0}catch(r){throw new Error(`Invalid ${this.display()} argument: ${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=T(r),s=o.encodeValue(t[n]);return d(i,s)}}throw Error("Variant has no data: "+t)}_buildTypeTableImpl(t){this._fields.forEach(([,i])=>{i.buildTypeTable(t)});let r=w(-21),n=T(this._fields.length),o=this._fields.map(([i,s])=>d(T(A(i)),s.encodeType(t)));t.add(this,d(r,n,...o))}decodeValue(t,r){let n=this.checkType(r);if(!(n instanceof L))throw new Error("Not a variant type");let o=Number(b(t));if(o>=n._fields.length)throw Error("Invalid variant index: "+o);let[i,s]=n._fields[o];for(let[l,u]of this._fields)if(A(i)===A(l)){let c=u.decodeValue(t,s);return{[l]:c}}throw new Error("Cannot find field hash "+i)}get name(){return`variant {${this._fields.map(([r,n])=>r+":"+n.name).join("; ")}}`}display(){return`variant {${this._fields.map(([r,n])=>r+(n.name==="null"?"":`:${n.display()}`)).join("; ")}}`}valueToString(t){for(let[r,n]of this._fields)if(t.hasOwnProperty(r)){let o=n.valueToString(t[r]);return o==="null"?`variant {${r}}`:`variant {${r}=${o}}`}throw new Error("Variant has no data: "+t)}},B=class extends ${constructor(){super(...arguments),this._id=B._counter++,this._type=void 0}accept(t,r){if(!this._type)throw Error("Recursive type uninitialized.");return t.visitRec(this,this._type,r)}fill(t){this._type=t}getType(){return this._type}covariant(t){if(this._type&&this._type.covariant(t))return!0;throw new Error(`Invalid ${this.display()} argument: ${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)}};B._counter=0;function Fe(e){if(H(e)!==1)throw new Error("Cannot decode principal");let r=Number(b(e));return ar.fromUint8Array(new Uint8Array(K(e,r)))}var Te=class extends O{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=T(r.byteLength);return d(new Uint8Array([1]),n,r)}encodeType(){return w(-24)}decodeValue(t,r){return this.checkType(r),Fe(t)}get name(){return"principal"}valueToString(t){return`${this.name} "${t.toText()}"`}},le=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=T(n.byteLength),i=d(new Uint8Array([1]),o,n),s=new TextEncoder().encode(r),l=T(s.byteLength);return d(new Uint8Array([1]),i,l,s)}_buildTypeTableImpl(t){this.argTypes.forEach(c=>c.buildTypeTable(t)),this.retTypes.forEach(c=>c.buildTypeTable(t));let r=w(-22),n=T(this.argTypes.length),o=d(...this.argTypes.map(c=>c.encodeType(t))),i=T(this.retTypes.length),s=d(...this.retTypes.map(c=>c.encodeType(t))),l=T(this.annotations.length),u=d(...this.annotations.map(c=>this.encodeAnnotation(c)));t.add(this,d(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(b(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")}},we=class extends ${constructor(t){super(),this._fields=Object.entries(t).sort((r,n)=>A(r[0])-A(n[0]))}accept(t,r){return t.visitService(this,r)}covariant(t){if(t&&t._isPrincipal)return!0;throw new Error(`Invalid ${this.display()} argument: ${x(t)}`)}encodeValue(t){let r=t.toUint8Array(),n=T(r.length);return d(new Uint8Array([1]),n,r)}_buildTypeTableImpl(t){this._fields.forEach(([i,s])=>s.buildTypeTable(t));let r=w(-23),n=T(this._fields.length),o=this._fields.map(([i,s])=>{let l=new TextEncoder().encode(i),u=T(l.length);return d(u,l,s.encodeType(t))});t.add(this,d(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>Ze?t.substring(0,Ze-3)+"...":t}function cr(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(pe),o=r.encode(),i=T(t.length),s=d(...e.map(u=>u.encodeType(r))),l=d(...ae(e,t,(u,c)=>{try{u.covariant(c)}catch(h){throw new Error(h.message+`
12
12
 
13
- `)}return u.encodeValue(c)}));return d(n,o,i,s,l)}function lr(e,t){let r=new M(t);if(t.byteLength<pe.length)throw new Error("Message length smaller than magic number");let n=K(r,pe.length),o=new TextDecoder().decode(n);if(o!==pe)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let p=[],f=Number(b(a));for(let m=0;m<f;m++){let v=Number(q(a));switch(v){case-18:case-19:{let N=Number(q(a));p.push([v,N]);break}case-20:case-21:{let N=[],R=Number(b(a)),P;for(;R--;){let F=Number(b(a));if(F>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof P=="number"&&P>=F)throw new Error("field id collision or not sorted");P=F;let S=Number(q(a));N.push([F,S])}p.push([v,N]);break}case-22:{let N=[],R=Number(b(a));for(;R--;)N.push(Number(q(a)));let P=[],F=Number(b(a));for(;F--;)P.push(Number(q(a)));let S=[],U=Number(b(a));for(;U--;)switch(Number(b(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([v,[N,P,S]]);break}case-23:{let N=Number(b(a)),R=[];for(;N--;){let P=Number(b(a)),F=new TextDecoder().decode(K(a,P)),S=q(a);R.push([F,S])}p.push([v,R]);break}default:throw new Error("Illegal op_code: "+v)}}let y=[],g=Number(b(a));for(let m=0;m<g;m++)y.push(Number(q(a)));return[p,y]}let[s,l]=i(r);if(l.length<e.length)throw new Error("Wrong number of return values");let u=s.map(a=>Tt());function c(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return et;case-2:return De;case-3:return nt;case-4:return rt;case-5:return ut;case-6:return pt;case-7:return dt;case-8:return mt;case-9:return st;case-10:return at;case-11:return ct;case-12:return lt;case-13:return ot;case-14:return it;case-15:return tt;case-16:return Le;case-17:return Ie;case-24:return ht;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return u[a]}function h(a){switch(a[0]){case-19:{let p=c(a[1]);return _t(p)}case-18:{let p=c(a[1]);return yt(p)}case-20:{let p={};for(let[g,m]of a[1]){let v=`_${g}_`;p[v]=c(m)}let f=gt(p),y=f.tryAsTuple();return Array.isArray(y)?ft(...y):f}case-21:{let p={};for(let[f,y]of a[1]){let g=`_${f}_`;p[g]=c(y)}return xt(p)}case-22:{let[p,f,y]=a[1];return wt(p.map(g=>c(g)),f.map(g=>c(g)),y)}case-23:{let p={},f=a[1];for(let[y,g]of f){let m=c(g);if(m instanceof B&&(m=m.getType()),!(m instanceof le))throw new Error("Illegal service definition: services can only contain functions");p[y]=m}return Nt(p)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,p)=>{if(a[0]===-22){let f=h(a);u[p].fill(f)}}),s.forEach((a,p)=>{if(a[0]!==-22){let f=h(a);u[p].fill(f)}});let _=l.map(a=>c(a)),V=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 V}var Ie=new me,Le=new X,ur=new he,De=new fe,et=new _e,tt=new ye,rt=new ge,nt=new xe,ot=new ce(32),it=new ce(64),st=new j(8),at=new j(16),ct=new j(32),lt=new j(64),ut=new k(8),pt=new k(16),dt=new k(32),mt=new k(64),ht=new Te;function ft(...e){return new I(e)}function _t(e){return new Z(e)}function yt(e){return new W(e)}function gt(e){return new Y(e)}function xt(e){return new L(e)}function Tt(){return new B}function wt(e,t,r=[]){return new le(e,t,r)}function Nt(e){return new we(e)}import{Principal as un}from"@dfinity/principal";var bt=e=>C.encode([C.Record({user:C.Principal})],[{user:e}]),Ne=e=>C.encode([C.Record({controllers:C.Vec(C.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var Vn=async e=>Ke(e),Pn=async({missionControl:e,wasm_module:t})=>{let r=await We({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=bt(r);await J({actor:o,code:{canister_id:dr.fromText(n),arg:new Uint8Array(i),wasm_module:t}})},Cn=async({controllerId:e,profile:t,...r})=>Ge({...r,...Re({controllerId:e,profile:t})}),Fn=async({controllerId:e,profile:t,...r})=>Je({...r,...Re({controllerId:e,profile:t})});import{Principal as mr}from"@dfinity/principal";var vt=async({orbiter:e})=>(await ve(e)).version(),Rt=async({orbiter:e})=>(await ve(e)).list_controllers();var Un=async e=>vt(e),Mn=async({orbiter:e,wasm_module:t})=>{let{orbiterId:r,...n}=e;if(!r)throw new Error("No orbiter principal defined.");let o=await Rt({orbiter:e}),i=Ne(o);await J({actor:n,code:{canister_id:mr.fromText(r),arg:new Uint8Array(i),wasm_module:t}})};import{major as Vt,minor as Pt,patch as Ct}from"semver";var zn=({currentVersion:e,selectedVersion:t})=>{let r=Vt(e),n=Vt(t),o=Pt(e),i=Pt(t),s=Ct(e),l=Ct(t);return r<n-1||o<i-1||s<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as Xt}from"@dfinity/principal";import{fromNullable as yr}from"@junobuild/utils";var Ft=async({config:e,satellite:t})=>(await G(t)).set_config(e),St=async({satellite:e,type:t})=>(await G(e)).list_rules(t),Ot=async({type:e,collection:t,rule:r,satellite:n})=>(await G(n)).set_rule(e,t,r),At=async({satellite:e})=>(await G(e)).version(),Et=async({satellite:e})=>(await qe(e)).list_controllers(),kt=async({satellite:e})=>(await je(e)).list_controllers(),$t=async({satellite:e})=>(await G(e)).list_controllers(),Bt=async({satellite:e})=>(await G(e)).list_custom_domains();var Ut=[{source:"**",destination:"/index.html"}];import{fromNullable as hr,isNullish as fr,nonNullish as Jt,toNullable as _r}from"@junobuild/utils";var Mt={Db:null},qt={Storage:null},jt={Public:null},zt={Private:null},Ht={Managed:null},Kt={Controllers:null};var Se=e=>e==="storage"?qt:Mt,Yt=({read:e,write:t,max_size:r,updated_at:n})=>({read:Gt(e),write:Gt(t),updated_at:fr(n)?[]:[n],max_size:_r(Jt(r)&&r>0?BigInt(r):void 0)}),Qt=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:s}=t,l=s?.[0]??0n>0n?Number(hr(s)):void 0;return{collection:e,read:Wt(r),write:Wt(n),updated_at:o,created_at:i,...Jt(l)&&{max_size:l}}},Wt=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",Gt=e=>{switch(e){case"public":return jt;case"private":return zt;case"managed":return Ht;default:return Kt}};var oo=async({config:{storage:{headers:e,rewrites:t}},satellite:r})=>{let n=(e??[]).map(({source:i,headers:s})=>[i,s]),o=(t??Ut).map(({source:i,destination:s})=>[i,s]);return Ft({satellite:r,config:{storage:{headers:n,rewrites:o}}})},io=async({type:e,satellite:t})=>(await St({satellite:t,type:Se(e)})).map(n=>Qt(n)),so=async({rule:{collection:e,...t},type:r,satellite:n})=>Ot({type:Se(r),rule:Yt(t),satellite:n,collection:e}),ao=async e=>At(e),co=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n})=>{let{satelliteId:o,...i}=e;if(!o)throw new Error("No satellite principal defined.");if(r){let c=await Et({satellite:e}),h=C.encode([C.Record({controllers:C.Vec(C.Principal)})],[{controllers:c}]);await J({actor:i,code:{canister_id:Xt.fromText(o),arg:new Uint8Array(h),wasm_module:t}});return}let l=await(n?kt:$t)({satellite:e}),u=Ne(l);await J({actor:i,code:{canister_id:Xt.fromText(o),arg:new Uint8Array(u),wasm_module:t}})},lo=async({satellite:e})=>(await Bt({satellite:e})).map(([r,n])=>({domain:r,bn_id:yr(n.bn_id),created_at:n.created_at,updated_at:n.updated_at}));export{zn as checkUpgradeVersion,lo as listCustomDomains,io as listRules,Vn as missionControlVersion,Un as orbiterVersion,ao as satelliteVersion,oo as setConfig,Fn as setMissionControlController,so as setRule,Cn as setSatellitesController,Pn as upgradeMissionControl,Mn as upgradeOrbiter,co as upgradeSatellite};
13
+ `)}return u.encodeValue(c)}));return d(n,o,i,s,l)}function lr(e,t){let r=new M(t);if(t.byteLength<pe.length)throw new Error("Message length smaller than magic number");let n=K(r,pe.length),o=new TextDecoder().decode(n);if(o!==pe)throw new Error("Wrong magic number: "+JSON.stringify(o));function i(a){let p=[],f=Number(b(a));for(let m=0;m<f;m++){let v=Number(q(a));switch(v){case-18:case-19:{let N=Number(q(a));p.push([v,N]);break}case-20:case-21:{let N=[],R=Number(b(a)),P;for(;R--;){let F=Number(b(a));if(F>=Math.pow(2,32))throw new Error("field id out of 32-bit range");if(typeof P=="number"&&P>=F)throw new Error("field id collision or not sorted");P=F;let S=Number(q(a));N.push([F,S])}p.push([v,N]);break}case-22:{let N=[],R=Number(b(a));for(;R--;)N.push(Number(q(a)));let P=[],F=Number(b(a));for(;F--;)P.push(Number(q(a)));let S=[],U=Number(b(a));for(;U--;)switch(Number(b(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([v,[N,P,S]]);break}case-23:{let N=Number(b(a)),R=[];for(;N--;){let P=Number(b(a)),F=new TextDecoder().decode(K(a,P)),S=q(a);R.push([F,S])}p.push([v,R]);break}default:throw new Error("Illegal op_code: "+v)}}let g=[],y=Number(b(a));for(let m=0;m<y;m++)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=>Tt());function c(a){if(a<-24)throw new Error("future value not supported");if(a<0)switch(a){case-1:return et;case-2:return De;case-3:return nt;case-4:return rt;case-5:return ut;case-6:return pt;case-7:return dt;case-8:return mt;case-9:return st;case-10:return at;case-11:return ct;case-12:return lt;case-13:return ot;case-14:return it;case-15:return tt;case-16:return Le;case-17:return Ie;case-24:return ht;default:throw new Error("Illegal op_code: "+a)}if(a>=s.length)throw new Error("type index out of range");return u[a]}function h(a){switch(a[0]){case-19:{let p=c(a[1]);return _t(p)}case-18:{let p=c(a[1]);return yt(p)}case-20:{let p={};for(let[y,m]of a[1]){let v=`_${y}_`;p[v]=c(m)}let f=gt(p),g=f.tryAsTuple();return Array.isArray(g)?ft(...g):f}case-21:{let p={};for(let[f,g]of a[1]){let y=`_${f}_`;p[y]=c(g)}return xt(p)}case-22:{let[p,f,g]=a[1];return wt(p.map(y=>c(y)),f.map(y=>c(y)),g)}case-23:{let p={},f=a[1];for(let[g,y]of f){let m=c(y);if(m instanceof B&&(m=m.getType()),!(m instanceof le))throw new Error("Illegal service definition: services can only contain functions");p[g]=m}return Nt(p)}default:throw new Error("Illegal op_code: "+a[0])}}s.forEach((a,p)=>{if(a[0]===-22){let f=h(a);u[p].fill(f)}}),s.forEach((a,p)=>{if(a[0]!==-22){let f=h(a);u[p].fill(f)}});let _=l.map(a=>c(a)),V=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 V}var Ie=new me,Le=new X,ur=new he,De=new fe,et=new _e,tt=new ye,rt=new ge,nt=new xe,ot=new ce(32),it=new ce(64),st=new j(8),at=new j(16),ct=new j(32),lt=new j(64),ut=new k(8),pt=new k(16),dt=new k(32),mt=new k(64),ht=new Te;function ft(...e){return new I(e)}function _t(e){return new Z(e)}function yt(e){return new W(e)}function gt(e){return new Y(e)}function xt(e){return new L(e)}function Tt(){return new B}function wt(e,t,r=[]){return new le(e,t,r)}function Nt(e){return new we(e)}import{Principal as un}from"@dfinity/principal";var bt=e=>C.encode([C.Record({user:C.Principal})],[{user:e}]),Ne=e=>C.encode([C.Record({controllers:C.Vec(C.Principal)})],[{controllers:e.map(([t,r])=>t)}]);var Vn=async e=>Ke(e),Pn=async({missionControl:e,wasm_module:t})=>{let r=await We({missionControl:e}),{missionControlId:n,...o}=e;if(!n)throw new Error("No mission control principal defined.");let i=bt(r);await J({actor:o,code:{canister_id:dr.fromText(n),arg:new Uint8Array(i),wasm_module:t}})},Cn=async({controllerId:e,profile:t,...r})=>Ge({...r,...Re({controllerId:e,profile:t})}),Fn=async({controllerId:e,profile:t,...r})=>Je({...r,...Re({controllerId:e,profile:t})});import{Principal as mr}from"@dfinity/principal";var vt=async({orbiter:e})=>(await ve(e)).version(),Rt=async({orbiter:e})=>(await ve(e)).list_controllers();var Un=async e=>vt(e),Mn=async({orbiter:e,wasm_module:t})=>{let{orbiterId:r,...n}=e;if(!r)throw new Error("No orbiter principal defined.");let o=await Rt({orbiter:e}),i=Ne(o);await J({actor:n,code:{canister_id:mr.fromText(r),arg:new Uint8Array(i),wasm_module:t}})};import{major as Vt,minor as Pt,patch as Ct}from"semver";var zn=({currentVersion:e,selectedVersion:t})=>{let r=Vt(e),n=Vt(t),o=Pt(e),i=Pt(t),s=Ct(e),l=Ct(t);return r<n-1||o<i-1||s<l-1?{canUpgrade:!1}:{canUpgrade:!0}};import{Principal as Xt}from"@dfinity/principal";import{fromNullable as yr}from"@junobuild/utils";var Ft=async({config:e,satellite:t})=>(await G(t)).set_config(e),St=async({satellite:e,type:t})=>(await G(e)).list_rules(t),Ot=async({type:e,collection:t,rule:r,satellite:n})=>(await G(n)).set_rule(e,t,r),At=async({satellite:e})=>(await G(e)).version(),Et=async({satellite:e})=>(await qe(e)).list_controllers(),kt=async({satellite:e})=>(await je(e)).list_controllers(),$t=async({satellite:e})=>(await G(e)).list_controllers(),Bt=async({satellite:e})=>(await G(e)).list_custom_domains();var Ut=[{source:"**",destination:"/index.html"}];import{fromNullable as hr,isNullish as fr,nonNullish as Jt,toNullable as _r}from"@junobuild/utils";var Mt={Db:null},qt={Storage:null},jt={Public:null},zt={Private:null},Ht={Managed:null},Kt={Controllers:null};var Se=e=>e==="storage"?qt:Mt,Yt=({read:e,write:t,max_size:r,updated_at:n})=>({read:Gt(e),write:Gt(t),updated_at:fr(n)?[]:[n],max_size:_r(Jt(r)&&r>0?BigInt(r):void 0)}),Qt=([e,t])=>{let{read:r,write:n,updated_at:o,created_at:i,max_size:s}=t,l=s?.[0]??0n>0n?Number(hr(s)):void 0;return{collection:e,read:Wt(r),write:Wt(n),updated_at:o,created_at:i,...Jt(l)&&{max_size:l}}},Wt=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",Gt=e=>{switch(e){case"public":return jt;case"private":return zt;case"managed":return Ht;default:return Kt}};var oo=async({config:{storage:{headers:e,rewrites:t}},satellite:r})=>{let n=(e??[]).map(({source:i,headers:s})=>[i,s]),o=(t??Ut).map(({source:i,destination:s})=>[i,s]);return Ft({satellite:r,config:{storage:{headers:n,rewrites:o}}})},io=async({type:e,satellite:t})=>(await St({satellite:t,type:Se(e)})).map(n=>Qt(n)),so=async({rule:{collection:e,...t},type:r,satellite:n})=>Ot({type:Se(r),rule:Yt(t),satellite:n,collection:e}),ao=async e=>At(e),co=async({satellite:e,wasm_module:t,deprecated:r,deprecatedNoScope:n})=>{let{satelliteId:o,...i}=e;if(!o)throw new Error("No satellite principal defined.");if(r){let c=await Et({satellite:e}),h=C.encode([C.Record({controllers:C.Vec(C.Principal)})],[{controllers:c}]);await J({actor:i,code:{canister_id:Xt.fromText(o),arg:new Uint8Array(h),wasm_module:t}});return}let l=await(n?kt:$t)({satellite:e}),u=Ne(l);await J({actor:i,code:{canister_id:Xt.fromText(o),arg:new Uint8Array(u),wasm_module:t}})},lo=async({satellite:e})=>(await Bt({satellite:e})).map(([r,n])=>({domain:r,bn_id:yr(n.bn_id),created_at:n.created_at,updated_at:n.updated_at}));export{zn as checkUpgradeVersion,lo as listCustomDomains,io as listRules,Vn as missionControlVersion,Un as orbiterVersion,ao as satelliteVersion,oo as setConfig,Fn as setMissionControlController,so as setRule,Cn as setSatellitesController,Pn as upgradeMissionControl,Mn as upgradeOrbiter,co as upgradeSatellite};
14
14
  //# sourceMappingURL=index.js.map