@junobuild/cli 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -704,7 +704,7 @@ Done. The ${Ko(t)} ${(0,vc.green)(r)} has been configured for your terminal. \u2
|
|
|
704
704
|
${(0,Zn.yellow)("--source-path")} Optional path to the TypeScript or JavaScript entry file.`,nH=`${Knr}
|
|
705
705
|
${Hnr}`,Ci=`${nH}
|
|
706
706
|
${(0,Zn.yellow)("--container-url")} Override a custom container URL. If not provided, defaults to production or the local container in development mode.
|
|
707
|
-
${(0,Zn.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,BF=`The option ${(0,Zn.yellow)("--keep-staged")} only applies when ${(0,Zn.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var ar=e=>Qt({args:e,options:["-d","--doc"]})?"doc":"cli";var Ii=ne(et(),1);var CT="0.7.
|
|
707
|
+
${(0,Zn.yellow)("--console-url")} Specify a custom URL to access the developer Console.`,BF=`The option ${(0,Zn.yellow)("--keep-staged")} only applies when ${(0,Zn.yellow)("--no-apply")} is NOT used (i.e. the change is applied immediately).`;var ar=e=>Qt({args:e,options:["-d","--doc"]})?"doc":"cli";var Ii=ne(et(),1);var CT="0.7.1";var Ynr=` __ __ __ __ _ ____
|
|
708
708
|
__) || | || \\| |/ \\
|
|
709
709
|
\\___/ \\___/ |_|\\__|\\____/`,nr=`${Ynr} CLI ${(0,Ii.grey)(`v${CT}`)}`,JDe=`Juno CLI ${(0,Ii.grey)(`v${CT}`)}`,IT=`
|
|
710
710
|
${nr}
|
|
@@ -796,7 +796,7 @@ ${nCe}
|
|
|
796
796
|
${DT}
|
|
797
797
|
|
|
798
798
|
${nCe}
|
|
799
|
-
`,iCe=e=>{console.log(ar(e)==="doc"?oir:air)};var sCe=ne(Xe(),1);var sH=ne(Xe(),1);var MF=e=>{let t=qt({args:e,option:"-i"})??qt({args:e,option:"--id"});(0,sH.assertNonNullish)(t,"An id must be provided");let n=(()=>{try{return BigInt(t)}catch{console.error("The id must be a valid number."),process.exit(1)}})(),i=qt({args:e,option:"--hash"});return(0,sH.assertNonNullish)(i,"A hash must be provided"),{proposalId:n,hash:i}};var oCe=async e=>{let{satellite:t}=await on(),{proposalId:r,hash:n}=MF(e),i=Qt({args:e,options:["-k","--keep-staged"]}),s=Qt({args:e,options:["--snapshot"]});await cir({satellite:t,proposalId:r,hash:n,clearProposalAssets:!i,takeSnapshot:s})},cir=async({satellite:e,proposalId:t,hash:r,...n})=>{let i=Gn().start(),s=({step:o})=>{switch(o){case Ng.TakingSnapshot:i.text="Creating a snapshot...";break;case Ng.CommittingProposal:i.text="Applying update...";break;case Ng.ClearingProposalAssets:i.text="Clearing staged assets...";break;case Ng.PostApply:i.text="Reloading...";break}};try{await Gee({cdn:{satellite:e},proposal:{proposal_id:t,sha256:(0,sCe.hexStringToUint8Array)(r)},onProgress:s,...n}),i.stop(),console.log(`\u{1F3AF} Change ID ${t} applied.`)}catch(o){throw i.stop(),o}};var _c=ne(Xe(),1);var LF=(e=new Date)=>new Intl.DateTimeFormat("en",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(e),aCe=(e=new Date)=>new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e);var cCe=async e=>{let{satellite:t}=await on(),r=Qt({args:e,options:["-a","--all"]}),n=Qt({args:e,options:["-e","--every"]}),s=(await uCe({satellite:t,traverseAll:r})).filter(([o,{status:a}])=>"Open"in a||n).reduce((o,[{proposal_id:a},{sha256:c,created_at:u}])=>{let l=(0,_c.fromNullable)(c);return{...o,[`ID ${a}`]:{hash:(0,_c.nonNullish)(l)?(0,_c.uint8ArrayToHexString)(l):"",created_at:aCe(new Date(Number(u/1000000n)))}}},{});if(Object.keys(s).length===0){console.log("There are no open changes right now.");return}console.table(s)},uCe=async({startAfter:e,satellite:t,traverseAll:r})=>{let{items:n,items_length:i,matches_length:s}=await Kee({cdn:{satellite:t},filter:{order:(0,_c.toNullable)({desc:!0}),paginate:(0,_c.nonNullish)(e)?(0,_c.toNullable)({start_after:(0,_c.toNullable)(e),limit:(0,_c.toNullable)()}):(0,_c.toNullable)()}}),o=a=>{let{length:c,[c-1]:u}=a;return u};if(i>s&&r){let a=await uCe({startAfter:o(n)?.[0].proposal_id,satellite:t,traverseAll:r});return[...n,...a]}return n};var lCe=ne(Xe(),1);var pCe=async e=>{let{satellite:t}=await on(),{proposalId:r,hash:n}=MF(e),i=Qt({args:e,options:["-k","--keep-staged"]});await uir({satellite:t,proposalId:r,hash:n,clearProposalAssets:!i})},uir=async({satellite:e,proposalId:t,hash:r,...n})=>{let i=Gn().start(),s=({step:o})=>{switch(o){case xx.RejectingProposal:i.text="Rejecting...";break;case xx.ClearingProposalAssets:i.text="Clearing staged assets...";break;case xx.PostReject:i.text="Reloading...";break}};try{await Jee({cdn:{satellite:e},proposal:{proposal_id:t,sha256:(0,lCe.hexStringToUint8Array)(r)},onProgress:s,...n}),i.stop(),console.log(`\u{1F6AB} Change ID ${t} rejected.`)}catch(o){throw i.stop(),o}};var fCe=async e=>{let[t]=e??[];switch(t){case"list":await cCe(e);break;case"apply":await oCe(e);break;case"reject":await pCe(e);break;default:console.log((0,dCe.red)("Unknown subcommand.")),iH()}},hCe=e=>{let[t]=e??[];switch(t){case"list":rCe(e);break;case"apply":QDe(e);break;case"reject":iCe(e);break;default:iH(e)}};var jIe=ne(Xe(),1);var $Ie=ne(et(),1);var If=ne(Uu(),1),P0=ne(Xe(),1);var SCe=ne(qs(),1),PCe=ne(Xe(),1),ACe=ne(Xe(),1),OCe=ne(qs(),1),Bir=ne(Kn(),1),DCe=ne(Xe(),1),CCe=ne(Kn(),1),n_=ne(Xe(),1),ICe=ne(qs(),1),yl=ne(Ig(),1),uH=ne(Kn(),1),S0=ne(Xe(),1),gm=ne(Kf(),1),zF=ne(Xe(),1);var kCe=ne(Xe(),1);var RCe=ne(Kn(),1),ZF=ne(Xe(),1);var jCe=ne(Xe(),1),D0=ne(Xe(),1),BCe=ne(Kn(),1),Wn=ne(Xe(),1),ks=ne(Xe(),1),kT=ne(Xe(),1),Qn=ne(Xe(),1),FT=ne(Kf(),1),lH=ne(Kn(),1),tIe=ne(Xe(),1),Op=ne(Xe(),1);var RT=class extends Error{constructor(){super("The Wasm code for the upgrade is identical to the code currently installed. No upgrade is necessary.")}},gCe=class extends Error{constructor(){super(`Invalid dependency tree: required module ${Yc} is missing.`)}},lir=class extends Error{constructor(){super(`Invalid package: the provided module name is not ${iD}.`)}},pir=class extends Error{constructor(){super(`Invalid package: the provided module name is not ${sD}.`)}},bCe=e=>crypto.subtle.digest("SHA-256",e),vCe=e=>Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join(""),dir=async e=>{let t=await bCe(await e.arrayBuffer());return vCe(t)},_Ce=async e=>{let t=await bCe(e);return vCe(t)},jT=({dependencyId:e,dependencies:t})=>Object.entries(t??{}).find(([r,n])=>r===e),xCe=({currentVersion:e,selectedVersion:t})=>{let r=(0,If.major)(e),n=(0,If.major)(t),i=(0,If.minor)(e),s=(0,If.minor)(t),o=(0,If.patch)(e),a=(0,If.patch)(t);return r<n-1||i<s-1||o<a-1?{canUpgrade:!1}:{canUpgrade:!0}},ECe=async({junoPackage:e,wasm:t})=>{if((0,P0.isNullish)(e))return await fir({wasm:t});let{name:r,dependencies:n}=e;if(r===Yc)return"stock";let i=jT({dependencies:n,dependencyId:Yc});return(0,P0.nonNullish)(i)?"extended":void 0},fir=async({wasm:e})=>{let t=await TCe({wasm:e,sectionName:"icp:public juno:build"});return(0,P0.nonNullish)(t)&&["stock","extended"].includes(t)?t:void 0},wCe=async({wasm:e})=>{let t=await TCe({wasm:e,sectionName:"icp:public juno:package"});if((0,P0.isNullish)(t))return;let r=JSON.parse(t),{success:n,data:i}=nD.safeParse(r);return n?i:void 0},TCe=async({sectionName:e,wasm:t})=>{let r=await WebAssembly.compile(t),n=WebAssembly.Module.customSections(r,e),[i]=n;return(0,P0.nonNullish)(i)?new TextDecoder().decode(i):void 0},e3r=$o(["stock","extended"]),ym=fn().refine(e=>/^\d+\.\d+\.\d+$/.test(e),{message:"Version does not match x.y.z format"}),hir=Jn({tag:ym,console:ym,observatory:ym.optional(),mission_control:ym,satellite:ym,orbiter:ym.optional(),sputnik:ym.optional()}),mir=gs(hir).min(1).refine(e=>new Set(e.map(({tag:t})=>t)).size===e.length,{message:"A release tag appears multiple times but must be unique"}),oH=gs(ym).min(1),t3r=Jn({mission_controls:oH,satellites:oH,orbiters:oH,releases:mir}),yir=({IDL:e})=>{let t=e.Record({fund_cycles:e.Nat,min_cycles:e.Nat}),r=e.Variant({BelowThreshold:t}),n=e.Record({strategy:e.Opt(r),enabled:e.Bool}),i=e.Record({cycles:e.Opt(n)}),s=e.Record({monitoring:e.Opt(i)}),o=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,settings:e.Opt(s)}),a=e.Record({subnet_id:e.Opt(e.Principal),name:e.Opt(e.Text)}),c=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal,settings:e.Opt(s)}),u=e.Record({cycles:e.Nat,destination_id:e.Principal}),l=e.Record({to:e.Opt(e.Text),enabled:e.Bool}),p=e.Record({notification:e.Opt(l),default_strategy:e.Opt(r)}),d=e.Record({cycles:e.Opt(p)}),f=e.Record({monitoring:e.Opt(d)}),h=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),segment_id:e.Principal}),m=e.Record({segment_id:e.Principal,created_at:e.Nat64,nonce:e.Int32}),y=e.Record({timestamp:e.Nat64,amount:e.Nat}),g=e.Variant({BalanceCheckFailed:e.Null,ObtainCyclesFailed:e.Null,DepositFailed:e.Null,InsufficientCycles:e.Null,Other:e.Text}),v=e.Record({timestamp:e.Nat64,error_code:g}),b=e.Record({deposited_cycles:e.Opt(y),cycles:y,funding_failure:e.Opt(v)}),x=e.Record({cycles:e.Opt(b)}),E=e.Record({monitored_ids:e.Vec(e.Principal),running:e.Bool}),P=e.Record({cycles:e.Opt(E)}),I=e.Record({updated_at:e.Nat64,created_at:e.Nat64,monitoring:e.Opt(i)}),L=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),user:e.Opt(e.Principal),created_at:e.Nat64,config:e.Opt(f)}),W=e.Record({e8s:e.Nat64}),he=e.Record({timestamp_nanos:e.Nat64}),ae=e.Record({to:e.Vec(e.Nat8),fee:W,memo:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(he),amount:W}),Ee=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:W}),TxDuplicate:e.Record({duplicate_of:e.Nat64}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:W})}),U=e.Variant({Ok:e.Nat64,Err:Ee}),R=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),ee=e.Record({to:R,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),H=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:e.Nat}),Duplicate:e.Record({duplicate_of:e.Nat}),BadFee:e.Record({expected_fee:e.Nat}),CreatedInFuture:e.Record({ledger_time:e.Nat64}),TooOld:e.Null,InsufficientFunds:e.Record({balance:e.Nat})}),D=e.Variant({Ok:e.Nat,Err:H}),j=e.Variant({Write:e.Null,Admin:e.Null,Submit:e.Null}),k=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:j,expires_at:e.Opt(e.Nat64)}),ie=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:j,expires_at:e.Opt(e.Nat64)}),ge=e.Record({ids:e.Vec(e.Principal),strategy:r}),Pe=e.Record({orbiters_strategy:e.Opt(ge),mission_control_strategy:e.Opt(r),satellites_strategy:e.Opt(ge)}),V=e.Record({cycles_config:e.Opt(Pe)}),C=e.Record({satellite_ids:e.Opt(e.Vec(e.Principal)),try_mission_control:e.Opt(e.Bool),orbiter_ids:e.Opt(e.Vec(e.Principal))}),_e=e.Record({cycles_config:e.Opt(C)});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)],[o],[]),create_orbiter_with_config:e.Func([a],[o],[]),create_satellite:e.Func([e.Text],[c],[]),create_satellite_with_config:e.Func([a],[c],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([u],[],[]),get_config:e.Func([],[e.Opt(f)],["query"]),get_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,e.Text))],["query"]),get_monitoring_history:e.Func([h],[e.Vec(e.Tuple(m,x))],["query"]),get_monitoring_status:e.Func([],[P],["query"]),get_settings:e.Func([],[e.Opt(I)],["query"]),get_user:e.Func([],[e.Principal],["query"]),get_user_data:e.Func([],[L],["query"]),icp_transfer:e.Func([ae],[U],[]),icrc_transfer:e.Func([e.Principal,ee],[D],[]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,k))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,c))],["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_config:e.Func([e.Opt(f)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),ie],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[o],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[o],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),ie],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[c],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[c],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),ie],[],[]),start_monitoring:e.Func([],[],[]),stop_monitoring:e.Func([],[],[]),top_up:e.Func([e.Principal,W],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),update_and_start_monitoring:e.Func([V],[],[]),update_and_stop_monitoring:e.Func([_e],[],[])})},gir=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null,Submit: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)}),i=e.Record({version:e.Opt(e.Nat64)}),s=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),a=e.Record({key:e.Text,collected_at:e.Nat64}),c=e.Record({os:e.Text,device:e.Opt(e.Text),browser:e.Text}),u=e.Record({utm_content:e.Opt(e.Text),utm_medium:e.Opt(e.Text),utm_source:e.Text,utm_term:e.Opt(e.Text),utm_campaign:e.Opt(e.Text)}),l=e.Record({inner_height:e.Nat16,screen_height:e.Opt(e.Nat16),screen_width:e.Opt(e.Nat16),inner_width:e.Nat16}),p=e.Record({client:e.Opt(c),title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,campaign:e.Opt(u),href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:l,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),d=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),f=e.Record({ios:e.Float64,macos:e.Float64,others:e.Float64,linux:e.Float64,android:e.Float64,windows:e.Float64}),h=e.Record({desktop:e.Float64,laptop:e.Opt(e.Float64),others:e.Float64,tablet:e.Opt(e.Float64),mobile:e.Float64}),m=e.Record({browsers:d,operating_systems:e.Opt(f),devices:h}),y=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),g=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(y,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),v=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32)),utm_campaigns:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32))),utm_sources:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32))),time_zones:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32)))}),b=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),x=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(b),delta:e.Float64}),E=e.Variant({WebVitalsMetric:x}),P=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),I=e.Record({updated_at:e.Nat64,session_id:e.Text,data:E,href:e.Text,metric_name:P,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),L=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),W=e.Record({overall:L,pages:e.Vec(e.Tuple(e.Text,L))}),he=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),ae=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),Ee=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),U=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),upgrade:e.Opt(e.Bool),status_code:e.Nat16}),R=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),ee=e.Record({updated_at:e.Nat64,features:e.Opt(R),restricted_origin:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),H=e.Record({stable:e.Nat64,heap:e.Nat64}),D=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),j=e.Record({controller:D,controllers:e.Vec(e.Principal)}),k=e.Record({client:e.Opt(c),title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,campaign:e.Opt(u),href:e.Text,satellite_id:e.Principal,device:l,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ie=e.Variant({Ok:p,Err:e.Text}),ge=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(a,e.Text))}),Pe=e.Record({session_id:e.Text,data:E,href:e.Text,metric_name:P,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),V=e.Variant({Ok:I,Err:e.Text}),C=e.Record({features:e.Opt(R),restricted_origin:e.Opt(e.Text),version:e.Opt(e.Nat64)}),_e=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),Se=e.Variant({Ok:he,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,i],[],[]),deposit_cycles:e.Func([s],[],[]),get_page_views:e.Func([o],[e.Vec(e.Tuple(a,p))],["query"]),get_page_views_analytics_clients:e.Func([o],[m],["query"]),get_page_views_analytics_metrics:e.Func([o],[g],["query"]),get_page_views_analytics_top_10:e.Func([o],[v],["query"]),get_performance_metrics:e.Func([o],[e.Vec(e.Tuple(a,I))],["query"]),get_performance_metrics_analytics_web_vitals:e.Func([o],[W],["query"]),get_track_events:e.Func([o],[e.Vec(e.Tuple(a,he))],["query"]),get_track_events_analytics:e.Func([o],[ae],["query"]),http_request:e.Func([Ee],[U],["query"]),http_request_update:e.Func([Ee],[U],[]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,ee))],["query"]),memory_size:e.Func([],[H],["query"]),set_controllers:e.Func([j],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([a,k],[ie],[]),set_page_views:e.Func([e.Vec(e.Tuple(a,k))],[ge],[]),set_performance_metric:e.Func([a,Pe],[V],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(a,Pe))],[ge],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,C))],[e.Vec(e.Tuple(e.Principal,ee))],[]),set_track_event:e.Func([a,_e],[Se],[]),set_track_events:e.Func([e.Vec(e.Tuple(a,_e))],[ge],[])})},bir=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null,Submit: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)}),i=e.Record({version:e.Opt(e.Nat64)}),s=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),a=e.Record({key:e.Text,collected_at:e.Nat64}),c=e.Record({os:e.Text,device:e.Opt(e.Text),browser:e.Text}),u=e.Record({utm_content:e.Opt(e.Text),utm_medium:e.Opt(e.Text),utm_source:e.Text,utm_term:e.Opt(e.Text),utm_campaign:e.Opt(e.Text)}),l=e.Record({inner_height:e.Nat16,screen_height:e.Opt(e.Nat16),screen_width:e.Opt(e.Nat16),inner_width:e.Nat16}),p=e.Record({client:e.Opt(c),title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,campaign:e.Opt(u),href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:l,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),d=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),f=e.Record({ios:e.Float64,macos:e.Float64,others:e.Float64,linux:e.Float64,android:e.Float64,windows:e.Float64}),h=e.Record({desktop:e.Float64,laptop:e.Opt(e.Float64),others:e.Float64,tablet:e.Opt(e.Float64),mobile:e.Float64}),m=e.Record({browsers:d,operating_systems:e.Opt(f),devices:h}),y=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),g=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(y,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),v=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32)),utm_campaigns:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32))),utm_sources:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32))),time_zones:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32)))}),b=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),x=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(b),delta:e.Float64}),E=e.Variant({WebVitalsMetric:x}),P=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),I=e.Record({updated_at:e.Nat64,session_id:e.Text,data:E,href:e.Text,metric_name:P,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),L=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),W=e.Record({overall:L,pages:e.Vec(e.Tuple(e.Text,L))}),he=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),ae=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),Ee=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),U=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),upgrade:e.Opt(e.Bool),status_code:e.Nat16}),R=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),ee=e.Record({updated_at:e.Nat64,features:e.Opt(R),restricted_origin:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),H=e.Record({stable:e.Nat64,heap:e.Nat64}),D=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),j=e.Record({controller:D,controllers:e.Vec(e.Principal)}),k=e.Record({client:e.Opt(c),title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,campaign:e.Opt(u),href:e.Text,satellite_id:e.Principal,device:l,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ie=e.Variant({Ok:p,Err:e.Text}),ge=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(a,e.Text))}),Pe=e.Record({session_id:e.Text,data:E,href:e.Text,metric_name:P,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),V=e.Variant({Ok:I,Err:e.Text}),C=e.Record({features:e.Opt(R),restricted_origin:e.Opt(e.Text),version:e.Opt(e.Nat64)}),_e=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),Se=e.Variant({Ok:he,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,i],[],[]),deposit_cycles:e.Func([s],[],[]),get_page_views:e.Func([o],[e.Vec(e.Tuple(a,p))],[]),get_page_views_analytics_clients:e.Func([o],[m],[]),get_page_views_analytics_metrics:e.Func([o],[g],[]),get_page_views_analytics_top_10:e.Func([o],[v],[]),get_performance_metrics:e.Func([o],[e.Vec(e.Tuple(a,I))],[]),get_performance_metrics_analytics_web_vitals:e.Func([o],[W],[]),get_track_events:e.Func([o],[e.Vec(e.Tuple(a,he))],[]),get_track_events_analytics:e.Func([o],[ae],[]),http_request:e.Func([Ee],[U],[]),http_request_update:e.Func([Ee],[U],[]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],[]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,ee))],[]),memory_size:e.Func([],[H],[]),set_controllers:e.Func([j],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([a,k],[ie],[]),set_page_views:e.Func([e.Vec(e.Tuple(a,k))],[ge],[]),set_performance_metric:e.Func([a,Pe],[V],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(a,Pe))],[ge],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,C))],[e.Vec(e.Tuple(e.Principal,ee))],[]),set_track_event:e.Func([a,_e],[Se],[]),set_track_events:e.Func([e.Vec(e.Tuple(a,_e))],[ge],[])})},vir=({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)}),i=e.Record({updated_at:e.Opt(e.Nat64)}),s=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),o=e.Record({storage:s}),a=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),c=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),u=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}),l=e.Variant({Callback:e.Record({token:u,callback:e.Func([],[],[])})}),p=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(l),status_code:e.Nat16}),d=e.Record({token:e.Opt(u),body:e.Vec(e.Nat8)}),f=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),h=e.Record({batch_id:e.Nat}),m=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),y=e.Record({field:m,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),v=e.Record({order:e.Opt(y),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),b=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),x=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),E=e.Record({key:b,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,x)),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,E))}),I=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),L=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,a))}),W=e.Variant({Db:e.Null,Storage:e.Null}),he=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),ae=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:he,created_at:e.Nat64,write:he}),Ee=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),U=e.Record({controller:Ee,controllers:e.Vec(e.Principal)}),R=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),ee=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:he,write:he}),H=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),D=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),get_config:e.Func([],[o],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(a)],["query"]),http_request:e.Func([c],[p],["query"]),http_request_streaming_callback:e.Func([u],[d],["query"]),init_asset_upload:e.Func([f],[h],[]),list_assets:e.Func([e.Opt(e.Text),v],[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,I))],["query"]),list_docs:e.Func([e.Text,v],[L],["query"]),list_rules:e.Func([W],[e.Vec(e.Tuple(e.Text,ae))],["query"]),set_config:e.Func([o],[],[]),set_controllers:e.Func([U],[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,R],[a],[]),set_rule:e.Func([W,e.Text,ee],[],[]),upload_asset_chunk:e.Func([H],[D],[]),version:e.Func([],[e.Text],["query"])})},_ir=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),n=e.Record({field:r,desc:e.Bool}),i=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),s=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(i),description:e.Opt(e.Text),created_at:e.Opt(i)}),o=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),a=e.Record({order:e.Opt(n),owner:e.Opt(e.Principal),matcher:e.Opt(s),paginate:e.Opt(o)}),c=e.Record({controllers:e.Vec(e.Principal)}),u=e.Variant({Write:e.Null,Admin:e.Null}),l=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:u,expires_at:e.Opt(e.Nat64)}),p=e.Record({version:e.Opt(e.Nat64)}),d=e.Variant({Db:e.Null,Storage:e.Null}),f=e.Record({version:e.Opt(e.Nat64)}),h=e.Record({cycles:e.Nat,destination_id:e.Principal}),m=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),y=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),g=e.Record({key:m,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,y)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),v=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),b=e.Record({internet_identity:e.Opt(v)}),x=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),E=e.Record({max_memory_size:e.Opt(x)}),P=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),I=e.Variant({Deny:e.Null,Allow:e.Null}),L=e.Record({status_code:e.Nat16,location:e.Text}),W=e.Record({iframe:e.Opt(P),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),max_memory_size:e.Opt(x),raw_access:e.Opt(I),redirects:e.Opt(e.Vec(e.Tuple(e.Text,L)))}),he=e.Record({db:e.Opt(E),authentication:e.Opt(b),storage:W}),ae=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),Ee=e.Variant({Heap:e.Null,Stable:e.Null}),U=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),R=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),ee=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(Ee),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:U,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(R),write:U,max_changes_per_user:e.Opt(e.Nat32)}),H=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),D=e.Record({memory:Ee,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}),j=e.Variant({Callback:e.Record({token:D,callback:e.Func([],[],["query"])})}),k=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(j),status_code:e.Nat16}),ie=e.Record({token:e.Opt(D),body:e.Vec(e.Nat8)}),ge=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}),Pe=e.Record({batch_id:e.Nat}),V=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,g)),items_length:e.Nat64}),C=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),_e=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,ae)),items_length:e.Nat64}),Se=e.Record({stable:e.Nat64,heap:e.Nat64}),De=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:u,expires_at:e.Opt(e.Nat64)}),Oe=e.Record({controller:De,controllers:e.Vec(e.Principal)}),S=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),N=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(Ee),max_size:e.Opt(e.Nat),read:U,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(R),write:U,max_changes_per_user:e.Opt(e.Nat32)}),$=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),oe=e.Record({chunk_id:e.Nat});return e.Service({build_version:e.Func([],[e.Text],["query"]),commit_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,a],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,a],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([c],[e.Vec(e.Tuple(e.Principal,l))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,p],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,a],[],[]),del_filtered_docs:e.Func([e.Text,a],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,p))],[],[]),del_rule:e.Func([d,e.Text,f],[],[]),deposit_cycles:e.Func([h],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(g)],["query"]),get_auth_config:e.Func([],[e.Opt(b)],["query"]),get_config:e.Func([],[he],[]),get_db_config:e.Func([],[e.Opt(E)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(ae)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(g)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(ae)))],["query"]),get_rule:e.Func([d,e.Text],[e.Opt(ee)],["query"]),get_storage_config:e.Func([],[W],["query"]),http_request:e.Func([H],[k],["query"]),http_request_streaming_callback:e.Func([D],[ie],["query"]),init_asset_upload:e.Func([ge],[Pe],[]),list_assets:e.Func([e.Text,a],[V],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,l))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,C))],["query"]),list_docs:e.Func([e.Text,a],[_e],["query"]),list_rules:e.Func([d],[e.Vec(e.Tuple(e.Text,ee))],["query"]),memory_size:e.Func([],[Se],["query"]),set_auth_config:e.Func([b],[],[]),set_controllers:e.Func([Oe],[e.Vec(e.Tuple(e.Principal,l))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([E],[],[]),set_doc:e.Func([e.Text,e.Text,S],[ae],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,S))],[e.Vec(e.Tuple(e.Text,ae))],[]),set_rule:e.Func([d,e.Text,N],[ee],[]),set_storage_config:e.Func([W],[],[]),upload_asset_chunk:e.Func([$],[oe],[]),version:e.Func([],[e.Text],["query"])})},xir=({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)}),i=e.Record({version:e.Opt(e.Nat64)}),s=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),a=e.Record({key:e.Text,collected_at:e.Nat64}),c=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,session_id:e.Text,href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:c,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),l=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),p=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),d=e.Record({browsers:l,devices:p}),f=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),h=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(f,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),m=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),y=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),g=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(y),delta:e.Float64}),v=e.Variant({WebVitalsMetric:g}),b=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),x=e.Record({updated_at:e.Nat64,session_id:e.Text,data:v,href:e.Text,metric_name:b,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),E=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),P=e.Record({overall:E,pages:e.Vec(e.Tuple(e.Text,E))}),I=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),L=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),W=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),he=e.Record({updated_at:e.Nat64,features:e.Opt(W),created_at:e.Nat64,version:e.Opt(e.Nat64)}),ae=e.Record({stable:e.Nat64,heap:e.Nat64}),Ee=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),U=e.Record({controller:Ee,controllers:e.Vec(e.Principal)}),R=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,satellite_id:e.Principal,device:c,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ee=e.Variant({Ok:u,Err:e.Text}),H=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(a,e.Text))}),D=e.Record({session_id:e.Text,data:v,href:e.Text,metric_name:b,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),j=e.Variant({Ok:x,Err:e.Text}),k=e.Record({features:e.Opt(W),version:e.Opt(e.Nat64)}),ie=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ge=e.Variant({Ok:I,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,i],[],[]),deposit_cycles:e.Func([s],[],[]),get_page_views:e.Func([o],[e.Vec(e.Tuple(a,u))],["query"]),get_page_views_analytics_clients:e.Func([o],[d],["query"]),get_page_views_analytics_metrics:e.Func([o],[h],["query"]),get_page_views_analytics_top_10:e.Func([o],[m],["query"]),get_performance_metrics:e.Func([o],[e.Vec(e.Tuple(a,x))],["query"]),get_performance_metrics_analytics_web_vitals:e.Func([o],[P],["query"]),get_track_events:e.Func([o],[e.Vec(e.Tuple(a,I))],["query"]),get_track_events_analytics:e.Func([o],[L],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,he))],["query"]),memory_size:e.Func([],[ae],["query"]),set_controllers:e.Func([U],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([a,R],[ee],[]),set_page_views:e.Func([e.Vec(e.Tuple(a,R))],[H],[]),set_performance_metric:e.Func([a,D],[j],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(a,D))],[H],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,k))],[e.Vec(e.Tuple(e.Principal,he))],[]),set_track_event:e.Func([a,ie],[ge],[]),set_track_events:e.Func([e.Vec(e.Tuple(a,ie))],[H],[]),version:e.Func([],[e.Text],["query"])})},Eir=({IDL:e})=>{let t=e.Record({fund_cycles:e.Nat,min_cycles:e.Nat}),r=e.Variant({BelowThreshold:t}),n=e.Record({strategy:e.Opt(r),enabled:e.Bool}),i=e.Record({cycles:e.Opt(n)}),s=e.Record({monitoring:e.Opt(i)}),o=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,settings:e.Opt(s)}),a=e.Record({subnet_id:e.Opt(e.Principal),name:e.Opt(e.Text)}),c=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal,settings:e.Opt(s)}),u=e.Record({cycles:e.Nat,destination_id:e.Principal}),l=e.Record({to:e.Opt(e.Text),enabled:e.Bool}),p=e.Record({notification:e.Opt(l),default_strategy:e.Opt(r)}),d=e.Record({cycles:e.Opt(p)}),f=e.Record({monitoring:e.Opt(d)}),h=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),segment_id:e.Principal}),m=e.Record({segment_id:e.Principal,created_at:e.Nat64,nonce:e.Int32}),y=e.Record({timestamp:e.Nat64,amount:e.Nat}),g=e.Record({deposited_cycles:e.Opt(y),cycles:y}),v=e.Record({cycles:e.Opt(g)}),b=e.Record({monitored_ids:e.Vec(e.Principal),running:e.Bool}),x=e.Record({cycles:e.Opt(b)}),E=e.Record({updated_at:e.Nat64,created_at:e.Nat64,monitoring:e.Opt(i)}),P=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),user:e.Opt(e.Principal),created_at:e.Nat64,config:e.Opt(f)}),I=e.Record({e8s:e.Nat64}),L=e.Record({timestamp_nanos:e.Nat64}),W=e.Record({to:e.Vec(e.Nat8),fee:I,memo:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(L),amount:I}),he=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:I}),TxDuplicate:e.Record({duplicate_of:e.Nat64}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:I})}),ae=e.Variant({Ok:e.Nat64,Err:he}),Ee=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),U=e.Record({to:Ee,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),R=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:e.Nat}),Duplicate:e.Record({duplicate_of:e.Nat}),BadFee:e.Record({expected_fee:e.Nat}),CreatedInFuture:e.Record({ledger_time:e.Nat64}),TooOld:e.Null,InsufficientFunds:e.Record({balance:e.Nat})}),ee=e.Variant({Ok:e.Nat,Err:R}),H=e.Variant({Write:e.Null,Admin:e.Null}),D=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:H,expires_at:e.Opt(e.Nat64)}),j=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:H,expires_at:e.Opt(e.Nat64)}),k=e.Record({ids:e.Vec(e.Principal),strategy:r}),ie=e.Record({orbiters_strategy:e.Opt(k),mission_control_strategy:e.Opt(r),satellites_strategy:e.Opt(k)}),ge=e.Record({cycles_config:e.Opt(ie)}),Pe=e.Record({satellite_ids:e.Opt(e.Vec(e.Principal)),try_mission_control:e.Opt(e.Bool),orbiter_ids:e.Opt(e.Vec(e.Principal))}),V=e.Record({cycles_config:e.Opt(Pe)});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)],[o],[]),create_orbiter_with_config:e.Func([a],[o],[]),create_satellite:e.Func([e.Text],[c],[]),create_satellite_with_config:e.Func([a],[c],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([u],[],[]),get_config:e.Func([],[e.Opt(f)],["query"]),get_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,e.Text))],["query"]),get_monitoring_history:e.Func([h],[e.Vec(e.Tuple(m,v))],["query"]),get_monitoring_status:e.Func([],[x],["query"]),get_settings:e.Func([],[e.Opt(E)],["query"]),get_user:e.Func([],[e.Principal],["query"]),get_user_data:e.Func([],[P],["query"]),icp_transfer:e.Func([W],[ae],[]),icrc_transfer:e.Func([e.Principal,U],[ee],[]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,D))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,c))],["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_config:e.Func([e.Opt(f)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),j],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[o],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[o],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),j],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[c],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[c],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),j],[],[]),start_monitoring:e.Func([],[],[]),stop_monitoring:e.Func([],[],[]),top_up:e.Func([e.Principal,I],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),update_and_start_monitoring:e.Func([ge],[],[]),update_and_stop_monitoring:e.Func([V],[],[]),version:e.Func([],[e.Text],["query"])})},wir=({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)}),i=e.Record({updated_at:e.Opt(e.Nat64)}),s=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),o=e.Record({storage:s}),a=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),c=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),u=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}),l=e.Variant({Callback:e.Record({token:u,callback:e.Func([],[],[])})}),p=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(l),status_code:e.Nat16}),d=e.Record({token:e.Opt(u),body:e.Vec(e.Nat8)}),f=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),h=e.Record({batch_id:e.Nat}),m=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),y=e.Record({field:m,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),v=e.Record({order:e.Opt(y),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),b=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),x=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),E=e.Record({key:b,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,x)),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,E))}),I=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),L=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,a))}),W=e.Variant({Db:e.Null,Storage:e.Null}),he=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),ae=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:he,created_at:e.Nat64,write:he}),Ee=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),U=e.Record({controller:Ee,controllers:e.Vec(e.Principal)}),R=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),ee=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:he,write:he}),H=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),D=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),get_config:e.Func([],[o],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(a)],["query"]),http_request:e.Func([c],[p],["query"]),http_request_streaming_callback:e.Func([u],[d],["query"]),init_asset_upload:e.Func([f],[h],[]),list_assets:e.Func([e.Opt(e.Text),v],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,I))],["query"]),list_docs:e.Func([e.Text,v],[L],["query"]),list_rules:e.Func([W],[e.Vec(e.Tuple(e.Text,ae))],["query"]),set_config:e.Func([o],[],[]),set_controllers:e.Func([U],[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,R],[a],[]),set_rule:e.Func([W,e.Text,ee],[],[]),upload_asset_chunk:e.Func([H],[D],[]),version:e.Func([],[e.Text],["query"])})},Tir=({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({sha256:e.Vec(e.Nat8),proposal_id:e.Nat}),n=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),i=e.Record({field:n,desc:e.Bool}),s=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),o=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(s),description:e.Opt(e.Text),created_at:e.Opt(s)}),a=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),c=e.Record({order:e.Opt(i),owner:e.Opt(e.Principal),matcher:e.Opt(o),paginate:e.Opt(a)}),u=e.Record({controllers:e.Vec(e.Principal)}),l=e.Variant({Write:e.Null,Admin:e.Null,Submit:e.Null}),p=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:l,expires_at:e.Opt(e.Nat64)}),d=e.Record({version:e.Opt(e.Nat64)}),f=e.Variant({Db:e.Null,Storage:e.Null}),h=e.Record({version:e.Opt(e.Nat64)}),m=e.Record({proposal_ids:e.Vec(e.Nat)}),y=e.Record({cycles:e.Nat,destination_id:e.Principal}),g=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}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),b=e.Record({key:g,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),x=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),E=e.Record({allowed_callers:e.Vec(e.Principal)}),P=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),I=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),L=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),W=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),he=e.Variant({Deny:e.Null,Allow:e.Null}),ae=e.Record({status_code:e.Nat16,location:e.Text}),Ee=e.Record({iframe:e.Opt(W),updated_at:e.Opt(e.Nat64),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),U=e.Record({db:e.Opt(L),authentication:e.Opt(P),storage:Ee}),R=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),ee=e.Variant({Initialized:e.Null,Failed:e.Null,Open:e.Null,Rejected:e.Null,Executed:e.Null,Accepted:e.Null}),H=e.Record({clear_existing_assets:e.Opt(e.Bool)}),D=e.Record({orbiter:e.Opt(e.Text),mission_control_version:e.Opt(e.Text),satellite_version:e.Opt(e.Text)}),j=e.Variant({AssetsUpgrade:H,SegmentsDeployment:D}),k=e.Record({status:ee,updated_at:e.Nat64,sha256:e.Opt(e.Vec(e.Nat8)),executed_at:e.Opt(e.Nat64),owner:e.Principal,created_at:e.Nat64,version:e.Opt(e.Nat64),proposal_type:j}),ie=e.Variant({Heap:e.Null,Stable:e.Null}),ge=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Pe=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),V=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:ge,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),C=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),_e=e.Record({memory:ie,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}),Se=e.Variant({Callback:e.Record({token:_e,callback:e.Func([],[],["query"])})}),De=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Se),status_code:e.Nat16}),Oe=e.Record({token:e.Opt(_e),body:e.Vec(e.Nat8)}),S=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}),N=e.Record({batch_id:e.Nat}),$=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,b)),items_length:e.Nat64}),oe=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),se=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,R)),items_length:e.Nat64}),ue=e.Record({desc:e.Bool}),be=e.Record({start_after:e.Opt(e.Nat),limit:e.Opt(e.Nat)}),A=e.Record({order:e.Opt(ue),paginate:e.Opt(be)}),F=e.Record({proposal_id:e.Nat}),Q=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(F,k)),items_length:e.Nat64}),te=e.Record({include_system:e.Bool}),xe=e.Record({matcher:e.Opt(te)}),Te=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(e.Text,V)),items_length:e.Nat64}),$e=e.Record({stable:e.Nat64,heap:e.Nat64}),ot=e.Record({version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),pt=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:l,expires_at:e.Opt(e.Nat64)}),gt=e.Record({controller:pt,controllers:e.Vec(e.Principal)}),ct=e.Record({version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),Ye=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Zt=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),max_size:e.Opt(e.Nat),read:ge,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),Yt=e.Record({iframe:e.Opt(W),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),Wt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Lt=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),commit_proposal:e.Func([r],[e.Null],[]),commit_proposal_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,c],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,c],[e.Nat64],["query"]),count_proposals:e.Func([],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([u],[e.Vec(e.Tuple(e.Principal,p))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,d],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,c],[],[]),del_filtered_docs:e.Func([e.Text,c],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,d))],[],[]),del_rule:e.Func([f,e.Text,h],[],[]),delete_proposal_assets:e.Func([m],[],[]),deposit_cycles:e.Func([y],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(b)],["query"]),get_auth_config:e.Func([],[e.Opt(P)],["query"]),get_config:e.Func([],[U],[]),get_db_config:e.Func([],[e.Opt(L)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(R)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(b)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(R)))],["query"]),get_proposal:e.Func([e.Nat],[e.Opt(k)],["query"]),get_rule:e.Func([f,e.Text],[e.Opt(V)],["query"]),get_storage_config:e.Func([],[Ee],["query"]),http_request:e.Func([C],[De],["query"]),http_request_streaming_callback:e.Func([_e],[Oe],["query"]),init_asset_upload:e.Func([S],[N],[]),init_proposal:e.Func([j],[e.Nat,k],[]),init_proposal_asset_upload:e.Func([S,e.Nat],[N],[]),list_assets:e.Func([e.Text,c],[$],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,p))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,oe))],["query"]),list_docs:e.Func([e.Text,c],[se],["query"]),list_proposals:e.Func([A],[Q],["query"]),list_rules:e.Func([f,xe],[Te],["query"]),memory_size:e.Func([],[$e],["query"]),reject_proposal:e.Func([r],[e.Null],[]),set_auth_config:e.Func([ot],[P],[]),set_controllers:e.Func([gt],[e.Vec(e.Tuple(e.Principal,p))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([ct],[L],[]),set_doc:e.Func([e.Text,e.Text,Ye],[R],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ye))],[e.Vec(e.Tuple(e.Text,R))],[]),set_rule:e.Func([f,e.Text,Zt],[V],[]),set_storage_config:e.Func([Yt],[Ee],[]),submit_proposal:e.Func([e.Nat],[e.Nat,k],[]),upload_asset_chunk:e.Func([Wt],[Lt],[]),upload_proposal_asset_chunk:e.Func([Wt],[Lt],[])})},Sir=({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({sha256:e.Vec(e.Nat8),proposal_id:e.Nat}),n=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),i=e.Record({field:n,desc:e.Bool}),s=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),o=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(s),description:e.Opt(e.Text),created_at:e.Opt(s)}),a=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),c=e.Record({order:e.Opt(i),owner:e.Opt(e.Principal),matcher:e.Opt(o),paginate:e.Opt(a)}),u=e.Record({controllers:e.Vec(e.Principal)}),l=e.Variant({Write:e.Null,Admin:e.Null,Submit:e.Null}),p=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:l,expires_at:e.Opt(e.Nat64)}),d=e.Record({version:e.Opt(e.Nat64)}),f=e.Variant({Db:e.Null,Storage:e.Null}),h=e.Record({version:e.Opt(e.Nat64)}),m=e.Record({proposal_ids:e.Vec(e.Nat)}),y=e.Record({cycles:e.Nat,destination_id:e.Principal}),g=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}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),b=e.Record({key:g,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),x=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),E=e.Record({allowed_callers:e.Vec(e.Principal)}),P=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),I=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),L=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),W=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),he=e.Variant({Deny:e.Null,Allow:e.Null}),ae=e.Record({status_code:e.Nat16,location:e.Text}),Ee=e.Record({iframe:e.Opt(W),updated_at:e.Opt(e.Nat64),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),U=e.Record({db:e.Opt(L),authentication:e.Opt(P),storage:Ee}),R=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),ee=e.Variant({Initialized:e.Null,Failed:e.Null,Open:e.Null,Rejected:e.Null,Executed:e.Null,Accepted:e.Null}),H=e.Record({clear_existing_assets:e.Opt(e.Bool)}),D=e.Record({orbiter:e.Opt(e.Text),mission_control_version:e.Opt(e.Text),satellite_version:e.Opt(e.Text)}),j=e.Variant({AssetsUpgrade:H,SegmentsDeployment:D}),k=e.Record({status:ee,updated_at:e.Nat64,sha256:e.Opt(e.Vec(e.Nat8)),executed_at:e.Opt(e.Nat64),owner:e.Principal,created_at:e.Nat64,version:e.Opt(e.Nat64),proposal_type:j}),ie=e.Variant({Heap:e.Null,Stable:e.Null}),ge=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Pe=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),V=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:ge,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),C=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),_e=e.Record({memory:ie,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}),Se=e.Variant({Callback:e.Record({token:_e,callback:e.Func([],[],[])})}),De=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Se),status_code:e.Nat16}),Oe=e.Record({token:e.Opt(_e),body:e.Vec(e.Nat8)}),S=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}),N=e.Record({batch_id:e.Nat}),$=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,b)),items_length:e.Nat64}),oe=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),se=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,R)),items_length:e.Nat64}),ue=e.Record({desc:e.Bool}),be=e.Record({start_after:e.Opt(e.Nat),limit:e.Opt(e.Nat)}),A=e.Record({order:e.Opt(ue),paginate:e.Opt(be)}),F=e.Record({proposal_id:e.Nat}),Q=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(F,k)),items_length:e.Nat64}),te=e.Record({include_system:e.Bool}),xe=e.Record({matcher:e.Opt(te)}),Te=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(e.Text,V)),items_length:e.Nat64}),$e=e.Record({stable:e.Nat64,heap:e.Nat64}),ot=e.Record({version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),pt=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:l,expires_at:e.Opt(e.Nat64)}),gt=e.Record({controller:pt,controllers:e.Vec(e.Principal)}),ct=e.Record({version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),Ye=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Zt=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),max_size:e.Opt(e.Nat),read:ge,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),Yt=e.Record({iframe:e.Opt(W),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),Wt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Lt=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),commit_proposal:e.Func([r],[e.Null],[]),commit_proposal_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,c],[e.Nat64],[]),count_collection_assets:e.Func([e.Text],[e.Nat64],[]),count_collection_docs:e.Func([e.Text],[e.Nat64],[]),count_docs:e.Func([e.Text,c],[e.Nat64],[]),count_proposals:e.Func([],[e.Nat64],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([u],[e.Vec(e.Tuple(e.Principal,p))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,d],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,c],[],[]),del_filtered_docs:e.Func([e.Text,c],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,d))],[],[]),del_rule:e.Func([f,e.Text,h],[],[]),delete_proposal_assets:e.Func([m],[],[]),deposit_cycles:e.Func([y],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(b)],[]),get_auth_config:e.Func([],[e.Opt(P)],[]),get_config:e.Func([],[U],[]),get_db_config:e.Func([],[e.Opt(L)],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(R)],[]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(b)))],[]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(R)))],[]),get_proposal:e.Func([e.Nat],[e.Opt(k)],[]),get_rule:e.Func([f,e.Text],[e.Opt(V)],[]),get_storage_config:e.Func([],[Ee],[]),http_request:e.Func([C],[De],[]),http_request_streaming_callback:e.Func([_e],[Oe],[]),init_asset_upload:e.Func([S],[N],[]),init_proposal:e.Func([j],[e.Nat,k],[]),init_proposal_asset_upload:e.Func([S,e.Nat],[N],[]),list_assets:e.Func([e.Text,c],[$],[]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,p))],[]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,oe))],[]),list_docs:e.Func([e.Text,c],[se],[]),list_proposals:e.Func([A],[Q],[]),list_rules:e.Func([f,xe],[Te],[]),memory_size:e.Func([],[$e],[]),reject_proposal:e.Func([r],[e.Null],[]),set_auth_config:e.Func([ot],[P],[]),set_controllers:e.Func([gt],[e.Vec(e.Tuple(e.Principal,p))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([ct],[L],[]),set_doc:e.Func([e.Text,e.Text,Ye],[R],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ye))],[e.Vec(e.Tuple(e.Text,R))],[]),set_rule:e.Func([f,e.Text,Zt],[V],[]),set_storage_config:e.Func([Yt],[Ee],[]),submit_proposal:e.Func([e.Nat],[e.Nat,k],[]),upload_asset_chunk:e.Func([Wt],[Lt],[]),upload_proposal_asset_chunk:e.Func([Wt],[Lt],[])})},Pir=async({identity:e,host:t,localActor:r})=>await OCe.HttpAgent.create({identity:e,host:t,retryTimes:10,shouldFetchRootKey:r}),mu=async({agent:e,...t})=>e??await Air(t),Air=async({identity:e,container:t})=>{let r=(0,ACe.nonNullish)(t)&&t!==!1;return await Pir({identity:e,host:r?t===!0?"http://127.0.0.1:5987":t:"https://icp-api.io",localActor:r})},Oir=({satelliteId:e,...t})=>bm({canisterId:e,...t,idlFactory:wir}),xc=({satelliteId:e,certified:t=!1,...r})=>bm({canisterId:e,...r,idlFactory:t?Sir:Tir}),Dir=({satelliteId:e,...t})=>bm({canisterId:e,...t,idlFactory:vir}),Cir=({satelliteId:e,...t})=>bm({canisterId:e,...t,idlFactory:_ir}),Iir=({missionControlId:e,...t})=>bm({canisterId:e,...t,idlFactory:yir}),Nir=({missionControlId:e,...t})=>bm({canisterId:e,...t,idlFactory:Eir}),Fir=({orbiterId:e,certified:t=!1,...r})=>bm({canisterId:e,...r,idlFactory:t?bir:gir}),kir=({orbiterId:e,...t})=>bm({canisterId:e,...t,idlFactory:xir}),bm=({canisterId:e,idlFactory:t,...r})=>{if((0,PCe.isNullish)(e))throw new Error("No canister ID provided.");return Rir({canisterId:e,idlFactory:t,...r})},Rir=async({canisterId:e,idlFactory:t,config:r,...n})=>{let i=await mu(n);return SCe.Actor.createActor(t,{agent:i,canisterId:e,...r??{}})},jir=async({missionControl:e})=>{let{version:t}=await Nir(e);return t()},$ir=async({missionControl:e})=>{let{get_user:t}=await Iir(e);return t()};var cH={reinstall:null},UF={upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]},Mir=async({canisterId:e,actor:t})=>{let r=await mu(t),{stopCanister:n}=yl.ICManagementCanister.create({agent:r});await n(e)},Lir=async({canisterId:e,actor:t})=>{let r=await mu(t),{startCanister:n}=yl.ICManagementCanister.create({agent:r});await n(e)},Uir=async({actor:e,code:t})=>{let r=await mu(e),{installCode:n}=yl.ICManagementCanister.create({agent:r});return n(t)},qir=async({actor:e,canisterId:t})=>{let r=await mu(e),{storedChunks:n}=yl.ICManagementCanister.create({agent:r});return n({canisterId:t})},aH=async({actor:e,canisterId:t})=>{let r=await mu(e),{clearChunkStore:n}=yl.ICManagementCanister.create({agent:r});return n({canisterId:t})},zir=async({actor:e,chunk:t})=>{let r=await mu(e),{uploadChunk:n}=yl.ICManagementCanister.create({agent:r});return n(t)},Vir=async({actor:e,code:t})=>{let r=await mu(e),{installChunkedCode:n}=yl.ICManagementCanister.create({agent:r});return n(t)},Zir=async({actor:e,canisterId:t})=>{let r=await mu(e),{canisterStatus:n}=yl.ICManagementCanister.create({agent:r});return n(t)},NCe=async({canisterId:e,path:t,...r})=>{let n=await mu(r),i=globalThis.console.warn;globalThis.console.warn=()=>null;let s=await ICe.CanisterStatus.request({canisterId:e instanceof uH.Principal?e:uH.Principal.fromText(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]});return globalThis.console.warn=i,s.get(t)},Wir=async({actor:e,canisterId:t})=>{let r=await mu(e),{listCanisterSnapshots:n}=yl.ICManagementCanister.create({agent:r});return n({canisterId:t})},Kir=async({actor:e,...t})=>{let r=await mu(e),{takeCanisterSnapshot:n}=yl.ICManagementCanister.create({agent:r});return n(t)},A0=(e=>(e[e.AssertingExistingCode=0]="AssertingExistingCode",e[e.StoppingCanister=1]="StoppingCanister",e[e.TakingSnapshot=2]="TakingSnapshot",e[e.UpgradingCode=3]="UpgradingCode",e[e.RestartingCanister=4]="RestartingCanister",e))(A0||{}),Hir=async({actor:e,canisterId:t,missionControlId:r,wasmModule:n,preClearChunks:i,...s})=>{i&&await aH({actor:e,canisterId:t});let o=await Gir({wasmModule:n}),{uploadChunks:a,storedChunks:c,preClearChunks:u,postClearChunks:l}=await Yir({actor:e,wasmChunks:o,canisterId:t,missionControlId:r});u&&await aH({actor:e,canisterId:t});let p=[];for await(let d of Jir({uploadChunks:a,actor:e,canisterId:t,missionControlId:r}))p=[...p,...d];await Vir({actor:e,code:{...s,chunkHashesList:[...p,...c].sort(({orderId:d},{orderId:f})=>d-f).map(({chunkHash:d})=>d),targetCanisterId:t,storeCanisterId:r,wasmModuleHash:await _Ce(n)}}),l&&await aH({actor:e,canisterId:t})},Gir=async({wasmModule:e})=>{let t=new Blob([e]),r=[],n=1e6,i=0;for(let s=0;s<t.size;s+=n){let o=t.slice(s,s+n);r.push({chunk:o,orderId:i,sha256:await dir(o)}),i++}return r},Yir=async({canisterId:e,missionControlId:t,actor:r,wasmChunks:n})=>{let i=await qir({actor:r,canisterId:t??e}),s=i.map(({hash:c})=>({chunkHash:{hash:c},sha256:(0,S0.uint8ArrayToHexString)(c)})),{storedChunks:o,uploadChunks:a}=n.reduce(({uploadChunks:c,storedChunks:u},{sha256:l,...p})=>{let d=s.find(({sha256:f})=>f===l);return{uploadChunks:[...c,...(0,S0.nonNullish)(d)?[]:[{sha256:l,...p}]],storedChunks:[...u,...(0,S0.nonNullish)(d)?[{...p,...d}]:[]]}},{uploadChunks:[],storedChunks:[]});return{uploadChunks:a,storedChunks:o,preClearChunks:i.length>0&&o.length===0,postClearChunks:(0,S0.isNullish)(t)}};async function*Jir({uploadChunks:e,limit:t=12,...r}){for(let n=0;n<e.length;n=n+t){let i=e.slice(n,n+t);yield await Promise.all(i.map(s=>Xir({uploadChunk:s,...r})))}}var Xir=async({actor:e,canisterId:t,missionControlId:r,uploadChunk:{chunk:n,...i}})=>({chunkHash:await zir({actor:e,chunk:{canisterId:r??t,chunk:new Uint8Array(await n.arrayBuffer())}}),...i}),Qir=async({actor:e,...t})=>{await Uir({actor:e,code:t})},qF=async({wasmModule:e,canisterId:t,actor:r,onProgress:n,takeSnapshot:i=!0,...s})=>{await NT({fn:async()=>await esr({wasmModule:e,canisterId:t,actor:r,...s}),onProgress:n,step:0}),await NT({fn:async()=>await Mir({canisterId:t,actor:r}),onProgress:n,step:1});try{await NT({fn:async()=>i?await rsr({canisterId:t,actor:r}):Promise.resolve(),onProgress:n,step:2}),await NT({fn:async()=>await tsr({wasmModule:e,canisterId:t,actor:r,...s}),onProgress:n,step:3})}finally{await NT({fn:async()=>await Lir({canisterId:t,actor:r}),onProgress:n,step:4})}},NT=async({fn:e,step:t,onProgress:r})=>{r?.({step:t,state:"in_progress"});try{await e(),r?.({step:t,state:"success"})}catch(n){throw r?.({step:t,state:"error"}),n}},esr=async({actor:e,canisterId:t,wasmModule:r,reset:n})=>{if(n===!0)return;let{module_hash:i}=await Zir({actor:e,canisterId:t}),s=(0,n_.fromNullable)(i);if((0,n_.isNullish)(s))return;let o=await _Ce(r),a=(0,n_.uint8ArrayToHexString)(s);if(o===a)throw new RT},tsr=async({wasmModule:e,canisterId:t,actor:r,...n})=>{await((new Blob([e]).size>2e6?"chunked":"single")=="chunked"?Hir:Qir)({wasmModule:e,canisterId:t,actor:r,...n})},rsr=async e=>{let t=await Wir(e);await Kir({...e,snapshotId:t?.[0]?.id})},nsr=e=>gm.IDL.encode([gm.IDL.Record({user:gm.IDL.Principal})],[{user:e}]),FCe=e=>gm.IDL.encode([gm.IDL.Record({controllers:gm.IDL.Vec(gm.IDL.Principal)})],[{controllers:e.filter(([t,{scope:r}])=>"Admin"in r).map(([t,r])=>t)}]),pH=async({missionControl:e,...t})=>{let r=await $ir({missionControl:e}),{missionControlId:n,...i}=e;if(!n)throw new Error("No mission control principal defined.");let s=nsr(r);await qF({actor:i,canisterId:CCe.Principal.fromText(n),arg:new Uint8Array(s),mode:UF,...t})},O0=async({moduleId:e,...t})=>{let r=await NCe({...t,canisterId:e,path:"juno:package"});if(!(0,kCe.isNullish)(r)){if(typeof r!="string")throw new Error("Unexpected metadata type to parse public custom section juno:package");return(n=>fn().transform((i,s)=>{try{return JSON.parse(i)}catch{return s.addIssue({code:"custom",message:"Invalid JSON"}),eD}}).pipe(nD).parse(n))(r)}},dH=async e=>(await O0(e))?.version;var VF=async({missionControl:{missionControlId:e,...t}})=>{(0,zF.assertNonNullish)(e,"A Mission Control ID must be provided to request its version.");let r=await O0({moduleId:e,...t});if((0,zF.isNullish)(r))return await jir({missionControl:{missionControlId:e,...t}});let{name:n,version:i}=r;if(n===iD)return i;throw new lir};var isr=async({orbiter:e})=>{let{version:t}=await kir(e);return t()},ssr=async({orbiter:e,certified:t})=>{let{list_controllers:r}=await Fir({...e,certified:t});return r()};var fH=async({orbiter:e,reset:t=!1,...r})=>{let{orbiterId:n,...i}=e;if(!n)throw new Error("No orbiter principal defined.");let s=await ssr({orbiter:e,certified:t}),o=FCe(s);await qF({actor:i,canisterId:RCe.Principal.fromText(n),arg:new Uint8Array(o),mode:t?cH:UF,reset:t,...r})},WF=async({orbiter:{orbiterId:e,...t}})=>{(0,ZF.assertNonNullish)(e,"An Orbiter ID must be provided to request its version.");let r=await O0({moduleId:e,...t});if((0,ZF.isNullish)(r))return await isr({orbiter:{orbiterId:e,...t}});let{name:n,version:i}=r;if(n===sD)return i;throw new pir},osr=async({config:e,satellite:t})=>{let{set_storage_config:r}=await xc(t);return r(e)},asr=async({config:e,satellite:t})=>{let{set_db_config:r}=await xc(t);return r(e)},csr=async({config:e,satellite:t})=>{let{set_auth_config:r}=await xc(t);return r(e)},usr=async({satellite:e})=>{let{get_storage_config:t}=await xc(e);return t()},lsr=async({satellite:e})=>{let{get_db_config:t}=await xc(e);return t()},psr=async({satellite:e})=>{let{get_auth_config:t}=await xc(e);return t()};var dsr=async({satellite:e,type:t,filter:r})=>{let{list_rules:n}=await xc(e);return n(t,r)},fsr=async({type:e,collection:t,rule:r,satellite:n})=>{let{set_rule:i}=await xc(n);return i(e,t,r)},hsr=async({satellite:e})=>{let{version:t}=await Cir(e);return t()},msr=async({satellite:e})=>{let{list_controllers:t}=await Oir(e);return t()},ysr=async({satellite:e})=>{let{list_controllers:t}=await Dir(e);return t()},gsr=async({satellite:e,certified:t})=>{let{list_controllers:r}=await xc({...e,certified:t});return r()},bsr=async({satellite:e})=>{let{list_custom_domains:t}=await xc(e);return t()},vsr=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await xc(e);await n(t,(0,jCe.toNullable)(r))},_sr=async({satellite:e})=>{let{memory_size:t}=await xc(e);return t()};var xsr=async({collection:e,satellite:t})=>{let{del_assets:r}=await xc(t);return r(e)};var $Ce=e=>xsr(e),MCe=e=>(0,ks.toNullable)((0,ks.nonNullish)(e)&&((0,ks.nonNullish)((0,ks.toNullable)(e.heap))||(0,ks.nonNullish)((0,ks.toNullable)(e.stable)))?{heap:(0,ks.toNullable)(e.heap),stable:(0,ks.toNullable)(e.stable)}:void 0),LCe=e=>{let t=(0,ks.fromNullable)(e),r=(0,ks.fromNullable)(t?.heap??[]),n=(0,ks.fromNullable)(t?.stable??[]);return{...(0,ks.nonNullish)(t)&&((0,ks.nonNullish)(r)||(0,ks.nonNullish)(n))&&{maxMemorySize:{...(0,ks.nonNullish)(r)&&{heap:r},...(0,ks.nonNullish)(n)&&{stable:n}}}}},Esr=({headers:e,rewrites:t,redirects:r,iframe:n,rawAccess:i,maxMemorySize:s,version:o})=>{let a=(e??[]).map(({source:l,headers:p})=>[l,p]),c=(t??[]).map(({source:l,destination:p})=>[l,p]),u=(r??[]).map(({source:l,location:p,code:d})=>[l,{status_code:d,location:p}]);return{headers:a,rewrites:c,redirects:[u],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[i===!0?{Allow:null}:{Deny:null}],max_memory_size:MCe(s),version:(0,Wn.toNullable)(o)}},UCe=({redirects:e,iframe:t,version:r,raw_access:n,max_memory_size:i,headers:s,rewrites:o})=>{let a=(0,Wn.fromNullable)(e)?.map(([m,{status_code:y,...g}])=>({...g,code:y,source:m})),c=(0,Wn.fromNullable)(n),u=(0,Wn.nonNullish)(c)?"Allow"in c:void 0,l=(0,Wn.fromNullable)(t),p=(0,Wn.nonNullish)(l)?"SameOrigin"in l?"same-origin":"AllowAny"in l?"allow-any":"deny":void 0,d=LCe(i),f=s.map(([m,y])=>({source:m,headers:y})),h=o.map(([m,y])=>({source:m,destination:y}));return{...f.length>0&&{headers:f},...h.length>0&&{rewrites:h},...(0,Wn.nonNullish)(a)&&{redirects:a},...(0,Wn.nonNullish)(p)&&{iframe:p},version:(0,Wn.fromNullable)(r),...(0,Wn.nonNullish)(u)&&{rawAccess:u},...d}},wsr=({maxMemorySize:e,version:t})=>({max_memory_size:MCe(e),version:(0,Wn.toNullable)(t)}),qCe=({version:e,max_memory_size:t})=>({...LCe(t),version:(0,Wn.fromNullable)(e)}),Tsr=({internetIdentity:e,rules:t,version:r})=>({internet_identity:(0,Wn.isNullish)(e)?[]:[{derivation_origin:(0,Wn.toNullable)(e?.derivationOrigin),external_alternative_origins:(0,Wn.toNullable)(e?.externalAlternativeOrigins)}],rules:(0,Wn.isNullish)(t)?[]:[{allowed_callers:t.allowedCallers.map(n=>BCe.Principal.fromText(n))}],version:(0,Wn.toNullable)(r)}),zCe=({version:e,internet_identity:t,rules:r})=>{let n=(0,Wn.fromNullable)(t),i=(0,Wn.fromNullable)(n?.derivation_origin??[]),s=(0,Wn.fromNullable)(n?.external_alternative_origins??[]),o=(0,Wn.fromNullable)(r);return{...(0,Wn.nonNullish)(n)&&{internetIdentity:{...(0,Wn.nonNullish)(i)&&{derivationOrigin:i},...(0,Wn.nonNullish)(s)&&{externalAlternativeOrigins:s}}},...(0,Wn.nonNullish)(o)&&{rules:{allowedCallers:o.allowed_callers.map(a=>a.toText())}},version:(0,Wn.fromNullable)(e)}},VCe=async({config:e,satellite:t})=>{let r=await osr({satellite:t,config:Esr(e)});return UCe(r)},ZCe=async({config:e,...t})=>{let r=await asr({config:wsr(e),...t});return qCe(r)},WCe=async({config:e,...t})=>{let r=await csr({config:Tsr(e),...t});return zCe(r)},KCe=async({satellite:e})=>{let t=await psr({satellite:e}),r=(0,D0.fromNullable)(t);if(!(0,D0.isNullish)(r))return zCe(r)},HCe=async({satellite:e})=>{let t=await usr({satellite:e});return UCe(t)},GCe=async({satellite:e})=>{let t=await lsr({satellite:e}),r=(0,D0.fromNullable)(t);if(!(0,D0.isNullish)(r))return qCe(r)};var vm=async({satellite:e})=>(await bsr({satellite:e})).map(([t,r])=>{let n=(0,kT.fromNullable)(r.version);return{domain:t,bn_id:(0,kT.fromNullable)(r.bn_id),created_at:r.created_at,updated_at:r.updated_at,...(0,kT.nonNullish)(n)&&{version:n}}}),KF=({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>vsr({satellite:e,domainName:r,boundaryNodesId:n})));var YCe=e=>_sr(e),Ssr={Db:null},Psr={Storage:null},Asr={Public:null},Osr={Private:null},Dsr={Managed:null},Csr={Controllers:null},JCe={Heap:null},Isr={Stable:null},Nsr=600000000n,XCe=e=>e==="storage"?Psr:Ssr,Fsr=e=>({matcher:(0,Qn.isNullish)(e)?(0,Qn.toNullable)():(0,Qn.toNullable)({include_system:e.include_system})}),ksr=({read:e,write:t,memory:r,maxSize:n,maxChangesPerUser:i,maxCapacity:s,version:o,mutablePermissions:a,maxTokens:c})=>({read:yCe(e),write:yCe(t),memory:(0,Qn.nonNullish)(r)?[Rsr(r)]:[],version:(0,Qn.toNullable)(o),max_size:(0,Qn.toNullable)((0,Qn.nonNullish)(n)&&n>0n?n:void 0),max_capacity:(0,Qn.toNullable)((0,Qn.nonNullish)(s)&&s>0?s:void 0),max_changes_per_user:(0,Qn.toNullable)((0,Qn.nonNullish)(i)&&i>0?i:void 0),mutable_permissions:(0,Qn.toNullable)(a??!0),rate_config:(0,Qn.nonNullish)(c)&&c>0n?[{max_tokens:c,time_per_token_ns:Nsr}]:[]}),QCe=([e,t])=>{let{read:r,write:n,updated_at:i,created_at:s,max_size:o,max_changes_per_user:a,max_capacity:c,memory:u,mutable_permissions:l,version:p,rate_config:d}=t,f=o?.[0]??0n>0n?(0,Qn.fromNullable)(o):void 0,h=a?.[0]??!1?(0,Qn.fromNullable)(a):void 0,m=c?.[0]??!1?(0,Qn.fromNullable)(c):void 0,y=(0,Qn.fromNullable)(p),g=d?.[0]?.max_tokens??0n>0n?(0,Qn.fromNullable)(d)?.max_tokens:void 0;return{collection:e,read:mCe(r),write:mCe(n),memory:jsr((0,Qn.fromNullable)(u)??JCe),updatedAt:i,createdAt:s,...(0,Qn.nonNullish)(y)&&{version:y},...(0,Qn.nonNullish)(h)&&{maxChangesPerUser:h},...(0,Qn.nonNullish)(f)&&{maxSize:f},...(0,Qn.nonNullish)(m)&&{maxCapacity:m},mutablePermissions:(0,Qn.fromNullable)(l)??!0,...(0,Qn.nonNullish)(g)&&{maxTokens:g}}},mCe=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",yCe=e=>{switch(e){case"public":return Asr;case"private":return Osr;case"managed":return Dsr;default:return Csr}},Rsr=e=>{switch(e.toLowerCase()){case"heap":return JCe;default:return Isr}},jsr=e=>"Heap"in e?"heap":"stable",hH=async({type:e,satellite:t,filter:r})=>{let{items:n,...i}=await dsr({satellite:t,type:XCe(e),filter:Fsr(r)});return{...i,items:n.map(s=>QCe(s))}},eIe=async({rule:{collection:e,...t},type:r,satellite:n})=>{let i=await fsr({type:XCe(r),rule:ksr(t),satellite:n,collection:e});return QCe([e,i])},rIe=async({satellite:e,deprecated:t,deprecatedNoScope:r,reset:n=!1,...i})=>{let{satelliteId:s,...o}=e;if((0,tIe.isNullish)(s))throw new Error("No satellite principal defined.");if(t){let u=await msr({satellite:e}),l=FT.IDL.encode([FT.IDL.Record({controllers:FT.IDL.Vec(FT.IDL.Principal)})],[{controllers:u}]);await qF({actor:o,canisterId:lH.Principal.fromText(s),arg:new Uint8Array(l),mode:n?cH:UF,reset:n,...i});return}let a=await(r?ysr:gsr)({satellite:e,certified:n}),c=FCe(a);await qF({actor:o,canisterId:lH.Principal.fromText(s),arg:new Uint8Array(c),mode:n?cH:UF,reset:n,...i})},C0=async({satellite:{satelliteId:e,...t}})=>{(0,Op.assertNonNullish)(e,"A Satellite ID must be provided to request its version.");let r=await O0({moduleId:e,...t});if((0,Op.isNullish)(r))return await hsr({satellite:{satelliteId:e,...t}});let{name:n,version:i,dependencies:s}=r;if(n===Yc)return i;let o=jT({dependencies:s,dependencyId:Yc});if((0,Op.nonNullish)(o)){let[a,c]=o;return c}throw new gCe},nIe=async({satellite:{satelliteId:e,...t}})=>{(0,Op.assertNonNullish)(e,"A Satellite ID must be provided to request its version.");let r=await O0({moduleId:e,...t});if((0,Op.isNullish)(r))return await $sr({satellite:{satelliteId:e,...t}});let{name:n,dependencies:i}=r;if(n===Yc)return"stock";let s=jT({dependencies:i,dependencyId:Yc});if((0,Op.nonNullish)(s))return"extended";throw new gCe},$sr=async({satellite:{satelliteId:e,...t}})=>{let r=await NCe({...t,canisterId:e,path:"juno:build"});return(0,Op.nonNullish)(r)&&["stock","extended"].includes(r)?r:void 0};var uor=ne(Xe(),1),lor=ne(Xe(),1),dor=ne(IH(),1),hor=ne(Xe(),1),bIe=ne(Xe(),1),mor=ne(Xe(),1),xIe=ne(Xe(),1),EIe=ne(qs(),1),QF=ne(Xe(),1),e4=ne(Xe(),1),wIe=ne(qs(),1),NH=ne(Xe(),1),xor=ne(IH(),1),TIe=ne(Xe(),1),kH=ne(Xe(),1),SIe=ne(Xe(),1),PIe=ne(Kn(),1),ws=ne(Xe(),1),AIe=ne(Xe(),1),t4=ne(Xe(),1),CIe=ne(qs(),1),IIe=ne(Xe(),1),zT=ne(Xe(),1),FH=ne(Xe(),1),qT=ne(Xe(),1),por=class{callbacks=[];populate(e){this.callbacks.forEach(({callback:t})=>t(e))}subscribe(e){let t=Symbol();return this.callbacks.push({id:t,callback:e}),()=>this.callbacks=this.callbacks.filter(({id:r})=>r!==t)}};var b3r=BigInt(144e11);var vIe="http://127.0.0.1:5987";var _Ie=class MT extends por{static instance;env;constructor(){super()}static getInstance(){return MT.instance||(MT.instance=new MT),MT.instance}set(t){this.env=t,this.populate(t)}get(){return this.env}reset(){this.env=null}subscribe(t){let r=super.subscribe(t);return t(this.env),r}};var yor=()=>typeof window<"u";var gor=async({identity:e,container:t})=>{let r=(0,NH.nonNullish)(t)&&t!==!1?t===!0?vIe:t:"https://icp-api.io",n=(0,NH.nonNullish)(t);return await wIe.HttpAgent.create({identity:e,shouldFetchRootKey:n,host:r})},bor=class LT{static instance;#e=void 0;constructor(){}static getInstance(){return(0,e4.isNullish)(LT.instance)&&(LT.instance=new LT),LT.instance}async getAgent({identity:t,...r}){let n=t.getPrincipal().toText();if((0,e4.isNullish)(this.#e)||(0,e4.isNullish)(this.#e[n])){let i=await gor({identity:t,...r});return this.#e={...this.#e??{},[n]:i},i}return this.#e[n]}reset(){this.#e=null}},vor=class UT{static instance;#e=void 0;constructor(){}static getInstance(){return(0,QF.isNullish)(UT.instance)&&(UT.instance=new UT),UT.instance}async getActor({satelliteId:t,identity:r,actorKey:n,...i}){let s=`${n}#${r.getPrincipal().toText()}#${t};`;if((0,QF.isNullish)(this.#e)||(0,QF.isNullish)(this.#e[s])){let o=await this.createActor({satelliteId:t,identity:r,...i});return this.#e={...this.#e??{},[s]:o},o}return this.#e[s]}reset(){this.#e=null}async createActor({idlFactory:t,satelliteId:r,...n}){let i=await bor.getInstance().getAgent(n);return EIe.Actor.createActor(t,{agent:i,canisterId:r})}};var _or=class extends Error{};var gIe=e=>{if((0,ws.isNullish)(e))return(0,ws.toNullable)();switch(e.matcher){case"equal":return(0,ws.toNullable)({Equal:e.timestamp});case"greaterThan":return(0,ws.toNullable)({GreaterThan:e.timestamp});case"lessThan":return(0,ws.toNullable)({LessThan:e.timestamp});case"between":return(0,ws.toNullable)({Between:[e.timestamps.start,e.timestamps.end]});default:throw new _or("Invalid list matcher for timestamp",e)}},Eor=({matcher:e,paginate:t,order:r,owner:n})=>({matcher:(0,ws.isNullish)(e)?[]:[{key:(0,ws.toNullable)(e.key),description:(0,ws.toNullable)(e.description),created_at:gIe(e.createdAt),updated_at:gIe(e.updatedAt)}],paginate:(0,ws.toNullable)((0,ws.isNullish)(t)?void 0:{start_after:(0,ws.toNullable)(t.startAfter),limit:(0,ws.toNullable)((0,ws.isNullish)(t.limit)?void 0:BigInt(t.limit))}),order:(0,ws.toNullable)((0,ws.isNullish)(r)?void 0:{desc:r.desc,field:r.field==="created_at"?{CreatedAt:null}:r.field==="updated_at"?{UpdatedAt:null}:{Keys:null}}),owner:(0,ws.toNullable)((0,ws.isNullish)(n)?void 0:typeof n=="string"?PIe.Principal.fromText(n):n)}),wor=({satelliteId:e,container:t})=>{let{satelliteId:r}=OIe({satelliteId:e}),{container:n}=DIe({container:t});if((0,t4.nonNullish)(n)&&n!==!1){let{host:i,protocol:s}=new URL(n===!0?vIe:n);return`${s}//${r??"unknown"}.${i.replace("127.0.0.1","localhost")}`}return`https://${r??"unknown"}.icp0.io`},OIe=({satelliteId:e})=>(0,t4.nonNullish)(e)?{satelliteId:e}:_Ie.getInstance().get()??{satelliteId:void 0},DIe=({container:e})=>(0,t4.nonNullish)(e)?{container:e}:_Ie.getInstance().get()??{container:void 0},Tor=({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({sha256:e.Vec(e.Nat8),proposal_id:e.Nat}),n=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),i=e.Record({field:n,desc:e.Bool}),s=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),o=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(s),description:e.Opt(e.Text),created_at:e.Opt(s)}),a=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),c=e.Record({order:e.Opt(i),owner:e.Opt(e.Principal),matcher:e.Opt(o),paginate:e.Opt(a)}),u=e.Record({controllers:e.Vec(e.Principal)}),l=e.Variant({Write:e.Null,Admin:e.Null,Submit:e.Null}),p=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:l,expires_at:e.Opt(e.Nat64)}),d=e.Record({version:e.Opt(e.Nat64)}),f=e.Variant({Db:e.Null,Storage:e.Null}),h=e.Record({version:e.Opt(e.Nat64)}),m=e.Record({proposal_ids:e.Vec(e.Nat)}),y=e.Record({cycles:e.Nat,destination_id:e.Principal}),g=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}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),b=e.Record({key:g,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),x=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),E=e.Record({allowed_callers:e.Vec(e.Principal)}),P=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),I=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),L=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),W=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),he=e.Variant({Deny:e.Null,Allow:e.Null}),ae=e.Record({status_code:e.Nat16,location:e.Text}),Ee=e.Record({iframe:e.Opt(W),updated_at:e.Opt(e.Nat64),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),U=e.Record({db:e.Opt(L),authentication:e.Opt(P),storage:Ee}),R=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),ee=e.Variant({Initialized:e.Null,Failed:e.Null,Open:e.Null,Rejected:e.Null,Executed:e.Null,Accepted:e.Null}),H=e.Record({clear_existing_assets:e.Opt(e.Bool)}),D=e.Record({orbiter:e.Opt(e.Text),mission_control_version:e.Opt(e.Text),satellite_version:e.Opt(e.Text)}),j=e.Variant({AssetsUpgrade:H,SegmentsDeployment:D}),k=e.Record({status:ee,updated_at:e.Nat64,sha256:e.Opt(e.Vec(e.Nat8)),executed_at:e.Opt(e.Nat64),owner:e.Principal,created_at:e.Nat64,version:e.Opt(e.Nat64),proposal_type:j}),ie=e.Variant({Heap:e.Null,Stable:e.Null}),ge=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Pe=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),V=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:ge,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),C=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),_e=e.Record({memory:ie,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}),Se=e.Variant({Callback:e.Record({token:_e,callback:e.Func([],[],["query"])})}),De=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Se),status_code:e.Nat16}),Oe=e.Record({token:e.Opt(_e),body:e.Vec(e.Nat8)}),S=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}),N=e.Record({batch_id:e.Nat}),$=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,b)),items_length:e.Nat64}),oe=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),se=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,R)),items_length:e.Nat64}),ue=e.Record({desc:e.Bool}),be=e.Record({start_after:e.Opt(e.Nat),limit:e.Opt(e.Nat)}),A=e.Record({order:e.Opt(ue),paginate:e.Opt(be)}),F=e.Record({proposal_id:e.Nat}),Q=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(F,k)),items_length:e.Nat64}),te=e.Record({include_system:e.Bool}),xe=e.Record({matcher:e.Opt(te)}),Te=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(e.Text,V)),items_length:e.Nat64}),$e=e.Record({stable:e.Nat64,heap:e.Nat64}),ot=e.Record({version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),pt=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:l,expires_at:e.Opt(e.Nat64)}),gt=e.Record({controller:pt,controllers:e.Vec(e.Principal)}),ct=e.Record({version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),Ye=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Zt=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),max_size:e.Opt(e.Nat),read:ge,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),Yt=e.Record({iframe:e.Opt(W),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),Wt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Lt=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),commit_proposal:e.Func([r],[e.Null],[]),commit_proposal_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,c],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,c],[e.Nat64],["query"]),count_proposals:e.Func([],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([u],[e.Vec(e.Tuple(e.Principal,p))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,d],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,c],[],[]),del_filtered_docs:e.Func([e.Text,c],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,d))],[],[]),del_rule:e.Func([f,e.Text,h],[],[]),delete_proposal_assets:e.Func([m],[],[]),deposit_cycles:e.Func([y],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(b)],["query"]),get_auth_config:e.Func([],[e.Opt(P)],["query"]),get_config:e.Func([],[U],[]),get_db_config:e.Func([],[e.Opt(L)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(R)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(b)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(R)))],["query"]),get_proposal:e.Func([e.Nat],[e.Opt(k)],["query"]),get_rule:e.Func([f,e.Text],[e.Opt(V)],["query"]),get_storage_config:e.Func([],[Ee],["query"]),http_request:e.Func([C],[De],["query"]),http_request_streaming_callback:e.Func([_e],[Oe],["query"]),init_asset_upload:e.Func([S],[N],[]),init_proposal:e.Func([j],[e.Nat,k],[]),init_proposal_asset_upload:e.Func([S,e.Nat],[N],[]),list_assets:e.Func([e.Text,c],[$],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,p))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,oe))],["query"]),list_docs:e.Func([e.Text,c],[se],["query"]),list_proposals:e.Func([A],[Q],["query"]),list_rules:e.Func([f,xe],[Te],["query"]),memory_size:e.Func([],[$e],["query"]),reject_proposal:e.Func([r],[e.Null],[]),set_auth_config:e.Func([ot],[P],[]),set_controllers:e.Func([gt],[e.Vec(e.Tuple(e.Principal,p))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([ct],[L],[]),set_doc:e.Func([e.Text,e.Text,Ye],[R],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ye))],[e.Vec(e.Tuple(e.Text,R))],[]),set_rule:e.Func([f,e.Text,Zt],[V],[]),set_storage_config:e.Func([Yt],[Ee],[]),submit_proposal:e.Func([e.Nat],[e.Nat,k],[]),upload_asset_chunk:e.Func([Wt],[Lt],[]),upload_proposal_asset_chunk:e.Func([Wt],[Lt],[])})},Sor=({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({sha256:e.Vec(e.Nat8),proposal_id:e.Nat}),n=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),i=e.Record({field:n,desc:e.Bool}),s=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),o=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(s),description:e.Opt(e.Text),created_at:e.Opt(s)}),a=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),c=e.Record({order:e.Opt(i),owner:e.Opt(e.Principal),matcher:e.Opt(o),paginate:e.Opt(a)}),u=e.Record({controllers:e.Vec(e.Principal)}),l=e.Variant({Write:e.Null,Admin:e.Null,Submit:e.Null}),p=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:l,expires_at:e.Opt(e.Nat64)}),d=e.Record({version:e.Opt(e.Nat64)}),f=e.Variant({Db:e.Null,Storage:e.Null}),h=e.Record({version:e.Opt(e.Nat64)}),m=e.Record({proposal_ids:e.Vec(e.Nat)}),y=e.Record({cycles:e.Nat,destination_id:e.Principal}),g=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}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),b=e.Record({key:g,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),x=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),E=e.Record({allowed_callers:e.Vec(e.Principal)}),P=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),I=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),L=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),W=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),he=e.Variant({Deny:e.Null,Allow:e.Null}),ae=e.Record({status_code:e.Nat16,location:e.Text}),Ee=e.Record({iframe:e.Opt(W),updated_at:e.Opt(e.Nat64),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),U=e.Record({db:e.Opt(L),authentication:e.Opt(P),storage:Ee}),R=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),ee=e.Variant({Initialized:e.Null,Failed:e.Null,Open:e.Null,Rejected:e.Null,Executed:e.Null,Accepted:e.Null}),H=e.Record({clear_existing_assets:e.Opt(e.Bool)}),D=e.Record({orbiter:e.Opt(e.Text),mission_control_version:e.Opt(e.Text),satellite_version:e.Opt(e.Text)}),j=e.Variant({AssetsUpgrade:H,SegmentsDeployment:D}),k=e.Record({status:ee,updated_at:e.Nat64,sha256:e.Opt(e.Vec(e.Nat8)),executed_at:e.Opt(e.Nat64),owner:e.Principal,created_at:e.Nat64,version:e.Opt(e.Nat64),proposal_type:j}),ie=e.Variant({Heap:e.Null,Stable:e.Null}),ge=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Pe=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),V=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:ge,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),C=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),_e=e.Record({memory:ie,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}),Se=e.Variant({Callback:e.Record({token:_e,callback:e.Func([],[],[])})}),De=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Se),status_code:e.Nat16}),Oe=e.Record({token:e.Opt(_e),body:e.Vec(e.Nat8)}),S=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}),N=e.Record({batch_id:e.Nat}),$=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,b)),items_length:e.Nat64}),oe=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),se=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,R)),items_length:e.Nat64}),ue=e.Record({desc:e.Bool}),be=e.Record({start_after:e.Opt(e.Nat),limit:e.Opt(e.Nat)}),A=e.Record({order:e.Opt(ue),paginate:e.Opt(be)}),F=e.Record({proposal_id:e.Nat}),Q=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(F,k)),items_length:e.Nat64}),te=e.Record({include_system:e.Bool}),xe=e.Record({matcher:e.Opt(te)}),Te=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(e.Text,V)),items_length:e.Nat64}),$e=e.Record({stable:e.Nat64,heap:e.Nat64}),ot=e.Record({version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),pt=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:l,expires_at:e.Opt(e.Nat64)}),gt=e.Record({controller:pt,controllers:e.Vec(e.Principal)}),ct=e.Record({version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),Ye=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Zt=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),max_size:e.Opt(e.Nat),read:ge,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),Yt=e.Record({iframe:e.Opt(W),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),Wt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Lt=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),commit_proposal:e.Func([r],[e.Null],[]),commit_proposal_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,c],[e.Nat64],[]),count_collection_assets:e.Func([e.Text],[e.Nat64],[]),count_collection_docs:e.Func([e.Text],[e.Nat64],[]),count_docs:e.Func([e.Text,c],[e.Nat64],[]),count_proposals:e.Func([],[e.Nat64],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([u],[e.Vec(e.Tuple(e.Principal,p))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,d],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,c],[],[]),del_filtered_docs:e.Func([e.Text,c],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,d))],[],[]),del_rule:e.Func([f,e.Text,h],[],[]),delete_proposal_assets:e.Func([m],[],[]),deposit_cycles:e.Func([y],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(b)],[]),get_auth_config:e.Func([],[e.Opt(P)],[]),get_config:e.Func([],[U],[]),get_db_config:e.Func([],[e.Opt(L)],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(R)],[]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(b)))],[]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(R)))],[]),get_proposal:e.Func([e.Nat],[e.Opt(k)],[]),get_rule:e.Func([f,e.Text],[e.Opt(V)],[]),get_storage_config:e.Func([],[Ee],[]),http_request:e.Func([C],[De],[]),http_request_streaming_callback:e.Func([_e],[Oe],[]),init_asset_upload:e.Func([S],[N],[]),init_proposal:e.Func([j],[e.Nat,k],[]),init_proposal_asset_upload:e.Func([S,e.Nat],[N],[]),list_assets:e.Func([e.Text,c],[$],[]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,p))],[]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,oe))],[]),list_docs:e.Func([e.Text,c],[se],[]),list_proposals:e.Func([A],[Q],[]),list_rules:e.Func([f,xe],[Te],[]),memory_size:e.Func([],[$e],[]),reject_proposal:e.Func([r],[e.Null],[]),set_auth_config:e.Func([ot],[P],[]),set_controllers:e.Func([gt],[e.Vec(e.Tuple(e.Principal,p))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([ct],[L],[]),set_doc:e.Func([e.Text,e.Text,Ye],[R],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ye))],[e.Vec(e.Tuple(e.Text,R))],[]),set_rule:e.Func([f,e.Text,Zt],[V],[]),set_storage_config:e.Func([Yt],[Ee],[]),submit_proposal:e.Func([e.Nat],[e.Nat,k],[]),upload_asset_chunk:e.Func([Wt],[Lt],[]),upload_proposal_asset_chunk:e.Func([Wt],[Lt],[])})},RH=({satellite:e,options:{certified:t}})=>Por({idlFactory:t?Sor:Tor,actorKey:`stock#${t?"update":"query"}`,...e});var Por=async({satelliteId:e,container:t,...r})=>{let{satelliteId:n}=OIe({satelliteId:e});(0,AIe.assertNonNullish)(n,"No satellite ID defined. Did you initialize Juno?");let{container:i}=DIe({container:t});return await vor.getInstance().getActor({satelliteId:n,container:i,...r})};var Aor={certified:!1},r4=e=>(0,IIe.nonNullish)(e)?e:Dor()??new CIe.AnonymousIdentity;var Oor;var Dor=()=>Oor?.getIdentity();var Cor=async({asset:{data:e,headers:t,...r},actor:n})=>{let{init_asset_upload:i,upload_asset_chunk:s,commit_asset_upload:o}=n,{batch_id:a}=await i(Ior(r)),{chunkIds:c}=await For({data:e,uploadFn:s,batchId:a});await Nor({commitFn:o,batchId:a,data:e,headers:t,chunkIds:c})},Ior=({filename:e,collection:t,token:r,fullPath:n,encoding:i,description:s})=>({collection:t,full_path:n,name:e,token:(0,qT.toNullable)(r),encoding_type:(0,qT.toNullable)(i),description:(0,qT.toNullable)(s)}),Nor=async({commitFn:e,batchId:t,chunkIds:r,headers:n,data:i})=>{let s=n.find(([o,a])=>o.toLowerCase()==="content-type")===void 0&&i.type!==void 0&&i.type!==""?[["Content-Type",i.type]]:void 0;await e({batch_id:t,chunk_ids:r.map(({chunk_id:o})=>o),headers:[...n,...s??[]]})},For=async({data:e,uploadFn:t,batchId:r})=>{let n=[],i=yor()?new Blob([await e.arrayBuffer()]):e,s=0n;for(let a=0;a<i.size;a+=19e5){let c=i.slice(a,a+19e5);n.push({batchId:r,chunk:c,uploadFn:t,orderId:s}),s++}let o=[];for await(let a of kor({uploadChunks:n}))o=[...o,...a];return{chunkIds:o}};async function*kor({uploadChunks:e,limit:t=12}){for(let r=0;r<e.length;r=r+t){let n=e.slice(r,r+t);yield await Promise.all(n.map(i=>Ror(i)))}}var Ror=async({batchId:e,chunk:t,uploadFn:r,orderId:n})=>r({batch_id:e,content:new Uint8Array(await t.arrayBuffer()),order_id:(0,qT.toNullable)(n)}),jor=async({asset:e,...t})=>{let r=await RH(t);await Cor({actor:r,asset:e})},$or=async({collection:e,filter:t,...r})=>{let{list_assets:n}=await RH(r),{items:i,items_length:s,items_page:o,matches_length:a,matches_pages:c}=await n(e,Eor(t));return{items:i.map(([u,l])=>l),items_length:s,items_page:(0,FH.fromNullable)(o),matches_length:a,matches_pages:(0,FH.fromNullable)(c)}};var Bor=async({collection:e,fullPath:t,...r})=>(await RH(r)).del_asset(e,t);var Mor=e=>btoa([...e].map(t=>String.fromCharCode(t)).join("")),NIe=e=>Lor(e);var Lor=async({filename:e,data:t,collection:r,headers:n=[],fullPath:i,token:s,satellite:o,encoding:a,description:c})=>{let u=r4(o?.identity),l=decodeURI(e),p=i??`/${r}/${l}`,d={...o,identity:u};return await jor({asset:{data:t,filename:l,collection:r,token:s,headers:n,fullPath:p,encoding:a,description:c},satellite:d,options:{certified:!0}}),{downloadUrl:kIe({satellite:d,assetKey:{fullPath:p,token:s}}),fullPath:p,name:l}},n4=async({collection:e,filter:t,satellite:r,options:n})=>{let i={...r,identity:r4(r?.identity)},{items:s,...o}=await $or({collection:e,filter:t??{},satellite:i,options:n??Aor}),a=s.map(({key:{full_path:c,token:u,name:l,owner:p,description:d},headers:f,encodings:h,created_at:m,updated_at:y})=>{let g=(0,zT.fromNullable)(u);return{fullPath:c,description:(0,zT.fromNullable)(d),name:l,downloadUrl:kIe({satellite:i,assetKey:{fullPath:c,token:g}}),token:g,headers:f,encodings:h.reduce((v,[b,{modified:x,sha256:E,total_length:P}])=>({...v,[b]:{modified:x,sha256:Mor(E),total_length:P}}),{}),owner:p.toText(),created_at:m,updated_at:y}});return{items:a,assets:a,...o}};var FIe=({collection:e,fullPath:t,satellite:r})=>Bor({collection:e,fullPath:t,satellite:{...r,identity:r4(r?.identity)},options:{certified:!0}});var kIe=({assetKey:{fullPath:e,token:t},satellite:r})=>{let n={...r,identity:r4(r?.identity)};return`${wor(n)}${e}${(0,zT.nonNullish)(t)?`?token=${t}`:""}`};var jH=ne(et(),1);var i4=async()=>{let{satellite:e}=await on(),t=Gn("Clearing app assets...").start();try{let r=await vm({satellite:e});await $Ce({collection:ey,satellite:e}),await KF({satellite:e,domains:r}),console.log(`${(0,jH.green)("\u2714")} App assets cleared.`)}finally{t.stop()}},Uor=e=>{let t=e.replace(/\\/g,"/");return`${t.startsWith("/")?"":"/"}${t}`},RIe=async({fullPath:e})=>{let{satellite:t}=await on(),r=Gn(`Clearing ${e}...`).start();try{await FIe({collection:ey,satellite:t,fullPath:Uor(e)}),console.log(`${(0,jH.green)("\u2714")} ${e} cleared.`)}finally{r.stop()}};var BIe=async e=>{if(!await Zo()){Gv();return}if(Qt({args:e,options:["-f","--fullpath","--fullPath"]})){let t=qt({args:e,option:"-f"})??qt({args:e,option:"--fullpath"})??qt({args:e,option:"--fullPath"});if((0,jIe.isNullish)(t)){console.log(`You did not provide a ${(0,$Ie.yellow)("fullPath")} to delete.`);return}await RIe({fullPath:t});return}await i4()};var Rt=ne(Xe(),1);var XIe=ne(et(),1);var MIe=()=>new cd({projectName:yr.config.projectStateName}),LIe=({satelliteId:e})=>MIe().get("satellites")?.[e]?.lastAppliedConfig,UIe=({satelliteId:e,lastAppliedConfig:{storage:t,datastore:r,auth:n,settings:i,collections:s}})=>{let o=MIe(),a=o.get("satellites"),c=a?.[e]?.lastAppliedConfig,u={...a??{},[e]:{lastAppliedConfig:{storage:t??c?.storage,datastore:r??c?.datastore,auth:n??c?.auth,settings:i??c?.settings,collections:s??c?.collections}}};o.set("satellites",u)};var qIe=1073741824n,zIe=31104000n,VIe=5000000000000n,ZIe="controllers",WIe=0n,KIe=0n;var HIe=ne(Xe(),1);import{createHash as qor}from"node:crypto";var zor=(e,t)=>t instanceof Object&&!(t instanceof Array)?Object.keys(t).sort().reduce((r,n)=>({...r,[n]:t[n]}),{}):t,Vor=(e,t)=>[zor,HIe.jsonReplacer].reduce((r,n)=>n(e,r),t),ba=e=>qor("sha256").update(JSON.stringify(e,Vor)).digest("hex");var i_=ne(Ig(),1),$H=ne(Kn(),1),GIe=ne(Xe(),1);var YIe=async({satellite:e})=>{let{satelliteId:t}=e,r=await hu(),{canisterStatus:n}=i_.ICManagementCanister.create({agent:r}),{settings:{freezing_threshold:i,reserved_cycles_limit:s,wasm_memory_limit:o,memory_allocation:a,compute_allocation:c,log_visibility:u}}=await n($H.Principal.fromText(t));return{freezingThreshold:i,reservedCyclesLimit:s,logVisibility:"public"in u?"public":"controllers",heapMemoryLimit:o,memoryAllocation:a,computeAllocation:c}},JIe=async({settings:e,satellite:t})=>{let{freezingThreshold:r,reservedCyclesLimit:n,logVisibility:i,heapMemoryLimit:s,memoryAllocation:o,computeAllocation:a}=e,{satelliteId:c}=t,u=await hu(),{updateSettings:l}=i_.ICManagementCanister.create({agent:u});await l({canisterId:$H.Principal.fromText(c),settings:{freezingThreshold:r,reservedCyclesLimit:n,logVisibility:(0,GIe.isNullish)(i)?void 0:i==="public"?i_.LogVisibility.Public:i_.LogVisibility.Controllers,wasmMemoryLimit:s,memoryAllocation:o,computeAllocation:a}})};var s4=async()=>{let{satellite:e,satelliteConfig:t}=await on(),{satelliteId:r}=e,n=await Hor({satellite:e,satelliteConfig:t}),i=LIe({satelliteId:r}),s=await Jor({currentConfig:n,lastAppliedConfig:i,satelliteConfig:t});if(Object.values(s).filter(Rt.nonNullish).length===0){console.log("\u{1F937}\u200D\u2642\uFE0F No configuration changes detected.");return}let o=await Gor({satellite:e,editConfig:s});Zor({results:o,settings:s.settings,satelliteId:r}),Wor(o)},Zor=({results:e,settings:t,satelliteId:r})=>{let n=p=>e[p].status==="fulfilled"?e[p].value:void 0,i=n(0),s=n(1),o=n(2),a=p=>e[p].status==="fulfilled"?e[p].value?.map(d=>d.status==="fulfilled"?d.value:void 0).filter(Rt.nonNullish).reduce((d,f)=>({...d,[f.collection]:QIe(f)}),{}):void 0,c=a(4),u=a(5),l={storage:(0,Rt.nonNullish)(i)?ba(i):void 0,datastore:(0,Rt.nonNullish)(s)?ba(s):void 0,auth:(0,Rt.nonNullish)(o)?ba(o):void 0,settings:(0,Rt.nonNullish)(t)?ba(t):void 0,collections:(0,Rt.nonNullish)(c)||(0,Rt.nonNullish)(u)?{storage:c,datastore:u}:void 0};UIe({lastAppliedConfig:l,satelliteId:r})},Wor=e=>{let t=e.filter(s=>s.status==="rejected"),r=s=>e[s].status==="fulfilled"?(e[s].value??[]).filter(o=>o.status==="rejected"):[],n=[...r(4),...r(5)],i=[...t,...n];if(i.length===0){console.log("\u2705 Configuration applied.");return}console.log((0,XIe.red)(`The configuration failed with ${i.length} error${i.length>1?"s":""} \u{1F622}.`)),i.forEach((s,o)=>{console.log(`${o}:`,s.reason instanceof Error?s.reason.message:s.reason)})},Kor=async({satellite:e,satelliteConfig:t})=>{let{storage:r,datastore:n,authentication:i,settings:s,collections:o}=t,a=o?.storage,c=o?.datastore,[u,l,p,d,f,h]=await Promise.all([(0,Rt.nonNullish)(r)?HCe({satellite:e}):Promise.resolve(),(0,Rt.nonNullish)(n)?GCe({satellite:e}):Promise.resolve(),(0,Rt.nonNullish)(i)?KCe({satellite:e}):Promise.resolve(),(0,Rt.nonNullish)(s)?YIe({satellite:e}):Promise.resolve(),(0,Rt.nonNullish)(a)&&a.length>0?hH({type:"storage",satellite:e}):Promise.resolve(void 0),(0,Rt.nonNullish)(c)&&c.length>0?hH({type:"db",satellite:e}):Promise.resolve(void 0)]),m=({items:y})=>y.reduce((g,v)=>({...g,[v.collection]:[v,QIe(v)]}),{});return{...(0,Rt.nonNullish)(u)&&{storage:[u,ba(u)]},...(0,Rt.nonNullish)(l)&&{datastore:[l,ba(l)]},...(0,Rt.nonNullish)(p)&&{auth:[p,ba(p)]},...(0,Rt.nonNullish)(d)&&{settings:[d,ba(d)]},...(0,Rt.nonNullish)(f)&&{storageCollections:m(f)},...(0,Rt.nonNullish)(h)&&{datastoreCollections:m(h)}}},Hor=async e=>{let t=Gn("Loading configuration...").start();try{return await Kor(e)}finally{t.stop()}},Gor=async({satellite:e,editConfig:t})=>{let r=Gn("Configuring...").start();try{return await Yor({satellite:e,editConfig:t})}finally{r.stop()}},Yor=async({satellite:e,editConfig:t})=>{let{storage:r,authentication:n,datastore:i,settings:s,collections:o}=t,a=o?.storage,c=o?.datastore,u=async({collections:l,type:p})=>await Promise.allSettled(l.map(async d=>await eIe({rule:d,type:p,satellite:e})));return await Promise.allSettled([(0,Rt.isNullish)(r)?Promise.resolve():VCe({config:{...r,headers:r.headers??[]},satellite:e}),(0,Rt.isNullish)(i)?Promise.resolve():ZCe({config:i,satellite:e}),(0,Rt.isNullish)(n)?Promise.resolve():WCe({config:n,satellite:e}),(0,Rt.isNullish)(s)?Promise.resolve():JIe({settings:s,satellite:e}),(0,Rt.isNullish)(a)||a.length===0?Promise.resolve(void 0):u({type:"storage",collections:a}),(0,Rt.isNullish)(c)||c.length===0?Promise.resolve(void 0):u({type:"db",collections:c})])},Jor=async({currentConfig:e,lastAppliedConfig:t,satelliteConfig:r})=>{let{storage:n,datastore:i,auth:s,settings:o,storageCollections:a,datastoreCollections:c}=e,u=()=>{if((0,Rt.isNullish)(o))return!0;let[I]=o;return I.computeAllocation===KIe&&I.memoryAllocation===WIe&&I.heapMemoryLimit===qIe&&I.freezingThreshold===zIe&&I.reservedCyclesLimit===VIe&&I.logVisibility===ZIe},l=()=>{let I=n?.[0].version;if((0,Rt.nonNullish)(I))return!1;let L=i?.[0].version;if((0,Rt.nonNullish)(L))return!1;let W=s?.[0].version;return(0,Rt.nonNullish)(W)||(0,Rt.nonNullish)(a)&&Object.keys(a).length>0||(0,Rt.nonNullish)(c)&&Object.keys(c).length>0?!1:u()},p=(0,Rt.isNullish)(t);if(p&&l())return r;let{storage:d,datastore:f,authentication:h,settings:m,collections:y}=r,g=y?.storage,v=y?.datastore,b=()=>{let I=n?.[0]?.version,L=i?.[0]?.version,W=s?.[0]?.version,he=({collections:U,currentCollections:R})=>(U??[]).map(({collection:ee,version:H,...D})=>({...D,collection:ee,version:H??R?.[ee]?.[0].version})),ae=he({collections:g,currentCollections:a}),Ee=he({collections:v,currentCollections:c});return{storage:(0,Rt.nonNullish)(d)&&(0,Rt.isNullish)(d.version)?{...d,version:I}:d,datastore:(0,Rt.nonNullish)(f)&&(0,Rt.isNullish)(f.version)?{...f,version:L}:f,authentication:(0,Rt.nonNullish)(h)&&(0,Rt.isNullish)(h.version)?{...h,version:W}:h,settings:m,...(0,Rt.nonNullish)(y)&&{collections:{...(0,Rt.nonNullish)(g)&&{storage:ae},...(0,Rt.nonNullish)(v)&&{datastore:Ee}}}}},x=I=>{let{storage:L,datastore:W,authentication:he,settings:ae,collections:Ee}=I,U=n?.[1],R=i?.[1],ee=s?.[1],H=o?.[1],D=({collections:ie,currentCollections:ge})=>ie?.filter(Pe=>{let V=ge?.[Pe.collection]?.[1],C={...Pe,...!("mutablePermissions"in Pe)&&{mutablePermissions:!0}};return(0,Rt.nonNullish)(V)&&V!==ba(C)}),j=D({collections:Ee?.storage,currentCollections:a}),k=D({collections:Ee?.datastore,currentCollections:c});return{storage:(0,Rt.nonNullish)(U)&&(0,Rt.nonNullish)(L)&&U===ba(L)?void 0:L,datastore:(0,Rt.nonNullish)(R)&&(0,Rt.nonNullish)(W)&&R===ba(W)?void 0:W,authentication:(0,Rt.nonNullish)(ee)&&(0,Rt.nonNullish)(he)&&ee===ba(he)?void 0:he,settings:(0,Rt.nonNullish)(H)&&(0,Rt.nonNullish)(ae)&&H===ba(ae)?void 0:ae,...((0,Rt.nonNullish)(j)&&j.length>0||(0,Rt.nonNullish)(k)&&k.length>0)&&{collections:{...(0,Rt.nonNullish)(j)&&j.length>0&&{storage:j},...(0,Rt.nonNullish)(k)&&k.length>0&&{datastore:k}}}}},E=async()=>(await si("This action will overwrite the current configuration of the Satellite. Are you sure you want to continue?"),x(b()));return p?await E():(()=>{let{storage:I,datastore:L,auth:W,settings:he,collections:ae}=t;if(n?.[1]!==I||i?.[1]!==L||s?.[1]!==W)return!1;let ee=({lastCollectionsHashes:D,currentCollections:j})=>Object.entries(D??{}).every(([k,ie])=>j?.[k]?.[1]===ie);if(!ee({lastCollectionsHashes:ae?.storage,currentCollections:a})||!ee({lastCollectionsHashes:ae?.datastore,currentCollections:c}))return!1;let H=o?.[1];return(0,Rt.nonNullish)(H)&&H===he||u()&&(0,Rt.isNullish)(m)})()?x(b()):await E()},QIe=({createdAt:e,updatedAt:t,...r})=>ba(r);var eNe=async()=>{await s4()};var fNe=ne(et(),1),LH=ne(Uu(),1);var sNe=ne(Xe(),1);var oNe=ne(et(),1);import{lstatSync as Xor}from"node:fs";var nNe=ne(et(),1),iNe=ne(Uu(),1);var tNe="0.0.14",rNe=900000000n;var o4=async()=>{let{satellite:e,satelliteConfig:t}=await on(),{assertions:r}=t;if(r?.heapMemory===!1)return;let n=await C0({satellite:e});if((0,iNe.compare)(n,tNe)<0){console.log(`Your satellite (${(0,nNe.yellow)(`v${n}`)}) is not up-to-date, and the memory size cannot be verified.${ms}`);return}let i=r?.heapMemory!==void 0&&typeof r.heapMemory!="boolean"?BigInt(r.heapMemory):rNe,{heap:s}=await YCe({satellite:e});if(s<i)return;let o=a=>Intl.NumberFormat("en-US",{maximumSignificantDigits:3}).format(Number(a)/1e6);await si(`\u26A0\uFE0F Your satellite's heap memory is ${o(s)} MB, which exceeds the recommended limit of ${o(i)} MB. Are you sure you want to proceed with the deployment?`)};var a4=e=>{let{length:t,[t-1]:r}=e;return r};var MH=async({startAfter:e,satellite:t})=>{let{items:r,items_page:n,matches_pages:i}=await n4({collection:ey,satellite:t,filter:{order:{desc:!0,field:"keys"},paginate:{startAfter:e,limit:500}}});if((n??0n)<(i??0n)){let s=await MH({startAfter:a4(r)?.fullPath,satellite:t});return[...r,...s]}return r};var aNe=async({deployFn:e,uploadFileFn:t,options:r})=>await uNe({deployFn:e,uploadFileFn:t,options:r}),cNe=async({deployFn:e,uploadFileFn:t,options:r})=>await uNe({deployFn:e,uploadFileFn:t,options:r}),uNe=async({deployFn:e,uploadFileFn:t,options:r})=>{let n=async()=>{await o4()},{satellite:i,satelliteConfig:s}=await on(),o=s.gzip??r.deprecatedGzip,a={...s,...(0,sNe.nonNullish)(o)&&{gzip:o}},c=async({startAfter:p})=>await MH({startAfter:p,satellite:i}),u=async p=>{let d={...p,satellite:i};await t(d)};await Cre({config:a});let l=await e({deploy:{config:a,listAssets:c,assertSourceDirExists:Qor,assertMemory:n,uploadFile:u},satellite:i});return l.result==="skipped"&&process.exit(0),await Ire({config:a}),l},Qor=e=>{try{Xor(e)}catch{console.log(`${(0,oNe.red)("Cannot proceed deployment.")}
|
|
799
|
+
`,iCe=e=>{console.log(ar(e)==="doc"?oir:air)};var sCe=ne(Xe(),1);var sH=ne(Xe(),1);var MF=e=>{let t=qt({args:e,option:"-i"})??qt({args:e,option:"--id"});(0,sH.assertNonNullish)(t,"An id must be provided");let n=(()=>{try{return BigInt(t)}catch{console.error("The id must be a valid number."),process.exit(1)}})(),i=qt({args:e,option:"--hash"});return(0,sH.assertNonNullish)(i,"A hash must be provided"),{proposalId:n,hash:i}};var oCe=async e=>{let{satellite:t}=await on(),{proposalId:r,hash:n}=MF(e),i=Qt({args:e,options:["-k","--keep-staged"]}),s=Qt({args:e,options:["--snapshot"]});await cir({satellite:t,proposalId:r,hash:n,clearProposalAssets:!i,takeSnapshot:s})},cir=async({satellite:e,proposalId:t,hash:r,...n})=>{let i=Gn().start(),s=({step:o})=>{switch(o){case Ng.TakingSnapshot:i.text="Creating a snapshot...";break;case Ng.CommittingProposal:i.text="Applying update...";break;case Ng.ClearingProposalAssets:i.text="Clearing staged assets...";break;case Ng.PostApply:i.text="Reloading...";break}};try{await Gee({cdn:{satellite:e},proposal:{proposal_id:t,sha256:(0,sCe.hexStringToUint8Array)(r)},onProgress:s,...n}),i.stop(),console.log(`\u{1F3AF} Change ID ${t} applied.`)}catch(o){throw i.stop(),o}};var _c=ne(Xe(),1);var LF=(e=new Date)=>new Intl.DateTimeFormat("en",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(e),aCe=(e=new Date)=>new Intl.DateTimeFormat("en",{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(e);var cCe=async e=>{let{satellite:t}=await on(),r=Qt({args:e,options:["-a","--all"]}),n=Qt({args:e,options:["-e","--every"]}),s=(await uCe({satellite:t,traverseAll:r})).filter(([o,{status:a}])=>"Open"in a||n).reduce((o,[{proposal_id:a},{sha256:c,created_at:u}])=>{let l=(0,_c.fromNullable)(c);return{...o,[`ID ${a}`]:{hash:(0,_c.nonNullish)(l)?(0,_c.uint8ArrayToHexString)(l):"",created_at:aCe(new Date(Number(u/1000000n)))}}},{});if(Object.keys(s).length===0){console.log("There are no open changes right now.");return}console.table(s)},uCe=async({startAfter:e,satellite:t,traverseAll:r})=>{let{items:n,items_length:i,matches_length:s}=await Kee({cdn:{satellite:t},filter:{order:(0,_c.toNullable)({desc:!0}),paginate:(0,_c.nonNullish)(e)?(0,_c.toNullable)({start_after:(0,_c.toNullable)(e),limit:(0,_c.toNullable)()}):(0,_c.toNullable)()}}),o=a=>{let{length:c,[c-1]:u}=a;return u};if(i>s&&r){let a=await uCe({startAfter:o(n)?.[0].proposal_id,satellite:t,traverseAll:r});return[...n,...a]}return n};var lCe=ne(Xe(),1);var pCe=async e=>{let{satellite:t}=await on(),{proposalId:r,hash:n}=MF(e),i=Qt({args:e,options:["-k","--keep-staged"]});await uir({satellite:t,proposalId:r,hash:n,clearProposalAssets:!i})},uir=async({satellite:e,proposalId:t,hash:r,...n})=>{let i=Gn().start(),s=({step:o})=>{switch(o){case xx.RejectingProposal:i.text="Rejecting...";break;case xx.ClearingProposalAssets:i.text="Clearing staged assets...";break;case xx.PostReject:i.text="Reloading...";break}};try{await Jee({cdn:{satellite:e},proposal:{proposal_id:t,sha256:(0,lCe.hexStringToUint8Array)(r)},onProgress:s,...n}),i.stop(),console.log(`\u{1F6AB} Change ID ${t} rejected.`)}catch(o){throw i.stop(),o}};var fCe=async e=>{let[t]=e??[];switch(t){case"list":await cCe(e);break;case"apply":await oCe(e);break;case"reject":await pCe(e);break;default:console.log((0,dCe.red)("Unknown subcommand.")),iH()}},hCe=e=>{let[t]=e??[];switch(t){case"list":rCe(e);break;case"apply":QDe(e);break;case"reject":iCe(e);break;default:iH(e)}};var jIe=ne(Xe(),1);var $Ie=ne(et(),1);var If=ne(Uu(),1),P0=ne(Xe(),1);var SCe=ne(qs(),1),PCe=ne(Xe(),1),ACe=ne(Xe(),1),OCe=ne(qs(),1),Bir=ne(Kn(),1),DCe=ne(Xe(),1),CCe=ne(Kn(),1),n_=ne(Xe(),1),ICe=ne(qs(),1),yl=ne(Ig(),1),uH=ne(Kn(),1),S0=ne(Xe(),1),gm=ne(Kf(),1),zF=ne(Xe(),1);var kCe=ne(Xe(),1);var RCe=ne(Kn(),1),ZF=ne(Xe(),1);var jCe=ne(Xe(),1),D0=ne(Xe(),1),BCe=ne(Kn(),1),Wn=ne(Xe(),1),ks=ne(Xe(),1),kT=ne(Xe(),1),Qn=ne(Xe(),1),FT=ne(Kf(),1),lH=ne(Kn(),1),tIe=ne(Xe(),1),Op=ne(Xe(),1);var RT=class extends Error{constructor(){super("The Wasm code for the upgrade is identical to the code currently installed. No upgrade is necessary.")}},gCe=class extends Error{constructor(){super(`Invalid dependency tree: required module ${Yc} is missing.`)}},lir=class extends Error{constructor(){super(`Invalid package: the provided module name is not ${iD}.`)}},pir=class extends Error{constructor(){super(`Invalid package: the provided module name is not ${sD}.`)}},bCe=e=>crypto.subtle.digest("SHA-256",e),vCe=e=>Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join(""),dir=async e=>{let t=await bCe(await e.arrayBuffer());return vCe(t)},_Ce=async e=>{let t=await bCe(e);return vCe(t)},jT=({dependencyId:e,dependencies:t})=>Object.entries(t??{}).find(([r,n])=>r===e),xCe=({currentVersion:e,selectedVersion:t})=>{let r=(0,If.major)(e),n=(0,If.major)(t),i=(0,If.minor)(e),s=(0,If.minor)(t),o=(0,If.patch)(e),a=(0,If.patch)(t);return r<n-1||i<s-1||o<a-1?{canUpgrade:!1}:{canUpgrade:!0}},ECe=async({junoPackage:e,wasm:t})=>{if((0,P0.isNullish)(e))return await fir({wasm:t});let{name:r,dependencies:n}=e;if(r===Yc)return"stock";let i=jT({dependencies:n,dependencyId:Yc});return(0,P0.nonNullish)(i)?"extended":void 0},fir=async({wasm:e})=>{let t=await TCe({wasm:e,sectionName:"icp:public juno:build"});return(0,P0.nonNullish)(t)&&["stock","extended"].includes(t)?t:void 0},wCe=async({wasm:e})=>{let t=await TCe({wasm:e,sectionName:"icp:public juno:package"});if((0,P0.isNullish)(t))return;let r=JSON.parse(t),{success:n,data:i}=nD.safeParse(r);return n?i:void 0},TCe=async({sectionName:e,wasm:t})=>{let r=await WebAssembly.compile(t),n=WebAssembly.Module.customSections(r,e),[i]=n;return(0,P0.nonNullish)(i)?new TextDecoder().decode(i):void 0},e3r=$o(["stock","extended"]),ym=fn().refine(e=>/^\d+\.\d+\.\d+$/.test(e),{message:"Version does not match x.y.z format"}),hir=Jn({tag:ym,console:ym,observatory:ym.optional(),mission_control:ym,satellite:ym,orbiter:ym.optional(),sputnik:ym.optional()}),mir=gs(hir).min(1).refine(e=>new Set(e.map(({tag:t})=>t)).size===e.length,{message:"A release tag appears multiple times but must be unique"}),oH=gs(ym).min(1),t3r=Jn({mission_controls:oH,satellites:oH,orbiters:oH,releases:mir}),yir=({IDL:e})=>{let t=e.Record({fund_cycles:e.Nat,min_cycles:e.Nat}),r=e.Variant({BelowThreshold:t}),n=e.Record({strategy:e.Opt(r),enabled:e.Bool}),i=e.Record({cycles:e.Opt(n)}),s=e.Record({monitoring:e.Opt(i)}),o=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,settings:e.Opt(s)}),a=e.Record({subnet_id:e.Opt(e.Principal),name:e.Opt(e.Text)}),c=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal,settings:e.Opt(s)}),u=e.Record({cycles:e.Nat,destination_id:e.Principal}),l=e.Record({to:e.Opt(e.Text),enabled:e.Bool}),p=e.Record({notification:e.Opt(l),default_strategy:e.Opt(r)}),d=e.Record({cycles:e.Opt(p)}),f=e.Record({monitoring:e.Opt(d)}),h=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),segment_id:e.Principal}),m=e.Record({segment_id:e.Principal,created_at:e.Nat64,nonce:e.Int32}),y=e.Record({timestamp:e.Nat64,amount:e.Nat}),g=e.Variant({BalanceCheckFailed:e.Null,ObtainCyclesFailed:e.Null,DepositFailed:e.Null,InsufficientCycles:e.Null,Other:e.Text}),v=e.Record({timestamp:e.Nat64,error_code:g}),b=e.Record({deposited_cycles:e.Opt(y),cycles:y,funding_failure:e.Opt(v)}),x=e.Record({cycles:e.Opt(b)}),E=e.Record({monitored_ids:e.Vec(e.Principal),running:e.Bool}),P=e.Record({cycles:e.Opt(E)}),I=e.Record({updated_at:e.Nat64,created_at:e.Nat64,monitoring:e.Opt(i)}),L=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),user:e.Opt(e.Principal),created_at:e.Nat64,config:e.Opt(f)}),W=e.Record({e8s:e.Nat64}),he=e.Record({timestamp_nanos:e.Nat64}),ae=e.Record({to:e.Vec(e.Nat8),fee:W,memo:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(he),amount:W}),Ee=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:W}),TxDuplicate:e.Record({duplicate_of:e.Nat64}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:W})}),U=e.Variant({Ok:e.Nat64,Err:Ee}),R=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),ee=e.Record({to:R,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),H=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:e.Nat}),Duplicate:e.Record({duplicate_of:e.Nat}),BadFee:e.Record({expected_fee:e.Nat}),CreatedInFuture:e.Record({ledger_time:e.Nat64}),TooOld:e.Null,InsufficientFunds:e.Record({balance:e.Nat})}),D=e.Variant({Ok:e.Nat,Err:H}),j=e.Variant({Write:e.Null,Admin:e.Null,Submit:e.Null}),k=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:j,expires_at:e.Opt(e.Nat64)}),ie=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:j,expires_at:e.Opt(e.Nat64)}),ge=e.Record({ids:e.Vec(e.Principal),strategy:r}),Pe=e.Record({orbiters_strategy:e.Opt(ge),mission_control_strategy:e.Opt(r),satellites_strategy:e.Opt(ge)}),V=e.Record({cycles_config:e.Opt(Pe)}),C=e.Record({satellite_ids:e.Opt(e.Vec(e.Principal)),try_mission_control:e.Opt(e.Bool),orbiter_ids:e.Opt(e.Vec(e.Principal))}),_e=e.Record({cycles_config:e.Opt(C)});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)],[o],[]),create_orbiter_with_config:e.Func([a],[o],[]),create_satellite:e.Func([e.Text],[c],[]),create_satellite_with_config:e.Func([a],[c],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([u],[],[]),get_config:e.Func([],[e.Opt(f)],["query"]),get_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,e.Text))],["query"]),get_monitoring_history:e.Func([h],[e.Vec(e.Tuple(m,x))],["query"]),get_monitoring_status:e.Func([],[P],["query"]),get_settings:e.Func([],[e.Opt(I)],["query"]),get_user:e.Func([],[e.Principal],["query"]),get_user_data:e.Func([],[L],["query"]),icp_transfer:e.Func([ae],[U],[]),icrc_transfer:e.Func([e.Principal,ee],[D],[]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,k))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,c))],["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_config:e.Func([e.Opt(f)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),ie],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[o],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[o],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),ie],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[c],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[c],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),ie],[],[]),start_monitoring:e.Func([],[],[]),stop_monitoring:e.Func([],[],[]),top_up:e.Func([e.Principal,W],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),update_and_start_monitoring:e.Func([V],[],[]),update_and_stop_monitoring:e.Func([_e],[],[])})},gir=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null,Submit: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)}),i=e.Record({version:e.Opt(e.Nat64)}),s=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),a=e.Record({key:e.Text,collected_at:e.Nat64}),c=e.Record({os:e.Text,device:e.Opt(e.Text),browser:e.Text}),u=e.Record({utm_content:e.Opt(e.Text),utm_medium:e.Opt(e.Text),utm_source:e.Text,utm_term:e.Opt(e.Text),utm_campaign:e.Opt(e.Text)}),l=e.Record({inner_height:e.Nat16,screen_height:e.Opt(e.Nat16),screen_width:e.Opt(e.Nat16),inner_width:e.Nat16}),p=e.Record({client:e.Opt(c),title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,campaign:e.Opt(u),href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:l,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),d=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),f=e.Record({ios:e.Float64,macos:e.Float64,others:e.Float64,linux:e.Float64,android:e.Float64,windows:e.Float64}),h=e.Record({desktop:e.Float64,laptop:e.Opt(e.Float64),others:e.Float64,tablet:e.Opt(e.Float64),mobile:e.Float64}),m=e.Record({browsers:d,operating_systems:e.Opt(f),devices:h}),y=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),g=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(y,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),v=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32)),utm_campaigns:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32))),utm_sources:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32))),time_zones:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32)))}),b=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),x=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(b),delta:e.Float64}),E=e.Variant({WebVitalsMetric:x}),P=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),I=e.Record({updated_at:e.Nat64,session_id:e.Text,data:E,href:e.Text,metric_name:P,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),L=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),W=e.Record({overall:L,pages:e.Vec(e.Tuple(e.Text,L))}),he=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),ae=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),Ee=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),U=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),upgrade:e.Opt(e.Bool),status_code:e.Nat16}),R=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),ee=e.Record({updated_at:e.Nat64,features:e.Opt(R),restricted_origin:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),H=e.Record({stable:e.Nat64,heap:e.Nat64}),D=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),j=e.Record({controller:D,controllers:e.Vec(e.Principal)}),k=e.Record({client:e.Opt(c),title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,campaign:e.Opt(u),href:e.Text,satellite_id:e.Principal,device:l,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ie=e.Variant({Ok:p,Err:e.Text}),ge=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(a,e.Text))}),Pe=e.Record({session_id:e.Text,data:E,href:e.Text,metric_name:P,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),V=e.Variant({Ok:I,Err:e.Text}),C=e.Record({features:e.Opt(R),restricted_origin:e.Opt(e.Text),version:e.Opt(e.Nat64)}),_e=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),Se=e.Variant({Ok:he,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,i],[],[]),deposit_cycles:e.Func([s],[],[]),get_page_views:e.Func([o],[e.Vec(e.Tuple(a,p))],["query"]),get_page_views_analytics_clients:e.Func([o],[m],["query"]),get_page_views_analytics_metrics:e.Func([o],[g],["query"]),get_page_views_analytics_top_10:e.Func([o],[v],["query"]),get_performance_metrics:e.Func([o],[e.Vec(e.Tuple(a,I))],["query"]),get_performance_metrics_analytics_web_vitals:e.Func([o],[W],["query"]),get_track_events:e.Func([o],[e.Vec(e.Tuple(a,he))],["query"]),get_track_events_analytics:e.Func([o],[ae],["query"]),http_request:e.Func([Ee],[U],["query"]),http_request_update:e.Func([Ee],[U],[]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,ee))],["query"]),memory_size:e.Func([],[H],["query"]),set_controllers:e.Func([j],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([a,k],[ie],[]),set_page_views:e.Func([e.Vec(e.Tuple(a,k))],[ge],[]),set_performance_metric:e.Func([a,Pe],[V],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(a,Pe))],[ge],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,C))],[e.Vec(e.Tuple(e.Principal,ee))],[]),set_track_event:e.Func([a,_e],[Se],[]),set_track_events:e.Func([e.Vec(e.Tuple(a,_e))],[ge],[])})},bir=({IDL:e})=>{let t=e.Record({controllers:e.Vec(e.Principal)}),r=e.Variant({Write:e.Null,Admin:e.Null,Submit: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)}),i=e.Record({version:e.Opt(e.Nat64)}),s=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),a=e.Record({key:e.Text,collected_at:e.Nat64}),c=e.Record({os:e.Text,device:e.Opt(e.Text),browser:e.Text}),u=e.Record({utm_content:e.Opt(e.Text),utm_medium:e.Opt(e.Text),utm_source:e.Text,utm_term:e.Opt(e.Text),utm_campaign:e.Opt(e.Text)}),l=e.Record({inner_height:e.Nat16,screen_height:e.Opt(e.Nat16),screen_width:e.Opt(e.Nat16),inner_width:e.Nat16}),p=e.Record({client:e.Opt(c),title:e.Text,updated_at:e.Nat64,referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,campaign:e.Opt(u),href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:l,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),d=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),f=e.Record({ios:e.Float64,macos:e.Float64,others:e.Float64,linux:e.Float64,android:e.Float64,windows:e.Float64}),h=e.Record({desktop:e.Float64,laptop:e.Opt(e.Float64),others:e.Float64,tablet:e.Opt(e.Float64),mobile:e.Float64}),m=e.Record({browsers:d,operating_systems:e.Opt(f),devices:h}),y=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),g=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(y,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),v=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32)),utm_campaigns:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32))),utm_sources:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32))),time_zones:e.Opt(e.Vec(e.Tuple(e.Text,e.Nat32)))}),b=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),x=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(b),delta:e.Float64}),E=e.Variant({WebVitalsMetric:x}),P=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),I=e.Record({updated_at:e.Nat64,session_id:e.Text,data:E,href:e.Text,metric_name:P,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),L=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),W=e.Record({overall:L,pages:e.Vec(e.Tuple(e.Text,L))}),he=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),ae=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),Ee=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),U=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),upgrade:e.Opt(e.Bool),status_code:e.Nat16}),R=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),ee=e.Record({updated_at:e.Nat64,features:e.Opt(R),restricted_origin:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),H=e.Record({stable:e.Nat64,heap:e.Nat64}),D=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),j=e.Record({controller:D,controllers:e.Vec(e.Principal)}),k=e.Record({client:e.Opt(c),title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,campaign:e.Opt(u),href:e.Text,satellite_id:e.Principal,device:l,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ie=e.Variant({Ok:p,Err:e.Text}),ge=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(a,e.Text))}),Pe=e.Record({session_id:e.Text,data:E,href:e.Text,metric_name:P,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),V=e.Variant({Ok:I,Err:e.Text}),C=e.Record({features:e.Opt(R),restricted_origin:e.Opt(e.Text),version:e.Opt(e.Nat64)}),_e=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),Se=e.Variant({Ok:he,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,i],[],[]),deposit_cycles:e.Func([s],[],[]),get_page_views:e.Func([o],[e.Vec(e.Tuple(a,p))],[]),get_page_views_analytics_clients:e.Func([o],[m],[]),get_page_views_analytics_metrics:e.Func([o],[g],[]),get_page_views_analytics_top_10:e.Func([o],[v],[]),get_performance_metrics:e.Func([o],[e.Vec(e.Tuple(a,I))],[]),get_performance_metrics_analytics_web_vitals:e.Func([o],[W],[]),get_track_events:e.Func([o],[e.Vec(e.Tuple(a,he))],[]),get_track_events_analytics:e.Func([o],[ae],[]),http_request:e.Func([Ee],[U],[]),http_request_update:e.Func([Ee],[U],[]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],[]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,ee))],[]),memory_size:e.Func([],[H],[]),set_controllers:e.Func([j],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([a,k],[ie],[]),set_page_views:e.Func([e.Vec(e.Tuple(a,k))],[ge],[]),set_performance_metric:e.Func([a,Pe],[V],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(a,Pe))],[ge],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,C))],[e.Vec(e.Tuple(e.Principal,ee))],[]),set_track_event:e.Func([a,_e],[Se],[]),set_track_events:e.Func([e.Vec(e.Tuple(a,_e))],[ge],[])})},vir=({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)}),i=e.Record({updated_at:e.Opt(e.Nat64)}),s=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),o=e.Record({storage:s}),a=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),c=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),u=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}),l=e.Variant({Callback:e.Record({token:u,callback:e.Func([],[],[])})}),p=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(l),status_code:e.Nat16}),d=e.Record({token:e.Opt(u),body:e.Vec(e.Nat8)}),f=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),h=e.Record({batch_id:e.Nat}),m=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),y=e.Record({field:m,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),v=e.Record({order:e.Opt(y),owner:e.Opt(e.Principal),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),b=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),x=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),E=e.Record({key:b,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,x)),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,E))}),I=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),L=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,a))}),W=e.Variant({Db:e.Null,Storage:e.Null}),he=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),ae=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:he,created_at:e.Nat64,write:he}),Ee=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),U=e.Record({controller:Ee,controllers:e.Vec(e.Principal)}),R=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),ee=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:he,write:he}),H=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),D=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),get_config:e.Func([],[o],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(a)],["query"]),http_request:e.Func([c],[p],["query"]),http_request_streaming_callback:e.Func([u],[d],["query"]),init_asset_upload:e.Func([f],[h],[]),list_assets:e.Func([e.Opt(e.Text),v],[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,I))],["query"]),list_docs:e.Func([e.Text,v],[L],["query"]),list_rules:e.Func([W],[e.Vec(e.Tuple(e.Text,ae))],["query"]),set_config:e.Func([o],[],[]),set_controllers:e.Func([U],[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,R],[a],[]),set_rule:e.Func([W,e.Text,ee],[],[]),upload_asset_chunk:e.Func([H],[D],[]),version:e.Func([],[e.Text],["query"])})},_ir=({IDL:e})=>{let t=e.Record({batch_id:e.Nat,headers:e.Vec(e.Tuple(e.Text,e.Text)),chunk_ids:e.Vec(e.Nat)}),r=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),n=e.Record({field:r,desc:e.Bool}),i=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),s=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(i),description:e.Opt(e.Text),created_at:e.Opt(i)}),o=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),a=e.Record({order:e.Opt(n),owner:e.Opt(e.Principal),matcher:e.Opt(s),paginate:e.Opt(o)}),c=e.Record({controllers:e.Vec(e.Principal)}),u=e.Variant({Write:e.Null,Admin:e.Null}),l=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:u,expires_at:e.Opt(e.Nat64)}),p=e.Record({version:e.Opt(e.Nat64)}),d=e.Variant({Db:e.Null,Storage:e.Null}),f=e.Record({version:e.Opt(e.Nat64)}),h=e.Record({cycles:e.Nat,destination_id:e.Principal}),m=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,description:e.Opt(e.Text),full_path:e.Text}),y=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),g=e.Record({key:m,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,y)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),v=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),b=e.Record({internet_identity:e.Opt(v)}),x=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),E=e.Record({max_memory_size:e.Opt(x)}),P=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),I=e.Variant({Deny:e.Null,Allow:e.Null}),L=e.Record({status_code:e.Nat16,location:e.Text}),W=e.Record({iframe:e.Opt(P),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),max_memory_size:e.Opt(x),raw_access:e.Opt(I),redirects:e.Opt(e.Vec(e.Tuple(e.Text,L)))}),he=e.Record({db:e.Opt(E),authentication:e.Opt(b),storage:W}),ae=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),Ee=e.Variant({Heap:e.Null,Stable:e.Null}),U=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),R=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),ee=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(Ee),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:U,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(R),write:U,max_changes_per_user:e.Opt(e.Nat32)}),H=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),D=e.Record({memory:Ee,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}),j=e.Variant({Callback:e.Record({token:D,callback:e.Func([],[],["query"])})}),k=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(j),status_code:e.Nat16}),ie=e.Record({token:e.Opt(D),body:e.Vec(e.Nat8)}),ge=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}),Pe=e.Record({batch_id:e.Nat}),V=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,g)),items_length:e.Nat64}),C=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),_e=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,ae)),items_length:e.Nat64}),Se=e.Record({stable:e.Nat64,heap:e.Nat64}),De=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:u,expires_at:e.Opt(e.Nat64)}),Oe=e.Record({controller:De,controllers:e.Vec(e.Principal)}),S=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),N=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(Ee),max_size:e.Opt(e.Nat),read:U,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(R),write:U,max_changes_per_user:e.Opt(e.Nat32)}),$=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),oe=e.Record({chunk_id:e.Nat});return e.Service({build_version:e.Func([],[e.Text],["query"]),commit_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,a],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,a],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([c],[e.Vec(e.Tuple(e.Principal,l))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,p],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,a],[],[]),del_filtered_docs:e.Func([e.Text,a],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,p))],[],[]),del_rule:e.Func([d,e.Text,f],[],[]),deposit_cycles:e.Func([h],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(g)],["query"]),get_auth_config:e.Func([],[e.Opt(b)],["query"]),get_config:e.Func([],[he],[]),get_db_config:e.Func([],[e.Opt(E)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(ae)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(g)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(ae)))],["query"]),get_rule:e.Func([d,e.Text],[e.Opt(ee)],["query"]),get_storage_config:e.Func([],[W],["query"]),http_request:e.Func([H],[k],["query"]),http_request_streaming_callback:e.Func([D],[ie],["query"]),init_asset_upload:e.Func([ge],[Pe],[]),list_assets:e.Func([e.Text,a],[V],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,l))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,C))],["query"]),list_docs:e.Func([e.Text,a],[_e],["query"]),list_rules:e.Func([d],[e.Vec(e.Tuple(e.Text,ee))],["query"]),memory_size:e.Func([],[Se],["query"]),set_auth_config:e.Func([b],[],[]),set_controllers:e.Func([Oe],[e.Vec(e.Tuple(e.Principal,l))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([E],[],[]),set_doc:e.Func([e.Text,e.Text,S],[ae],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,S))],[e.Vec(e.Tuple(e.Text,ae))],[]),set_rule:e.Func([d,e.Text,N],[ee],[]),set_storage_config:e.Func([W],[],[]),upload_asset_chunk:e.Func([$],[oe],[]),version:e.Func([],[e.Text],["query"])})},xir=({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)}),i=e.Record({version:e.Opt(e.Nat64)}),s=e.Record({cycles:e.Nat,destination_id:e.Principal}),o=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),satellite_id:e.Opt(e.Principal)}),a=e.Record({key:e.Text,collected_at:e.Nat64}),c=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,session_id:e.Text,href:e.Text,created_at:e.Nat64,satellite_id:e.Principal,device:c,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),l=e.Record({safari:e.Float64,opera:e.Float64,others:e.Float64,firefox:e.Float64,chrome:e.Float64}),p=e.Record({desktop:e.Float64,others:e.Float64,mobile:e.Float64}),d=e.Record({browsers:l,devices:p}),f=e.Record({day:e.Nat8,month:e.Nat8,year:e.Int32}),h=e.Record({bounce_rate:e.Float64,average_page_views_per_session:e.Float64,daily_total_page_views:e.Vec(e.Tuple(f,e.Nat32)),total_page_views:e.Nat32,unique_page_views:e.Nat64,unique_sessions:e.Nat64}),m=e.Record({referrers:e.Vec(e.Tuple(e.Text,e.Nat32)),pages:e.Vec(e.Tuple(e.Text,e.Nat32))}),y=e.Variant({Navigate:e.Null,Restore:e.Null,Reload:e.Null,BackForward:e.Null,BackForwardCache:e.Null,Prerender:e.Null}),g=e.Record({id:e.Text,value:e.Float64,navigation_type:e.Opt(y),delta:e.Float64}),v=e.Variant({WebVitalsMetric:g}),b=e.Variant({CLS:e.Null,FCP:e.Null,INP:e.Null,LCP:e.Null,TTFB:e.Null}),x=e.Record({updated_at:e.Nat64,session_id:e.Text,data:v,href:e.Text,metric_name:b,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),E=e.Record({cls:e.Opt(e.Float64),fcp:e.Opt(e.Float64),inp:e.Opt(e.Float64),lcp:e.Opt(e.Float64),ttfb:e.Opt(e.Float64)}),P=e.Record({overall:E,pages:e.Vec(e.Tuple(e.Text,E))}),I=e.Record({updated_at:e.Nat64,session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,created_at:e.Nat64,satellite_id:e.Principal,version:e.Opt(e.Nat64)}),L=e.Record({total:e.Vec(e.Tuple(e.Text,e.Nat32))}),W=e.Record({performance_metrics:e.Bool,track_events:e.Bool,page_views:e.Bool}),he=e.Record({updated_at:e.Nat64,features:e.Opt(W),created_at:e.Nat64,version:e.Opt(e.Nat64)}),ae=e.Record({stable:e.Nat64,heap:e.Nat64}),Ee=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:r,expires_at:e.Opt(e.Nat64)}),U=e.Record({controller:Ee,controllers:e.Vec(e.Principal)}),R=e.Record({title:e.Text,updated_at:e.Opt(e.Nat64),referrer:e.Opt(e.Text),time_zone:e.Text,session_id:e.Text,href:e.Text,satellite_id:e.Principal,device:c,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ee=e.Variant({Ok:u,Err:e.Text}),H=e.Variant({Ok:e.Null,Err:e.Vec(e.Tuple(a,e.Text))}),D=e.Record({session_id:e.Text,data:v,href:e.Text,metric_name:b,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),j=e.Variant({Ok:x,Err:e.Text}),k=e.Record({features:e.Opt(W),version:e.Opt(e.Nat64)}),ie=e.Record({updated_at:e.Opt(e.Nat64),session_id:e.Text,metadata:e.Opt(e.Vec(e.Tuple(e.Text,e.Text))),name:e.Text,satellite_id:e.Principal,version:e.Opt(e.Nat64),user_agent:e.Opt(e.Text)}),ge=e.Variant({Ok:I,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,i],[],[]),deposit_cycles:e.Func([s],[],[]),get_page_views:e.Func([o],[e.Vec(e.Tuple(a,u))],["query"]),get_page_views_analytics_clients:e.Func([o],[d],["query"]),get_page_views_analytics_metrics:e.Func([o],[h],["query"]),get_page_views_analytics_top_10:e.Func([o],[m],["query"]),get_performance_metrics:e.Func([o],[e.Vec(e.Tuple(a,x))],["query"]),get_performance_metrics_analytics_web_vitals:e.Func([o],[P],["query"]),get_track_events:e.Func([o],[e.Vec(e.Tuple(a,I))],["query"]),get_track_events_analytics:e.Func([o],[L],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,n))],["query"]),list_satellite_configs:e.Func([],[e.Vec(e.Tuple(e.Principal,he))],["query"]),memory_size:e.Func([],[ae],["query"]),set_controllers:e.Func([U],[e.Vec(e.Tuple(e.Principal,n))],[]),set_page_view:e.Func([a,R],[ee],[]),set_page_views:e.Func([e.Vec(e.Tuple(a,R))],[H],[]),set_performance_metric:e.Func([a,D],[j],[]),set_performance_metrics:e.Func([e.Vec(e.Tuple(a,D))],[H],[]),set_satellite_configs:e.Func([e.Vec(e.Tuple(e.Principal,k))],[e.Vec(e.Tuple(e.Principal,he))],[]),set_track_event:e.Func([a,ie],[ge],[]),set_track_events:e.Func([e.Vec(e.Tuple(a,ie))],[H],[]),version:e.Func([],[e.Text],["query"])})},Eir=({IDL:e})=>{let t=e.Record({fund_cycles:e.Nat,min_cycles:e.Nat}),r=e.Variant({BelowThreshold:t}),n=e.Record({strategy:e.Opt(r),enabled:e.Bool}),i=e.Record({cycles:e.Opt(n)}),s=e.Record({monitoring:e.Opt(i)}),o=e.Record({updated_at:e.Nat64,orbiter_id:e.Principal,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,settings:e.Opt(s)}),a=e.Record({subnet_id:e.Opt(e.Principal),name:e.Opt(e.Text)}),c=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,satellite_id:e.Principal,settings:e.Opt(s)}),u=e.Record({cycles:e.Nat,destination_id:e.Principal}),l=e.Record({to:e.Opt(e.Text),enabled:e.Bool}),p=e.Record({notification:e.Opt(l),default_strategy:e.Opt(r)}),d=e.Record({cycles:e.Opt(p)}),f=e.Record({monitoring:e.Opt(d)}),h=e.Record({to:e.Opt(e.Nat64),from:e.Opt(e.Nat64),segment_id:e.Principal}),m=e.Record({segment_id:e.Principal,created_at:e.Nat64,nonce:e.Int32}),y=e.Record({timestamp:e.Nat64,amount:e.Nat}),g=e.Record({deposited_cycles:e.Opt(y),cycles:y}),v=e.Record({cycles:e.Opt(g)}),b=e.Record({monitored_ids:e.Vec(e.Principal),running:e.Bool}),x=e.Record({cycles:e.Opt(b)}),E=e.Record({updated_at:e.Nat64,created_at:e.Nat64,monitoring:e.Opt(i)}),P=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),user:e.Opt(e.Principal),created_at:e.Nat64,config:e.Opt(f)}),I=e.Record({e8s:e.Nat64}),L=e.Record({timestamp_nanos:e.Nat64}),W=e.Record({to:e.Vec(e.Nat8),fee:I,memo:e.Nat64,from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(L),amount:I}),he=e.Variant({TxTooOld:e.Record({allowed_window_nanos:e.Nat64}),BadFee:e.Record({expected_fee:I}),TxDuplicate:e.Record({duplicate_of:e.Nat64}),TxCreatedInFuture:e.Null,InsufficientFunds:e.Record({balance:I})}),ae=e.Variant({Ok:e.Nat64,Err:he}),Ee=e.Record({owner:e.Principal,subaccount:e.Opt(e.Vec(e.Nat8))}),U=e.Record({to:Ee,fee:e.Opt(e.Nat),memo:e.Opt(e.Vec(e.Nat8)),from_subaccount:e.Opt(e.Vec(e.Nat8)),created_at_time:e.Opt(e.Nat64),amount:e.Nat}),R=e.Variant({GenericError:e.Record({message:e.Text,error_code:e.Nat}),TemporarilyUnavailable:e.Null,BadBurn:e.Record({min_burn_amount:e.Nat}),Duplicate:e.Record({duplicate_of:e.Nat}),BadFee:e.Record({expected_fee:e.Nat}),CreatedInFuture:e.Record({ledger_time:e.Nat64}),TooOld:e.Null,InsufficientFunds:e.Record({balance:e.Nat})}),ee=e.Variant({Ok:e.Nat,Err:R}),H=e.Variant({Write:e.Null,Admin:e.Null}),D=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:H,expires_at:e.Opt(e.Nat64)}),j=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:H,expires_at:e.Opt(e.Nat64)}),k=e.Record({ids:e.Vec(e.Principal),strategy:r}),ie=e.Record({orbiters_strategy:e.Opt(k),mission_control_strategy:e.Opt(r),satellites_strategy:e.Opt(k)}),ge=e.Record({cycles_config:e.Opt(ie)}),Pe=e.Record({satellite_ids:e.Opt(e.Vec(e.Principal)),try_mission_control:e.Opt(e.Bool),orbiter_ids:e.Opt(e.Vec(e.Principal))}),V=e.Record({cycles_config:e.Opt(Pe)});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)],[o],[]),create_orbiter_with_config:e.Func([a],[o],[]),create_satellite:e.Func([e.Text],[c],[]),create_satellite_with_config:e.Func([a],[c],[]),del_mission_control_controllers:e.Func([e.Vec(e.Principal)],[],[]),del_orbiter:e.Func([e.Principal,e.Nat],[],[]),del_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),del_satellite:e.Func([e.Principal,e.Nat],[],[]),del_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal)],[],[]),deposit_cycles:e.Func([u],[],[]),get_config:e.Func([],[e.Opt(f)],["query"]),get_metadata:e.Func([],[e.Vec(e.Tuple(e.Text,e.Text))],["query"]),get_monitoring_history:e.Func([h],[e.Vec(e.Tuple(m,v))],["query"]),get_monitoring_status:e.Func([],[x],["query"]),get_settings:e.Func([],[e.Opt(E)],["query"]),get_user:e.Func([],[e.Principal],["query"]),get_user_data:e.Func([],[P],["query"]),icp_transfer:e.Func([W],[ae],[]),icrc_transfer:e.Func([e.Principal,U],[ee],[]),list_mission_control_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,D))],["query"]),list_orbiters:e.Func([],[e.Vec(e.Tuple(e.Principal,o))],["query"]),list_satellites:e.Func([],[e.Vec(e.Tuple(e.Principal,c))],["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_config:e.Func([e.Opt(f)],[],[]),set_metadata:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),set_mission_control_controllers:e.Func([e.Vec(e.Principal),j],[],[]),set_orbiter:e.Func([e.Principal,e.Opt(e.Text)],[o],[]),set_orbiter_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[o],[]),set_orbiters_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),j],[],[]),set_satellite:e.Func([e.Principal,e.Opt(e.Text)],[c],[]),set_satellite_metadata:e.Func([e.Principal,e.Vec(e.Tuple(e.Text,e.Text))],[c],[]),set_satellites_controllers:e.Func([e.Vec(e.Principal),e.Vec(e.Principal),j],[],[]),start_monitoring:e.Func([],[],[]),stop_monitoring:e.Func([],[],[]),top_up:e.Func([e.Principal,I],[],[]),unset_orbiter:e.Func([e.Principal],[],[]),unset_satellite:e.Func([e.Principal],[],[]),update_and_start_monitoring:e.Func([ge],[],[]),update_and_stop_monitoring:e.Func([V],[],[]),version:e.Func([],[e.Text],["query"])})},wir=({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)}),i=e.Record({updated_at:e.Opt(e.Nat64)}),s=e.Record({headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text))))}),o=e.Record({storage:s}),a=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),created_at:e.Nat64}),c=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text))}),u=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}),l=e.Variant({Callback:e.Record({token:u,callback:e.Func([],[],[])})}),p=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(l),status_code:e.Nat16}),d=e.Record({token:e.Opt(u),body:e.Vec(e.Nat8)}),f=e.Record({token:e.Opt(e.Text),collection:e.Text,name:e.Text,encoding_type:e.Opt(e.Text),full_path:e.Text}),h=e.Record({batch_id:e.Nat}),m=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),y=e.Record({field:m,desc:e.Bool}),g=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),v=e.Record({order:e.Opt(y),matcher:e.Opt(e.Text),paginate:e.Opt(g)}),b=e.Record({token:e.Opt(e.Text),collection:e.Text,owner:e.Principal,name:e.Text,full_path:e.Text}),x=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),E=e.Record({key:b,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,x)),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,E))}),I=e.Record({updated_at:e.Nat64,created_at:e.Nat64,bn_id:e.Opt(e.Text)}),L=e.Record({matches_length:e.Nat64,length:e.Nat64,items:e.Vec(e.Tuple(e.Text,a))}),W=e.Variant({Db:e.Null,Storage:e.Null}),he=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),ae=e.Record({updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:he,created_at:e.Nat64,write:he}),Ee=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),expires_at:e.Opt(e.Nat64)}),U=e.Record({controller:Ee,controllers:e.Vec(e.Principal)}),R=e.Record({updated_at:e.Opt(e.Nat64),data:e.Vec(e.Nat8)}),ee=e.Record({updated_at:e.Opt(e.Nat64),max_size:e.Opt(e.Nat),read:he,write:he}),H=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat}),D=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Opt(e.Text)],[],[]),del_controllers:e.Func([r],[e.Vec(e.Tuple(e.Principal,n))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,i],[],[]),get_config:e.Func([],[o],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(a)],["query"]),http_request:e.Func([c],[p],["query"]),http_request_streaming_callback:e.Func([u],[d],["query"]),init_asset_upload:e.Func([f],[h],[]),list_assets:e.Func([e.Opt(e.Text),v],[P],["query"]),list_controllers:e.Func([],[e.Vec(e.Principal)],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,I))],["query"]),list_docs:e.Func([e.Text,v],[L],["query"]),list_rules:e.Func([W],[e.Vec(e.Tuple(e.Text,ae))],["query"]),set_config:e.Func([o],[],[]),set_controllers:e.Func([U],[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,R],[a],[]),set_rule:e.Func([W,e.Text,ee],[],[]),upload_asset_chunk:e.Func([H],[D],[]),version:e.Func([],[e.Text],["query"])})},Tir=({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({sha256:e.Vec(e.Nat8),proposal_id:e.Nat}),n=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),i=e.Record({field:n,desc:e.Bool}),s=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),o=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(s),description:e.Opt(e.Text),created_at:e.Opt(s)}),a=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),c=e.Record({order:e.Opt(i),owner:e.Opt(e.Principal),matcher:e.Opt(o),paginate:e.Opt(a)}),u=e.Record({controllers:e.Vec(e.Principal)}),l=e.Variant({Write:e.Null,Admin:e.Null,Submit:e.Null}),p=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:l,expires_at:e.Opt(e.Nat64)}),d=e.Record({version:e.Opt(e.Nat64)}),f=e.Variant({Db:e.Null,Storage:e.Null}),h=e.Record({version:e.Opt(e.Nat64)}),m=e.Record({proposal_ids:e.Vec(e.Nat)}),y=e.Record({cycles:e.Nat,destination_id:e.Principal}),g=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}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),b=e.Record({key:g,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),x=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),E=e.Record({allowed_callers:e.Vec(e.Principal)}),P=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),I=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),L=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),W=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),he=e.Variant({Deny:e.Null,Allow:e.Null}),ae=e.Record({status_code:e.Nat16,location:e.Text}),Ee=e.Record({iframe:e.Opt(W),updated_at:e.Opt(e.Nat64),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),U=e.Record({db:e.Opt(L),authentication:e.Opt(P),storage:Ee}),R=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),ee=e.Variant({Initialized:e.Null,Failed:e.Null,Open:e.Null,Rejected:e.Null,Executed:e.Null,Accepted:e.Null}),H=e.Record({clear_existing_assets:e.Opt(e.Bool)}),D=e.Record({orbiter:e.Opt(e.Text),mission_control_version:e.Opt(e.Text),satellite_version:e.Opt(e.Text)}),j=e.Variant({AssetsUpgrade:H,SegmentsDeployment:D}),k=e.Record({status:ee,updated_at:e.Nat64,sha256:e.Opt(e.Vec(e.Nat8)),executed_at:e.Opt(e.Nat64),owner:e.Principal,created_at:e.Nat64,version:e.Opt(e.Nat64),proposal_type:j}),ie=e.Variant({Heap:e.Null,Stable:e.Null}),ge=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Pe=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),V=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:ge,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),C=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),_e=e.Record({memory:ie,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}),Se=e.Variant({Callback:e.Record({token:_e,callback:e.Func([],[],["query"])})}),De=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Se),status_code:e.Nat16}),Oe=e.Record({token:e.Opt(_e),body:e.Vec(e.Nat8)}),S=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}),N=e.Record({batch_id:e.Nat}),$=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,b)),items_length:e.Nat64}),oe=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),se=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,R)),items_length:e.Nat64}),ue=e.Record({desc:e.Bool}),be=e.Record({start_after:e.Opt(e.Nat),limit:e.Opt(e.Nat)}),A=e.Record({order:e.Opt(ue),paginate:e.Opt(be)}),F=e.Record({proposal_id:e.Nat}),Q=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(F,k)),items_length:e.Nat64}),te=e.Record({include_system:e.Bool}),xe=e.Record({matcher:e.Opt(te)}),Te=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(e.Text,V)),items_length:e.Nat64}),$e=e.Record({stable:e.Nat64,heap:e.Nat64}),ot=e.Record({version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),pt=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:l,expires_at:e.Opt(e.Nat64)}),gt=e.Record({controller:pt,controllers:e.Vec(e.Principal)}),ct=e.Record({version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),Ye=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Zt=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),max_size:e.Opt(e.Nat),read:ge,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),Yt=e.Record({iframe:e.Opt(W),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),Wt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Lt=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),commit_proposal:e.Func([r],[e.Null],[]),commit_proposal_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,c],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,c],[e.Nat64],["query"]),count_proposals:e.Func([],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([u],[e.Vec(e.Tuple(e.Principal,p))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,d],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,c],[],[]),del_filtered_docs:e.Func([e.Text,c],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,d))],[],[]),del_rule:e.Func([f,e.Text,h],[],[]),delete_proposal_assets:e.Func([m],[],[]),deposit_cycles:e.Func([y],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(b)],["query"]),get_auth_config:e.Func([],[e.Opt(P)],["query"]),get_config:e.Func([],[U],[]),get_db_config:e.Func([],[e.Opt(L)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(R)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(b)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(R)))],["query"]),get_proposal:e.Func([e.Nat],[e.Opt(k)],["query"]),get_rule:e.Func([f,e.Text],[e.Opt(V)],["query"]),get_storage_config:e.Func([],[Ee],["query"]),http_request:e.Func([C],[De],["query"]),http_request_streaming_callback:e.Func([_e],[Oe],["query"]),init_asset_upload:e.Func([S],[N],[]),init_proposal:e.Func([j],[e.Nat,k],[]),init_proposal_asset_upload:e.Func([S,e.Nat],[N],[]),list_assets:e.Func([e.Text,c],[$],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,p))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,oe))],["query"]),list_docs:e.Func([e.Text,c],[se],["query"]),list_proposals:e.Func([A],[Q],["query"]),list_rules:e.Func([f,xe],[Te],["query"]),memory_size:e.Func([],[$e],["query"]),reject_proposal:e.Func([r],[e.Null],[]),set_auth_config:e.Func([ot],[P],[]),set_controllers:e.Func([gt],[e.Vec(e.Tuple(e.Principal,p))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([ct],[L],[]),set_doc:e.Func([e.Text,e.Text,Ye],[R],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ye))],[e.Vec(e.Tuple(e.Text,R))],[]),set_rule:e.Func([f,e.Text,Zt],[V],[]),set_storage_config:e.Func([Yt],[Ee],[]),submit_proposal:e.Func([e.Nat],[e.Nat,k],[]),upload_asset_chunk:e.Func([Wt],[Lt],[]),upload_proposal_asset_chunk:e.Func([Wt],[Lt],[])})},Sir=({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({sha256:e.Vec(e.Nat8),proposal_id:e.Nat}),n=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),i=e.Record({field:n,desc:e.Bool}),s=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),o=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(s),description:e.Opt(e.Text),created_at:e.Opt(s)}),a=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),c=e.Record({order:e.Opt(i),owner:e.Opt(e.Principal),matcher:e.Opt(o),paginate:e.Opt(a)}),u=e.Record({controllers:e.Vec(e.Principal)}),l=e.Variant({Write:e.Null,Admin:e.Null,Submit:e.Null}),p=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:l,expires_at:e.Opt(e.Nat64)}),d=e.Record({version:e.Opt(e.Nat64)}),f=e.Variant({Db:e.Null,Storage:e.Null}),h=e.Record({version:e.Opt(e.Nat64)}),m=e.Record({proposal_ids:e.Vec(e.Nat)}),y=e.Record({cycles:e.Nat,destination_id:e.Principal}),g=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}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),b=e.Record({key:g,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),x=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),E=e.Record({allowed_callers:e.Vec(e.Principal)}),P=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),I=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),L=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),W=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),he=e.Variant({Deny:e.Null,Allow:e.Null}),ae=e.Record({status_code:e.Nat16,location:e.Text}),Ee=e.Record({iframe:e.Opt(W),updated_at:e.Opt(e.Nat64),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),U=e.Record({db:e.Opt(L),authentication:e.Opt(P),storage:Ee}),R=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),ee=e.Variant({Initialized:e.Null,Failed:e.Null,Open:e.Null,Rejected:e.Null,Executed:e.Null,Accepted:e.Null}),H=e.Record({clear_existing_assets:e.Opt(e.Bool)}),D=e.Record({orbiter:e.Opt(e.Text),mission_control_version:e.Opt(e.Text),satellite_version:e.Opt(e.Text)}),j=e.Variant({AssetsUpgrade:H,SegmentsDeployment:D}),k=e.Record({status:ee,updated_at:e.Nat64,sha256:e.Opt(e.Vec(e.Nat8)),executed_at:e.Opt(e.Nat64),owner:e.Principal,created_at:e.Nat64,version:e.Opt(e.Nat64),proposal_type:j}),ie=e.Variant({Heap:e.Null,Stable:e.Null}),ge=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Pe=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),V=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:ge,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),C=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),_e=e.Record({memory:ie,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}),Se=e.Variant({Callback:e.Record({token:_e,callback:e.Func([],[],[])})}),De=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Se),status_code:e.Nat16}),Oe=e.Record({token:e.Opt(_e),body:e.Vec(e.Nat8)}),S=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}),N=e.Record({batch_id:e.Nat}),$=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,b)),items_length:e.Nat64}),oe=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),se=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,R)),items_length:e.Nat64}),ue=e.Record({desc:e.Bool}),be=e.Record({start_after:e.Opt(e.Nat),limit:e.Opt(e.Nat)}),A=e.Record({order:e.Opt(ue),paginate:e.Opt(be)}),F=e.Record({proposal_id:e.Nat}),Q=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(F,k)),items_length:e.Nat64}),te=e.Record({include_system:e.Bool}),xe=e.Record({matcher:e.Opt(te)}),Te=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(e.Text,V)),items_length:e.Nat64}),$e=e.Record({stable:e.Nat64,heap:e.Nat64}),ot=e.Record({version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),pt=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:l,expires_at:e.Opt(e.Nat64)}),gt=e.Record({controller:pt,controllers:e.Vec(e.Principal)}),ct=e.Record({version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),Ye=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Zt=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),max_size:e.Opt(e.Nat),read:ge,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),Yt=e.Record({iframe:e.Opt(W),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),Wt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Lt=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),commit_proposal:e.Func([r],[e.Null],[]),commit_proposal_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,c],[e.Nat64],[]),count_collection_assets:e.Func([e.Text],[e.Nat64],[]),count_collection_docs:e.Func([e.Text],[e.Nat64],[]),count_docs:e.Func([e.Text,c],[e.Nat64],[]),count_proposals:e.Func([],[e.Nat64],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([u],[e.Vec(e.Tuple(e.Principal,p))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,d],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,c],[],[]),del_filtered_docs:e.Func([e.Text,c],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,d))],[],[]),del_rule:e.Func([f,e.Text,h],[],[]),delete_proposal_assets:e.Func([m],[],[]),deposit_cycles:e.Func([y],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(b)],[]),get_auth_config:e.Func([],[e.Opt(P)],[]),get_config:e.Func([],[U],[]),get_db_config:e.Func([],[e.Opt(L)],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(R)],[]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(b)))],[]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(R)))],[]),get_proposal:e.Func([e.Nat],[e.Opt(k)],[]),get_rule:e.Func([f,e.Text],[e.Opt(V)],[]),get_storage_config:e.Func([],[Ee],[]),http_request:e.Func([C],[De],[]),http_request_streaming_callback:e.Func([_e],[Oe],[]),init_asset_upload:e.Func([S],[N],[]),init_proposal:e.Func([j],[e.Nat,k],[]),init_proposal_asset_upload:e.Func([S,e.Nat],[N],[]),list_assets:e.Func([e.Text,c],[$],[]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,p))],[]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,oe))],[]),list_docs:e.Func([e.Text,c],[se],[]),list_proposals:e.Func([A],[Q],[]),list_rules:e.Func([f,xe],[Te],[]),memory_size:e.Func([],[$e],[]),reject_proposal:e.Func([r],[e.Null],[]),set_auth_config:e.Func([ot],[P],[]),set_controllers:e.Func([gt],[e.Vec(e.Tuple(e.Principal,p))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([ct],[L],[]),set_doc:e.Func([e.Text,e.Text,Ye],[R],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ye))],[e.Vec(e.Tuple(e.Text,R))],[]),set_rule:e.Func([f,e.Text,Zt],[V],[]),set_storage_config:e.Func([Yt],[Ee],[]),submit_proposal:e.Func([e.Nat],[e.Nat,k],[]),upload_asset_chunk:e.Func([Wt],[Lt],[]),upload_proposal_asset_chunk:e.Func([Wt],[Lt],[])})},Pir=async({identity:e,host:t,localActor:r})=>await OCe.HttpAgent.create({identity:e,host:t,retryTimes:10,shouldFetchRootKey:r}),mu=async({agent:e,...t})=>e??await Air(t),Air=async({identity:e,container:t})=>{let r=(0,ACe.nonNullish)(t)&&t!==!1;return await Pir({identity:e,host:r?t===!0?"http://127.0.0.1:5987":t:"https://icp-api.io",localActor:r})},Oir=({satelliteId:e,...t})=>bm({canisterId:e,...t,idlFactory:wir}),xc=({satelliteId:e,certified:t=!1,...r})=>bm({canisterId:e,...r,idlFactory:t?Sir:Tir}),Dir=({satelliteId:e,...t})=>bm({canisterId:e,...t,idlFactory:vir}),Cir=({satelliteId:e,...t})=>bm({canisterId:e,...t,idlFactory:_ir}),Iir=({missionControlId:e,...t})=>bm({canisterId:e,...t,idlFactory:yir}),Nir=({missionControlId:e,...t})=>bm({canisterId:e,...t,idlFactory:Eir}),Fir=({orbiterId:e,certified:t=!1,...r})=>bm({canisterId:e,...r,idlFactory:t?bir:gir}),kir=({orbiterId:e,...t})=>bm({canisterId:e,...t,idlFactory:xir}),bm=({canisterId:e,idlFactory:t,...r})=>{if((0,PCe.isNullish)(e))throw new Error("No canister ID provided.");return Rir({canisterId:e,idlFactory:t,...r})},Rir=async({canisterId:e,idlFactory:t,config:r,...n})=>{let i=await mu(n);return SCe.Actor.createActor(t,{agent:i,canisterId:e,...r??{}})},jir=async({missionControl:e})=>{let{version:t}=await Nir(e);return t()},$ir=async({missionControl:e})=>{let{get_user:t}=await Iir(e);return t()};var cH={reinstall:null},UF={upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]},Mir=async({canisterId:e,actor:t})=>{let r=await mu(t),{stopCanister:n}=yl.ICManagementCanister.create({agent:r});await n(e)},Lir=async({canisterId:e,actor:t})=>{let r=await mu(t),{startCanister:n}=yl.ICManagementCanister.create({agent:r});await n(e)},Uir=async({actor:e,code:t})=>{let r=await mu(e),{installCode:n}=yl.ICManagementCanister.create({agent:r});return n(t)},qir=async({actor:e,canisterId:t})=>{let r=await mu(e),{storedChunks:n}=yl.ICManagementCanister.create({agent:r});return n({canisterId:t})},aH=async({actor:e,canisterId:t})=>{let r=await mu(e),{clearChunkStore:n}=yl.ICManagementCanister.create({agent:r});return n({canisterId:t})},zir=async({actor:e,chunk:t})=>{let r=await mu(e),{uploadChunk:n}=yl.ICManagementCanister.create({agent:r});return n(t)},Vir=async({actor:e,code:t})=>{let r=await mu(e),{installChunkedCode:n}=yl.ICManagementCanister.create({agent:r});return n(t)},Zir=async({actor:e,canisterId:t})=>{let r=await mu(e),{canisterStatus:n}=yl.ICManagementCanister.create({agent:r});return n(t)},NCe=async({canisterId:e,path:t,...r})=>{let n=await mu(r),i=globalThis.console.warn;globalThis.console.warn=()=>null;let s=await ICe.CanisterStatus.request({canisterId:e instanceof uH.Principal?e:uH.Principal.fromText(e),agent:n,paths:[{kind:"metadata",key:t,path:t,decodeStrategy:"utf-8"}]});return globalThis.console.warn=i,s.get(t)},Wir=async({actor:e,canisterId:t})=>{let r=await mu(e),{listCanisterSnapshots:n}=yl.ICManagementCanister.create({agent:r});return n({canisterId:t})},Kir=async({actor:e,...t})=>{let r=await mu(e),{takeCanisterSnapshot:n}=yl.ICManagementCanister.create({agent:r});return n(t)},A0=(e=>(e[e.AssertingExistingCode=0]="AssertingExistingCode",e[e.StoppingCanister=1]="StoppingCanister",e[e.TakingSnapshot=2]="TakingSnapshot",e[e.UpgradingCode=3]="UpgradingCode",e[e.RestartingCanister=4]="RestartingCanister",e))(A0||{}),Hir=async({actor:e,canisterId:t,missionControlId:r,wasmModule:n,preClearChunks:i,...s})=>{i&&await aH({actor:e,canisterId:t});let o=await Gir({wasmModule:n}),{uploadChunks:a,storedChunks:c,preClearChunks:u,postClearChunks:l}=await Yir({actor:e,wasmChunks:o,canisterId:t,missionControlId:r});u&&await aH({actor:e,canisterId:t});let p=[];for await(let d of Jir({uploadChunks:a,actor:e,canisterId:t,missionControlId:r}))p=[...p,...d];await Vir({actor:e,code:{...s,chunkHashesList:[...p,...c].sort(({orderId:d},{orderId:f})=>d-f).map(({chunkHash:d})=>d),targetCanisterId:t,storeCanisterId:r,wasmModuleHash:await _Ce(n)}}),l&&await aH({actor:e,canisterId:t})},Gir=async({wasmModule:e})=>{let t=new Blob([e]),r=[],n=1e6,i=0;for(let s=0;s<t.size;s+=n){let o=t.slice(s,s+n);r.push({chunk:o,orderId:i,sha256:await dir(o)}),i++}return r},Yir=async({canisterId:e,missionControlId:t,actor:r,wasmChunks:n})=>{let i=await qir({actor:r,canisterId:t??e}),s=i.map(({hash:c})=>({chunkHash:{hash:c},sha256:(0,S0.uint8ArrayToHexString)(c)})),{storedChunks:o,uploadChunks:a}=n.reduce(({uploadChunks:c,storedChunks:u},{sha256:l,...p})=>{let d=s.find(({sha256:f})=>f===l);return{uploadChunks:[...c,...(0,S0.nonNullish)(d)?[]:[{sha256:l,...p}]],storedChunks:[...u,...(0,S0.nonNullish)(d)?[{...p,...d}]:[]]}},{uploadChunks:[],storedChunks:[]});return{uploadChunks:a,storedChunks:o,preClearChunks:i.length>0&&o.length===0,postClearChunks:(0,S0.isNullish)(t)}};async function*Jir({uploadChunks:e,limit:t=12,...r}){for(let n=0;n<e.length;n=n+t){let i=e.slice(n,n+t);yield await Promise.all(i.map(s=>Xir({uploadChunk:s,...r})))}}var Xir=async({actor:e,canisterId:t,missionControlId:r,uploadChunk:{chunk:n,...i}})=>({chunkHash:await zir({actor:e,chunk:{canisterId:r??t,chunk:new Uint8Array(await n.arrayBuffer())}}),...i}),Qir=async({actor:e,...t})=>{await Uir({actor:e,code:t})},qF=async({wasmModule:e,canisterId:t,actor:r,onProgress:n,takeSnapshot:i=!0,...s})=>{await NT({fn:async()=>await esr({wasmModule:e,canisterId:t,actor:r,...s}),onProgress:n,step:0}),await NT({fn:async()=>await Mir({canisterId:t,actor:r}),onProgress:n,step:1});try{await NT({fn:async()=>i?await rsr({canisterId:t,actor:r}):Promise.resolve(),onProgress:n,step:2}),await NT({fn:async()=>await tsr({wasmModule:e,canisterId:t,actor:r,...s}),onProgress:n,step:3})}finally{await NT({fn:async()=>await Lir({canisterId:t,actor:r}),onProgress:n,step:4})}},NT=async({fn:e,step:t,onProgress:r})=>{r?.({step:t,state:"in_progress"});try{await e(),r?.({step:t,state:"success"})}catch(n){throw r?.({step:t,state:"error"}),n}},esr=async({actor:e,canisterId:t,wasmModule:r,reset:n})=>{if(n===!0)return;let{module_hash:i}=await Zir({actor:e,canisterId:t}),s=(0,n_.fromNullable)(i);if((0,n_.isNullish)(s))return;let o=await _Ce(r),a=(0,n_.uint8ArrayToHexString)(s);if(o===a)throw new RT},tsr=async({wasmModule:e,canisterId:t,actor:r,...n})=>{await((new Blob([e]).size>2e6?"chunked":"single")=="chunked"?Hir:Qir)({wasmModule:e,canisterId:t,actor:r,...n})},rsr=async e=>{let t=await Wir(e);await Kir({...e,snapshotId:t?.[0]?.id})},nsr=e=>gm.IDL.encode([gm.IDL.Record({user:gm.IDL.Principal})],[{user:e}]),FCe=e=>gm.IDL.encode([gm.IDL.Record({controllers:gm.IDL.Vec(gm.IDL.Principal)})],[{controllers:e.filter(([t,{scope:r}])=>"Admin"in r).map(([t,r])=>t)}]),pH=async({missionControl:e,...t})=>{let r=await $ir({missionControl:e}),{missionControlId:n,...i}=e;if(!n)throw new Error("No mission control principal defined.");let s=nsr(r);await qF({actor:i,canisterId:CCe.Principal.fromText(n),arg:new Uint8Array(s),mode:UF,...t})},O0=async({moduleId:e,...t})=>{let r=await NCe({...t,canisterId:e,path:"juno:package"});if(!(0,kCe.isNullish)(r)){if(typeof r!="string")throw new Error("Unexpected metadata type to parse public custom section juno:package");return(n=>fn().transform((i,s)=>{try{return JSON.parse(i)}catch{return s.addIssue({code:"custom",message:"Invalid JSON"}),eD}}).pipe(nD).parse(n))(r)}},dH=async e=>(await O0(e))?.version;var VF=async({missionControl:{missionControlId:e,...t}})=>{(0,zF.assertNonNullish)(e,"A Mission Control ID must be provided to request its version.");let r=await O0({moduleId:e,...t});if((0,zF.isNullish)(r))return await jir({missionControl:{missionControlId:e,...t}});let{name:n,version:i}=r;if(n===iD)return i;throw new lir};var isr=async({orbiter:e})=>{let{version:t}=await kir(e);return t()},ssr=async({orbiter:e,certified:t})=>{let{list_controllers:r}=await Fir({...e,certified:t});return r()};var fH=async({orbiter:e,reset:t=!1,...r})=>{let{orbiterId:n,...i}=e;if(!n)throw new Error("No orbiter principal defined.");let s=await ssr({orbiter:e,certified:t}),o=FCe(s);await qF({actor:i,canisterId:RCe.Principal.fromText(n),arg:new Uint8Array(o),mode:t?cH:UF,reset:t,...r})},WF=async({orbiter:{orbiterId:e,...t}})=>{(0,ZF.assertNonNullish)(e,"An Orbiter ID must be provided to request its version.");let r=await O0({moduleId:e,...t});if((0,ZF.isNullish)(r))return await isr({orbiter:{orbiterId:e,...t}});let{name:n,version:i}=r;if(n===sD)return i;throw new pir},osr=async({config:e,satellite:t})=>{let{set_storage_config:r}=await xc(t);return r(e)},asr=async({config:e,satellite:t})=>{let{set_db_config:r}=await xc(t);return r(e)},csr=async({config:e,satellite:t})=>{let{set_auth_config:r}=await xc(t);return r(e)},usr=async({satellite:e})=>{let{get_storage_config:t}=await xc(e);return t()},lsr=async({satellite:e})=>{let{get_db_config:t}=await xc(e);return t()},psr=async({satellite:e})=>{let{get_auth_config:t}=await xc(e);return t()};var dsr=async({satellite:e,type:t,filter:r})=>{let{list_rules:n}=await xc(e);return n(t,r)},fsr=async({type:e,collection:t,rule:r,satellite:n})=>{let{set_rule:i}=await xc(n);return i(e,t,r)},hsr=async({satellite:e})=>{let{version:t}=await Cir(e);return t()},msr=async({satellite:e})=>{let{list_controllers:t}=await Oir(e);return t()},ysr=async({satellite:e})=>{let{list_controllers:t}=await Dir(e);return t()},gsr=async({satellite:e,certified:t})=>{let{list_controllers:r}=await xc({...e,certified:t});return r()},bsr=async({satellite:e})=>{let{list_custom_domains:t}=await xc(e);return t()},vsr=async({satellite:e,domainName:t,boundaryNodesId:r})=>{let{set_custom_domain:n}=await xc(e);await n(t,(0,jCe.toNullable)(r))},_sr=async({satellite:e})=>{let{memory_size:t}=await xc(e);return t()};var xsr=async({collection:e,satellite:t})=>{let{del_assets:r}=await xc(t);return r(e)};var $Ce=e=>xsr(e),MCe=e=>(0,ks.toNullable)((0,ks.nonNullish)(e)&&((0,ks.nonNullish)((0,ks.toNullable)(e.heap))||(0,ks.nonNullish)((0,ks.toNullable)(e.stable)))?{heap:(0,ks.toNullable)(e.heap),stable:(0,ks.toNullable)(e.stable)}:void 0),LCe=e=>{let t=(0,ks.fromNullable)(e),r=(0,ks.fromNullable)(t?.heap??[]),n=(0,ks.fromNullable)(t?.stable??[]);return{...(0,ks.nonNullish)(t)&&((0,ks.nonNullish)(r)||(0,ks.nonNullish)(n))&&{maxMemorySize:{...(0,ks.nonNullish)(r)&&{heap:r},...(0,ks.nonNullish)(n)&&{stable:n}}}}},Esr=({headers:e,rewrites:t,redirects:r,iframe:n,rawAccess:i,maxMemorySize:s,version:o})=>{let a=(e??[]).map(({source:l,headers:p})=>[l,p]),c=(t??[]).map(({source:l,destination:p})=>[l,p]),u=(r??[]).map(({source:l,location:p,code:d})=>[l,{status_code:d,location:p}]);return{headers:a,rewrites:c,redirects:[u],iframe:[n==="same-origin"?{SameOrigin:null}:n==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[i===!0?{Allow:null}:{Deny:null}],max_memory_size:MCe(s),version:(0,Wn.toNullable)(o)}},UCe=({redirects:e,iframe:t,version:r,raw_access:n,max_memory_size:i,headers:s,rewrites:o})=>{let a=(0,Wn.fromNullable)(e)?.map(([m,{status_code:y,...g}])=>({...g,code:y,source:m})),c=(0,Wn.fromNullable)(n),u=(0,Wn.nonNullish)(c)?"Allow"in c:void 0,l=(0,Wn.fromNullable)(t),p=(0,Wn.nonNullish)(l)?"SameOrigin"in l?"same-origin":"AllowAny"in l?"allow-any":"deny":void 0,d=LCe(i),f=s.map(([m,y])=>({source:m,headers:y})),h=o.map(([m,y])=>({source:m,destination:y}));return{...f.length>0&&{headers:f},...h.length>0&&{rewrites:h},...(0,Wn.nonNullish)(a)&&{redirects:a},...(0,Wn.nonNullish)(p)&&{iframe:p},version:(0,Wn.fromNullable)(r),...(0,Wn.nonNullish)(u)&&{rawAccess:u},...d}},wsr=({maxMemorySize:e,version:t})=>({max_memory_size:MCe(e),version:(0,Wn.toNullable)(t)}),qCe=({version:e,max_memory_size:t})=>({...LCe(t),version:(0,Wn.fromNullable)(e)}),Tsr=({internetIdentity:e,rules:t,version:r})=>({internet_identity:(0,Wn.isNullish)(e)?[]:[{derivation_origin:(0,Wn.toNullable)(e?.derivationOrigin),external_alternative_origins:(0,Wn.toNullable)(e?.externalAlternativeOrigins)}],rules:(0,Wn.isNullish)(t)?[]:[{allowed_callers:t.allowedCallers.map(n=>BCe.Principal.fromText(n))}],version:(0,Wn.toNullable)(r)}),zCe=({version:e,internet_identity:t,rules:r})=>{let n=(0,Wn.fromNullable)(t),i=(0,Wn.fromNullable)(n?.derivation_origin??[]),s=(0,Wn.fromNullable)(n?.external_alternative_origins??[]),o=(0,Wn.fromNullable)(r);return{...(0,Wn.nonNullish)(n)&&{internetIdentity:{...(0,Wn.nonNullish)(i)&&{derivationOrigin:i},...(0,Wn.nonNullish)(s)&&{externalAlternativeOrigins:s}}},...(0,Wn.nonNullish)(o)&&{rules:{allowedCallers:o.allowed_callers.map(a=>a.toText())}},version:(0,Wn.fromNullable)(e)}},VCe=async({config:e,satellite:t})=>{let r=await osr({satellite:t,config:Esr(e)});return UCe(r)},ZCe=async({config:e,...t})=>{let r=await asr({config:wsr(e),...t});return qCe(r)},WCe=async({config:e,...t})=>{let r=await csr({config:Tsr(e),...t});return zCe(r)},KCe=async({satellite:e})=>{let t=await psr({satellite:e}),r=(0,D0.fromNullable)(t);if(!(0,D0.isNullish)(r))return zCe(r)},HCe=async({satellite:e})=>{let t=await usr({satellite:e});return UCe(t)},GCe=async({satellite:e})=>{let t=await lsr({satellite:e}),r=(0,D0.fromNullable)(t);if(!(0,D0.isNullish)(r))return qCe(r)};var vm=async({satellite:e})=>(await bsr({satellite:e})).map(([t,r])=>{let n=(0,kT.fromNullable)(r.version);return{domain:t,bn_id:(0,kT.fromNullable)(r.bn_id),created_at:r.created_at,updated_at:r.updated_at,...(0,kT.nonNullish)(n)&&{version:n}}}),KF=({satellite:e,domains:t})=>Promise.all(t.map(({domain:r,bn_id:n})=>vsr({satellite:e,domainName:r,boundaryNodesId:n})));var YCe=e=>_sr(e),Ssr={Db:null},Psr={Storage:null},Asr={Public:null},Osr={Private:null},Dsr={Managed:null},Csr={Controllers:null},JCe={Heap:null},Isr={Stable:null},Nsr=600000000n,XCe=e=>e==="storage"?Psr:Ssr,Fsr=e=>({matcher:(0,Qn.isNullish)(e)?(0,Qn.toNullable)():(0,Qn.toNullable)({include_system:e.include_system})}),ksr=({read:e,write:t,memory:r,maxSize:n,maxChangesPerUser:i,maxCapacity:s,version:o,mutablePermissions:a,maxTokens:c})=>({read:yCe(e),write:yCe(t),memory:(0,Qn.nonNullish)(r)?[Rsr(r)]:[],version:(0,Qn.toNullable)(o),max_size:(0,Qn.toNullable)((0,Qn.nonNullish)(n)&&n>0n?n:void 0),max_capacity:(0,Qn.toNullable)((0,Qn.nonNullish)(s)&&s>0?s:void 0),max_changes_per_user:(0,Qn.toNullable)((0,Qn.nonNullish)(i)&&i>0?i:void 0),mutable_permissions:(0,Qn.toNullable)(a??!0),rate_config:(0,Qn.nonNullish)(c)&&c>0n?[{max_tokens:c,time_per_token_ns:Nsr}]:[]}),QCe=([e,t])=>{let{read:r,write:n,updated_at:i,created_at:s,max_size:o,max_changes_per_user:a,max_capacity:c,memory:u,mutable_permissions:l,version:p,rate_config:d}=t,f=o?.[0]??0n>0n?(0,Qn.fromNullable)(o):void 0,h=a?.[0]??!1?(0,Qn.fromNullable)(a):void 0,m=c?.[0]??!1?(0,Qn.fromNullable)(c):void 0,y=(0,Qn.fromNullable)(p),g=d?.[0]?.max_tokens??0n>0n?(0,Qn.fromNullable)(d)?.max_tokens:void 0;return{collection:e,read:mCe(r),write:mCe(n),memory:jsr((0,Qn.fromNullable)(u)??JCe),updatedAt:i,createdAt:s,...(0,Qn.nonNullish)(y)&&{version:y},...(0,Qn.nonNullish)(h)&&{maxChangesPerUser:h},...(0,Qn.nonNullish)(f)&&{maxSize:f},...(0,Qn.nonNullish)(m)&&{maxCapacity:m},mutablePermissions:(0,Qn.fromNullable)(l)??!0,...(0,Qn.nonNullish)(g)&&{maxTokens:g}}},mCe=e=>"Public"in e?"public":"Private"in e?"private":"Managed"in e?"managed":"controllers",yCe=e=>{switch(e){case"public":return Asr;case"private":return Osr;case"managed":return Dsr;default:return Csr}},Rsr=e=>{switch(e.toLowerCase()){case"heap":return JCe;default:return Isr}},jsr=e=>"Heap"in e?"heap":"stable",hH=async({type:e,satellite:t,filter:r})=>{let{items:n,...i}=await dsr({satellite:t,type:XCe(e),filter:Fsr(r)});return{...i,items:n.map(s=>QCe(s))}},eIe=async({rule:{collection:e,...t},type:r,satellite:n})=>{let i=await fsr({type:XCe(r),rule:ksr(t),satellite:n,collection:e});return QCe([e,i])},rIe=async({satellite:e,deprecated:t,deprecatedNoScope:r,reset:n=!1,...i})=>{let{satelliteId:s,...o}=e;if((0,tIe.isNullish)(s))throw new Error("No satellite principal defined.");if(t){let u=await msr({satellite:e}),l=FT.IDL.encode([FT.IDL.Record({controllers:FT.IDL.Vec(FT.IDL.Principal)})],[{controllers:u}]);await qF({actor:o,canisterId:lH.Principal.fromText(s),arg:new Uint8Array(l),mode:n?cH:UF,reset:n,...i});return}let a=await(r?ysr:gsr)({satellite:e,certified:n}),c=FCe(a);await qF({actor:o,canisterId:lH.Principal.fromText(s),arg:new Uint8Array(c),mode:n?cH:UF,reset:n,...i})},C0=async({satellite:{satelliteId:e,...t}})=>{(0,Op.assertNonNullish)(e,"A Satellite ID must be provided to request its version.");let r=await O0({moduleId:e,...t});if((0,Op.isNullish)(r))return await hsr({satellite:{satelliteId:e,...t}});let{name:n,version:i,dependencies:s}=r;if(n===Yc)return i;let o=jT({dependencies:s,dependencyId:Yc});if((0,Op.nonNullish)(o)){let[a,c]=o;return c}throw new gCe},nIe=async({satellite:{satelliteId:e,...t}})=>{(0,Op.assertNonNullish)(e,"A Satellite ID must be provided to request its version.");let r=await O0({moduleId:e,...t});if((0,Op.isNullish)(r))return await $sr({satellite:{satelliteId:e,...t}});let{name:n,dependencies:i}=r;if(n===Yc)return"stock";let s=jT({dependencies:i,dependencyId:Yc});if((0,Op.nonNullish)(s))return"extended";throw new gCe},$sr=async({satellite:{satelliteId:e,...t}})=>{let r=await NCe({...t,canisterId:e,path:"juno:build"});return(0,Op.nonNullish)(r)&&["stock","extended"].includes(r)?r:void 0};var uor=ne(Xe(),1),lor=ne(Xe(),1),dor=ne(IH(),1),hor=ne(Xe(),1),bIe=ne(Xe(),1),mor=ne(Xe(),1),xIe=ne(Xe(),1),EIe=ne(qs(),1),QF=ne(Xe(),1),e4=ne(Xe(),1),wIe=ne(qs(),1),NH=ne(Xe(),1),xor=ne(IH(),1),TIe=ne(Xe(),1),kH=ne(Xe(),1),SIe=ne(Xe(),1),PIe=ne(Kn(),1),ws=ne(Xe(),1),AIe=ne(Xe(),1),t4=ne(Xe(),1),CIe=ne(qs(),1),IIe=ne(Xe(),1),zT=ne(Xe(),1),FH=ne(Xe(),1),qT=ne(Xe(),1),por=class{callbacks=[];populate(e){this.callbacks.forEach(({callback:t})=>t(e))}subscribe(e){let t=Symbol();return this.callbacks.push({id:t,callback:e}),()=>this.callbacks=this.callbacks.filter(({id:r})=>r!==t)}};var b3r=BigInt(144e11);var vIe="http://127.0.0.1:5987";var _Ie=class MT extends por{static instance;env;constructor(){super()}static getInstance(){return MT.instance||(MT.instance=new MT),MT.instance}set(t){this.env=t,this.populate(t)}get(){return this.env}reset(){this.env=null}subscribe(t){let r=super.subscribe(t);return t(this.env),r}};var yor=()=>typeof window<"u";var gor=async({identity:e,container:t})=>{let r=(0,NH.nonNullish)(t)&&t!==!1?t===!0?vIe:t:"https://icp-api.io",n=(0,NH.nonNullish)(t);return await wIe.HttpAgent.create({identity:e,shouldFetchRootKey:n,host:r})},bor=class LT{static instance;#e=void 0;constructor(){}static getInstance(){return(0,e4.isNullish)(LT.instance)&&(LT.instance=new LT),LT.instance}async getAgent({identity:t,...r}){let n=t.getPrincipal().toText();if((0,e4.isNullish)(this.#e)||(0,e4.isNullish)(this.#e[n])){let i=await gor({identity:t,...r});return this.#e={...this.#e??{},[n]:i},i}return this.#e[n]}reset(){this.#e=null}},vor=class UT{static instance;#e=void 0;constructor(){}static getInstance(){return(0,QF.isNullish)(UT.instance)&&(UT.instance=new UT),UT.instance}async getActor({satelliteId:t,identity:r,actorKey:n,...i}){let s=`${n}#${r.getPrincipal().toText()}#${t};`;if((0,QF.isNullish)(this.#e)||(0,QF.isNullish)(this.#e[s])){let o=await this.createActor({satelliteId:t,identity:r,...i});return this.#e={...this.#e??{},[s]:o},o}return this.#e[s]}reset(){this.#e=null}async createActor({idlFactory:t,satelliteId:r,...n}){let i=await bor.getInstance().getAgent(n);return EIe.Actor.createActor(t,{agent:i,canisterId:r})}};var _or=class extends Error{};var gIe=e=>{if((0,ws.isNullish)(e))return(0,ws.toNullable)();switch(e.matcher){case"equal":return(0,ws.toNullable)({Equal:e.timestamp});case"greaterThan":return(0,ws.toNullable)({GreaterThan:e.timestamp});case"lessThan":return(0,ws.toNullable)({LessThan:e.timestamp});case"between":return(0,ws.toNullable)({Between:[e.timestamps.start,e.timestamps.end]});default:throw new _or("Invalid list matcher for timestamp",e)}},Eor=({matcher:e,paginate:t,order:r,owner:n})=>({matcher:(0,ws.isNullish)(e)?[]:[{key:(0,ws.toNullable)(e.key),description:(0,ws.toNullable)(e.description),created_at:gIe(e.createdAt),updated_at:gIe(e.updatedAt)}],paginate:(0,ws.toNullable)((0,ws.isNullish)(t)?void 0:{start_after:(0,ws.toNullable)(t.startAfter),limit:(0,ws.toNullable)((0,ws.isNullish)(t.limit)?void 0:BigInt(t.limit))}),order:(0,ws.toNullable)((0,ws.isNullish)(r)?void 0:{desc:r.desc,field:r.field==="created_at"?{CreatedAt:null}:r.field==="updated_at"?{UpdatedAt:null}:{Keys:null}}),owner:(0,ws.toNullable)((0,ws.isNullish)(n)?void 0:typeof n=="string"?PIe.Principal.fromText(n):n)}),wor=({satelliteId:e,container:t})=>{let{satelliteId:r}=OIe({satelliteId:e}),{container:n}=DIe({container:t});if((0,t4.nonNullish)(n)&&n!==!1){let{host:i,protocol:s}=new URL(n===!0?vIe:n);return`${s}//${r??"unknown"}.${i.replace("127.0.0.1","localhost")}`}return`https://${r??"unknown"}.icp0.io`},OIe=({satelliteId:e})=>(0,t4.nonNullish)(e)?{satelliteId:e}:_Ie.getInstance().get()??{satelliteId:void 0},DIe=({container:e})=>(0,t4.nonNullish)(e)?{container:e}:_Ie.getInstance().get()??{container:void 0},Tor=({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({sha256:e.Vec(e.Nat8),proposal_id:e.Nat}),n=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),i=e.Record({field:n,desc:e.Bool}),s=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),o=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(s),description:e.Opt(e.Text),created_at:e.Opt(s)}),a=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),c=e.Record({order:e.Opt(i),owner:e.Opt(e.Principal),matcher:e.Opt(o),paginate:e.Opt(a)}),u=e.Record({controllers:e.Vec(e.Principal)}),l=e.Variant({Write:e.Null,Admin:e.Null,Submit:e.Null}),p=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:l,expires_at:e.Opt(e.Nat64)}),d=e.Record({version:e.Opt(e.Nat64)}),f=e.Variant({Db:e.Null,Storage:e.Null}),h=e.Record({version:e.Opt(e.Nat64)}),m=e.Record({proposal_ids:e.Vec(e.Nat)}),y=e.Record({cycles:e.Nat,destination_id:e.Principal}),g=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}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),b=e.Record({key:g,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),x=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),E=e.Record({allowed_callers:e.Vec(e.Principal)}),P=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),I=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),L=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),W=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),he=e.Variant({Deny:e.Null,Allow:e.Null}),ae=e.Record({status_code:e.Nat16,location:e.Text}),Ee=e.Record({iframe:e.Opt(W),updated_at:e.Opt(e.Nat64),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),U=e.Record({db:e.Opt(L),authentication:e.Opt(P),storage:Ee}),R=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),ee=e.Variant({Initialized:e.Null,Failed:e.Null,Open:e.Null,Rejected:e.Null,Executed:e.Null,Accepted:e.Null}),H=e.Record({clear_existing_assets:e.Opt(e.Bool)}),D=e.Record({orbiter:e.Opt(e.Text),mission_control_version:e.Opt(e.Text),satellite_version:e.Opt(e.Text)}),j=e.Variant({AssetsUpgrade:H,SegmentsDeployment:D}),k=e.Record({status:ee,updated_at:e.Nat64,sha256:e.Opt(e.Vec(e.Nat8)),executed_at:e.Opt(e.Nat64),owner:e.Principal,created_at:e.Nat64,version:e.Opt(e.Nat64),proposal_type:j}),ie=e.Variant({Heap:e.Null,Stable:e.Null}),ge=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Pe=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),V=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:ge,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),C=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),_e=e.Record({memory:ie,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}),Se=e.Variant({Callback:e.Record({token:_e,callback:e.Func([],[],["query"])})}),De=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Se),status_code:e.Nat16}),Oe=e.Record({token:e.Opt(_e),body:e.Vec(e.Nat8)}),S=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}),N=e.Record({batch_id:e.Nat}),$=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,b)),items_length:e.Nat64}),oe=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),se=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,R)),items_length:e.Nat64}),ue=e.Record({desc:e.Bool}),be=e.Record({start_after:e.Opt(e.Nat),limit:e.Opt(e.Nat)}),A=e.Record({order:e.Opt(ue),paginate:e.Opt(be)}),F=e.Record({proposal_id:e.Nat}),Q=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(F,k)),items_length:e.Nat64}),te=e.Record({include_system:e.Bool}),xe=e.Record({matcher:e.Opt(te)}),Te=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(e.Text,V)),items_length:e.Nat64}),$e=e.Record({stable:e.Nat64,heap:e.Nat64}),ot=e.Record({version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),pt=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:l,expires_at:e.Opt(e.Nat64)}),gt=e.Record({controller:pt,controllers:e.Vec(e.Principal)}),ct=e.Record({version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),Ye=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Zt=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),max_size:e.Opt(e.Nat),read:ge,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),Yt=e.Record({iframe:e.Opt(W),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),Wt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Lt=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),commit_proposal:e.Func([r],[e.Null],[]),commit_proposal_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,c],[e.Nat64],["query"]),count_collection_assets:e.Func([e.Text],[e.Nat64],["query"]),count_collection_docs:e.Func([e.Text],[e.Nat64],["query"]),count_docs:e.Func([e.Text,c],[e.Nat64],["query"]),count_proposals:e.Func([],[e.Nat64],["query"]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([u],[e.Vec(e.Tuple(e.Principal,p))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,d],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,c],[],[]),del_filtered_docs:e.Func([e.Text,c],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,d))],[],[]),del_rule:e.Func([f,e.Text,h],[],[]),delete_proposal_assets:e.Func([m],[],[]),deposit_cycles:e.Func([y],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(b)],["query"]),get_auth_config:e.Func([],[e.Opt(P)],["query"]),get_config:e.Func([],[U],[]),get_db_config:e.Func([],[e.Opt(L)],["query"]),get_doc:e.Func([e.Text,e.Text],[e.Opt(R)],["query"]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(b)))],["query"]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(R)))],["query"]),get_proposal:e.Func([e.Nat],[e.Opt(k)],["query"]),get_rule:e.Func([f,e.Text],[e.Opt(V)],["query"]),get_storage_config:e.Func([],[Ee],["query"]),http_request:e.Func([C],[De],["query"]),http_request_streaming_callback:e.Func([_e],[Oe],["query"]),init_asset_upload:e.Func([S],[N],[]),init_proposal:e.Func([j],[e.Nat,k],[]),init_proposal_asset_upload:e.Func([S,e.Nat],[N],[]),list_assets:e.Func([e.Text,c],[$],["query"]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,p))],["query"]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,oe))],["query"]),list_docs:e.Func([e.Text,c],[se],["query"]),list_proposals:e.Func([A],[Q],["query"]),list_rules:e.Func([f,xe],[Te],["query"]),memory_size:e.Func([],[$e],["query"]),reject_proposal:e.Func([r],[e.Null],[]),set_auth_config:e.Func([ot],[P],[]),set_controllers:e.Func([gt],[e.Vec(e.Tuple(e.Principal,p))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([ct],[L],[]),set_doc:e.Func([e.Text,e.Text,Ye],[R],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ye))],[e.Vec(e.Tuple(e.Text,R))],[]),set_rule:e.Func([f,e.Text,Zt],[V],[]),set_storage_config:e.Func([Yt],[Ee],[]),submit_proposal:e.Func([e.Nat],[e.Nat,k],[]),upload_asset_chunk:e.Func([Wt],[Lt],[]),upload_proposal_asset_chunk:e.Func([Wt],[Lt],[])})},Sor=({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({sha256:e.Vec(e.Nat8),proposal_id:e.Nat}),n=e.Variant({UpdatedAt:e.Null,Keys:e.Null,CreatedAt:e.Null}),i=e.Record({field:n,desc:e.Bool}),s=e.Variant({Equal:e.Nat64,Between:e.Tuple(e.Nat64,e.Nat64),GreaterThan:e.Nat64,LessThan:e.Nat64}),o=e.Record({key:e.Opt(e.Text),updated_at:e.Opt(s),description:e.Opt(e.Text),created_at:e.Opt(s)}),a=e.Record({start_after:e.Opt(e.Text),limit:e.Opt(e.Nat64)}),c=e.Record({order:e.Opt(i),owner:e.Opt(e.Principal),matcher:e.Opt(o),paginate:e.Opt(a)}),u=e.Record({controllers:e.Vec(e.Principal)}),l=e.Variant({Write:e.Null,Admin:e.Null,Submit:e.Null}),p=e.Record({updated_at:e.Nat64,metadata:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,scope:l,expires_at:e.Opt(e.Nat64)}),d=e.Record({version:e.Opt(e.Nat64)}),f=e.Variant({Db:e.Null,Storage:e.Null}),h=e.Record({version:e.Opt(e.Nat64)}),m=e.Record({proposal_ids:e.Vec(e.Nat)}),y=e.Record({cycles:e.Nat,destination_id:e.Principal}),g=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}),v=e.Record({modified:e.Nat64,sha256:e.Vec(e.Nat8),total_length:e.Nat}),b=e.Record({key:g,updated_at:e.Nat64,encodings:e.Vec(e.Tuple(e.Text,v)),headers:e.Vec(e.Tuple(e.Text,e.Text)),created_at:e.Nat64,version:e.Opt(e.Nat64)}),x=e.Record({derivation_origin:e.Opt(e.Text),external_alternative_origins:e.Opt(e.Vec(e.Text))}),E=e.Record({allowed_callers:e.Vec(e.Principal)}),P=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),I=e.Record({stable:e.Opt(e.Nat64),heap:e.Opt(e.Nat64)}),L=e.Record({updated_at:e.Opt(e.Nat64),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),W=e.Variant({Deny:e.Null,AllowAny:e.Null,SameOrigin:e.Null}),he=e.Variant({Deny:e.Null,Allow:e.Null}),ae=e.Record({status_code:e.Nat16,location:e.Text}),Ee=e.Record({iframe:e.Opt(W),updated_at:e.Opt(e.Nat64),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),created_at:e.Opt(e.Nat64),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),U=e.Record({db:e.Opt(L),authentication:e.Opt(P),storage:Ee}),R=e.Record({updated_at:e.Nat64,owner:e.Principal,data:e.Vec(e.Nat8),description:e.Opt(e.Text),created_at:e.Nat64,version:e.Opt(e.Nat64)}),ee=e.Variant({Initialized:e.Null,Failed:e.Null,Open:e.Null,Rejected:e.Null,Executed:e.Null,Accepted:e.Null}),H=e.Record({clear_existing_assets:e.Opt(e.Bool)}),D=e.Record({orbiter:e.Opt(e.Text),mission_control_version:e.Opt(e.Text),satellite_version:e.Opt(e.Text)}),j=e.Variant({AssetsUpgrade:H,SegmentsDeployment:D}),k=e.Record({status:ee,updated_at:e.Nat64,sha256:e.Opt(e.Vec(e.Nat8)),executed_at:e.Opt(e.Nat64),owner:e.Principal,created_at:e.Nat64,version:e.Opt(e.Nat64),proposal_type:j}),ie=e.Variant({Heap:e.Null,Stable:e.Null}),ge=e.Variant({Controllers:e.Null,Private:e.Null,Public:e.Null,Managed:e.Null}),Pe=e.Record({max_tokens:e.Nat64,time_per_token_ns:e.Nat64}),V=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),updated_at:e.Nat64,max_size:e.Opt(e.Nat),read:ge,created_at:e.Nat64,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),C=e.Record({url:e.Text,method:e.Text,body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),certificate_version:e.Opt(e.Nat16)}),_e=e.Record({memory:ie,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}),Se=e.Variant({Callback:e.Record({token:_e,callback:e.Func([],[],[])})}),De=e.Record({body:e.Vec(e.Nat8),headers:e.Vec(e.Tuple(e.Text,e.Text)),streaming_strategy:e.Opt(Se),status_code:e.Nat16}),Oe=e.Record({token:e.Opt(_e),body:e.Vec(e.Nat8)}),S=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}),N=e.Record({batch_id:e.Nat}),$=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,b)),items_length:e.Nat64}),oe=e.Record({updated_at:e.Nat64,created_at:e.Nat64,version:e.Opt(e.Nat64),bn_id:e.Opt(e.Text)}),se=e.Record({matches_pages:e.Opt(e.Nat64),matches_length:e.Nat64,items_page:e.Opt(e.Nat64),items:e.Vec(e.Tuple(e.Text,R)),items_length:e.Nat64}),ue=e.Record({desc:e.Bool}),be=e.Record({start_after:e.Opt(e.Nat),limit:e.Opt(e.Nat)}),A=e.Record({order:e.Opt(ue),paginate:e.Opt(be)}),F=e.Record({proposal_id:e.Nat}),Q=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(F,k)),items_length:e.Nat64}),te=e.Record({include_system:e.Bool}),xe=e.Record({matcher:e.Opt(te)}),Te=e.Record({matches_length:e.Nat64,items:e.Vec(e.Tuple(e.Text,V)),items_length:e.Nat64}),$e=e.Record({stable:e.Nat64,heap:e.Nat64}),ot=e.Record({version:e.Opt(e.Nat64),internet_identity:e.Opt(x),rules:e.Opt(E)}),pt=e.Record({metadata:e.Vec(e.Tuple(e.Text,e.Text)),scope:l,expires_at:e.Opt(e.Nat64)}),gt=e.Record({controller:pt,controllers:e.Vec(e.Principal)}),ct=e.Record({version:e.Opt(e.Nat64),max_memory_size:e.Opt(I)}),Ye=e.Record({data:e.Vec(e.Nat8),description:e.Opt(e.Text),version:e.Opt(e.Nat64)}),Zt=e.Record({max_capacity:e.Opt(e.Nat32),memory:e.Opt(ie),max_size:e.Opt(e.Nat),read:ge,version:e.Opt(e.Nat64),mutable_permissions:e.Opt(e.Bool),rate_config:e.Opt(Pe),write:ge,max_changes_per_user:e.Opt(e.Nat32)}),Yt=e.Record({iframe:e.Opt(W),rewrites:e.Vec(e.Tuple(e.Text,e.Text)),headers:e.Vec(e.Tuple(e.Text,e.Vec(e.Tuple(e.Text,e.Text)))),version:e.Opt(e.Nat64),max_memory_size:e.Opt(I),raw_access:e.Opt(he),redirects:e.Opt(e.Vec(e.Tuple(e.Text,ae)))}),Wt=e.Record({content:e.Vec(e.Nat8),batch_id:e.Nat,order_id:e.Opt(e.Nat)}),Lt=e.Record({chunk_id:e.Nat});return e.Service({commit_asset_upload:e.Func([t],[],[]),commit_proposal:e.Func([r],[e.Null],[]),commit_proposal_asset_upload:e.Func([t],[],[]),count_assets:e.Func([e.Text,c],[e.Nat64],[]),count_collection_assets:e.Func([e.Text],[e.Nat64],[]),count_collection_docs:e.Func([e.Text],[e.Nat64],[]),count_docs:e.Func([e.Text,c],[e.Nat64],[]),count_proposals:e.Func([],[e.Nat64],[]),del_asset:e.Func([e.Text,e.Text],[],[]),del_assets:e.Func([e.Text],[],[]),del_controllers:e.Func([u],[e.Vec(e.Tuple(e.Principal,p))],[]),del_custom_domain:e.Func([e.Text],[],[]),del_doc:e.Func([e.Text,e.Text,d],[],[]),del_docs:e.Func([e.Text],[],[]),del_filtered_assets:e.Func([e.Text,c],[],[]),del_filtered_docs:e.Func([e.Text,c],[],[]),del_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[],[]),del_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,d))],[],[]),del_rule:e.Func([f,e.Text,h],[],[]),delete_proposal_assets:e.Func([m],[],[]),deposit_cycles:e.Func([y],[],[]),get_asset:e.Func([e.Text,e.Text],[e.Opt(b)],[]),get_auth_config:e.Func([],[e.Opt(P)],[]),get_config:e.Func([],[U],[]),get_db_config:e.Func([],[e.Opt(L)],[]),get_doc:e.Func([e.Text,e.Text],[e.Opt(R)],[]),get_many_assets:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(b)))],[]),get_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text))],[e.Vec(e.Tuple(e.Text,e.Opt(R)))],[]),get_proposal:e.Func([e.Nat],[e.Opt(k)],[]),get_rule:e.Func([f,e.Text],[e.Opt(V)],[]),get_storage_config:e.Func([],[Ee],[]),http_request:e.Func([C],[De],[]),http_request_streaming_callback:e.Func([_e],[Oe],[]),init_asset_upload:e.Func([S],[N],[]),init_proposal:e.Func([j],[e.Nat,k],[]),init_proposal_asset_upload:e.Func([S,e.Nat],[N],[]),list_assets:e.Func([e.Text,c],[$],[]),list_controllers:e.Func([],[e.Vec(e.Tuple(e.Principal,p))],[]),list_custom_domains:e.Func([],[e.Vec(e.Tuple(e.Text,oe))],[]),list_docs:e.Func([e.Text,c],[se],[]),list_proposals:e.Func([A],[Q],[]),list_rules:e.Func([f,xe],[Te],[]),memory_size:e.Func([],[$e],[]),reject_proposal:e.Func([r],[e.Null],[]),set_auth_config:e.Func([ot],[P],[]),set_controllers:e.Func([gt],[e.Vec(e.Tuple(e.Principal,p))],[]),set_custom_domain:e.Func([e.Text,e.Opt(e.Text)],[],[]),set_db_config:e.Func([ct],[L],[]),set_doc:e.Func([e.Text,e.Text,Ye],[R],[]),set_many_docs:e.Func([e.Vec(e.Tuple(e.Text,e.Text,Ye))],[e.Vec(e.Tuple(e.Text,R))],[]),set_rule:e.Func([f,e.Text,Zt],[V],[]),set_storage_config:e.Func([Yt],[Ee],[]),submit_proposal:e.Func([e.Nat],[e.Nat,k],[]),upload_asset_chunk:e.Func([Wt],[Lt],[]),upload_proposal_asset_chunk:e.Func([Wt],[Lt],[])})},RH=({satellite:e,options:{certified:t}})=>Por({idlFactory:t?Sor:Tor,actorKey:`stock#${t?"update":"query"}`,...e});var Por=async({satelliteId:e,container:t,...r})=>{let{satelliteId:n}=OIe({satelliteId:e});(0,AIe.assertNonNullish)(n,"No satellite ID defined. Did you initialize Juno?");let{container:i}=DIe({container:t});return await vor.getInstance().getActor({satelliteId:n,container:i,...r})};var Aor={certified:!1},r4=e=>(0,IIe.nonNullish)(e)?e:Dor()??new CIe.AnonymousIdentity;var Oor;var Dor=()=>Oor?.getIdentity();var Cor=async({asset:{data:e,headers:t,...r},actor:n})=>{let{init_asset_upload:i,upload_asset_chunk:s,commit_asset_upload:o}=n,{batch_id:a}=await i(Ior(r)),{chunkIds:c}=await For({data:e,uploadFn:s,batchId:a});await Nor({commitFn:o,batchId:a,data:e,headers:t,chunkIds:c})},Ior=({filename:e,collection:t,token:r,fullPath:n,encoding:i,description:s})=>({collection:t,full_path:n,name:e,token:(0,qT.toNullable)(r),encoding_type:(0,qT.toNullable)(i),description:(0,qT.toNullable)(s)}),Nor=async({commitFn:e,batchId:t,chunkIds:r,headers:n,data:i})=>{let s=n.find(([o,a])=>o.toLowerCase()==="content-type")===void 0&&i.type!==void 0&&i.type!==""?[["Content-Type",i.type]]:void 0;await e({batch_id:t,chunk_ids:r.map(({chunk_id:o})=>o),headers:[...n,...s??[]]})},For=async({data:e,uploadFn:t,batchId:r})=>{let n=[],i=yor()?new Blob([await e.arrayBuffer()]):e,s=0n;for(let a=0;a<i.size;a+=19e5){let c=i.slice(a,a+19e5);n.push({batchId:r,chunk:c,uploadFn:t,orderId:s}),s++}let o=[];for await(let a of kor({uploadChunks:n}))o=[...o,...a];return{chunkIds:o}};async function*kor({uploadChunks:e,limit:t=12}){for(let r=0;r<e.length;r=r+t){let n=e.slice(r,r+t);yield await Promise.all(n.map(i=>Ror(i)))}}var Ror=async({batchId:e,chunk:t,uploadFn:r,orderId:n})=>r({batch_id:e,content:new Uint8Array(await t.arrayBuffer()),order_id:(0,qT.toNullable)(n)}),jor=async({asset:e,...t})=>{let r=await RH(t);await Cor({actor:r,asset:e})},$or=async({collection:e,filter:t,...r})=>{let{list_assets:n}=await RH(r),{items:i,items_length:s,items_page:o,matches_length:a,matches_pages:c}=await n(e,Eor(t));return{items:i.map(([u,l])=>l),items_length:s,items_page:(0,FH.fromNullable)(o),matches_length:a,matches_pages:(0,FH.fromNullable)(c)}};var Bor=async({collection:e,fullPath:t,...r})=>(await RH(r)).del_asset(e,t);var Mor=e=>btoa([...e].map(t=>String.fromCharCode(t)).join("")),NIe=e=>Lor(e);var Lor=async({filename:e,data:t,collection:r,headers:n=[],fullPath:i,token:s,satellite:o,encoding:a,description:c})=>{let u=r4(o?.identity),l=decodeURI(e),p=i??`/${r}/${l}`,d={...o,identity:u};return await jor({asset:{data:t,filename:l,collection:r,token:s,headers:n,fullPath:p,encoding:a,description:c},satellite:d,options:{certified:!0}}),{downloadUrl:kIe({satellite:d,assetKey:{fullPath:p,token:s}}),fullPath:p,name:l}},n4=async({collection:e,filter:t,satellite:r,options:n})=>{let i={...r,identity:r4(r?.identity)},{items:s,...o}=await $or({collection:e,filter:t??{},satellite:i,options:n??Aor}),a=s.map(({key:{full_path:c,token:u,name:l,owner:p,description:d},headers:f,encodings:h,created_at:m,updated_at:y})=>{let g=(0,zT.fromNullable)(u);return{fullPath:c,description:(0,zT.fromNullable)(d),name:l,downloadUrl:kIe({satellite:i,assetKey:{fullPath:c,token:g}}),token:g,headers:f,encodings:h.reduce((v,[b,{modified:x,sha256:E,total_length:P}])=>({...v,[b]:{modified:x,sha256:Mor(E),total_length:P}}),{}),owner:p.toText(),created_at:m,updated_at:y}});return{items:a,assets:a,...o}};var FIe=({collection:e,fullPath:t,satellite:r})=>Bor({collection:e,fullPath:t,satellite:{...r,identity:r4(r?.identity)},options:{certified:!0}});var kIe=({assetKey:{fullPath:e,token:t},satellite:r})=>{let n={...r,identity:r4(r?.identity)};return`${wor(n)}${e}${(0,zT.nonNullish)(t)?`?token=${t}`:""}`};var jH=ne(et(),1);var i4=async()=>{let{satellite:e}=await on(),t=Gn("Clearing app assets...").start();try{let r=await vm({satellite:e});await $Ce({collection:ey,satellite:e}),await KF({satellite:e,domains:r}),console.log(`${(0,jH.green)("\u2714")} App assets cleared.`)}finally{t.stop()}},Uor=e=>{let t=e.replace(/\\/g,"/");return`${t.startsWith("/")?"":"/"}${t}`},RIe=async({fullPath:e})=>{let{satellite:t}=await on(),r=Gn(`Clearing ${e}...`).start();try{await FIe({collection:ey,satellite:t,fullPath:Uor(e)}),console.log(`${(0,jH.green)("\u2714")} ${e} cleared.`)}finally{r.stop()}};var BIe=async e=>{if(!await Zo()){Gv();return}if(Qt({args:e,options:["-f","--fullpath","--fullPath"]})){let t=qt({args:e,option:"-f"})??qt({args:e,option:"--fullpath"})??qt({args:e,option:"--fullPath"});if((0,jIe.isNullish)(t)){console.log(`You did not provide a ${(0,$Ie.yellow)("fullPath")} to delete.`);return}await RIe({fullPath:t});return}await i4()};var Rt=ne(Xe(),1);var XIe=ne(et(),1);var MIe=()=>new cd({projectName:yr.config.projectStateName}),LIe=({satelliteId:e})=>MIe().get("satellites")?.[e]?.lastAppliedConfig,UIe=({satelliteId:e,lastAppliedConfig:{storage:t,datastore:r,auth:n,settings:i,collections:s}})=>{let o=MIe(),a=o.get("satellites"),c=a?.[e]?.lastAppliedConfig,u={...a??{},[e]:{lastAppliedConfig:{storage:t??c?.storage,datastore:r??c?.datastore,auth:n??c?.auth,settings:i??c?.settings,collections:s??c?.collections}}};o.set("satellites",u)};var qIe=1073741824n,zIe=31104000n,VIe=5000000000000n,ZIe="controllers",WIe=0n,KIe=0n;var HIe=ne(Xe(),1);import{createHash as qor}from"node:crypto";var zor=(e,t)=>t instanceof Object&&!(t instanceof Array)?Object.keys(t).sort().reduce((r,n)=>({...r,[n]:t[n]}),{}):t,Vor=(e,t)=>[zor,HIe.jsonReplacer].reduce((r,n)=>n(e,r),t),ba=e=>qor("sha256").update(JSON.stringify(e,Vor)).digest("hex");var i_=ne(Ig(),1),$H=ne(Kn(),1),GIe=ne(Xe(),1);var YIe=async({satellite:e})=>{let{satelliteId:t}=e,r=await hu(),{canisterStatus:n}=i_.ICManagementCanister.create({agent:r}),{settings:{freezing_threshold:i,reserved_cycles_limit:s,wasm_memory_limit:o,memory_allocation:a,compute_allocation:c,log_visibility:u}}=await n($H.Principal.fromText(t));return{freezingThreshold:i,reservedCyclesLimit:s,logVisibility:"public"in u?"public":"controllers",heapMemoryLimit:o,memoryAllocation:a,computeAllocation:c}},JIe=async({settings:e,satellite:t})=>{let{freezingThreshold:r,reservedCyclesLimit:n,logVisibility:i,heapMemoryLimit:s,memoryAllocation:o,computeAllocation:a}=e,{satelliteId:c}=t,u=await hu(),{updateSettings:l}=i_.ICManagementCanister.create({agent:u});await l({canisterId:$H.Principal.fromText(c),settings:{freezingThreshold:r,reservedCyclesLimit:n,logVisibility:(0,GIe.isNullish)(i)?void 0:i==="public"?i_.LogVisibility.Public:i_.LogVisibility.Controllers,wasmMemoryLimit:s,memoryAllocation:o,computeAllocation:a}})};var s4=async()=>{let{satellite:e,satelliteConfig:t}=await on(),{satelliteId:r}=e,n=await Hor({satellite:e,satelliteConfig:t}),i=LIe({satelliteId:r}),s=await Jor({currentConfig:n,lastAppliedConfig:i,satelliteConfig:t});if(Object.values(s).filter(Rt.nonNullish).length===0){console.log("\u{1F937}\u200D\u2642\uFE0F No configuration changes detected.");return}let o=await Gor({satellite:e,editConfig:s});Zor({results:o,settings:s.settings,satelliteId:r}),Wor(o)},Zor=({results:e,settings:t,satelliteId:r})=>{let n=p=>e[p].status==="fulfilled"?e[p].value:void 0,i=n(0),s=n(1),o=n(2),a=p=>e[p].status==="fulfilled"?e[p].value?.map(d=>d.status==="fulfilled"?d.value:void 0).filter(Rt.nonNullish).reduce((d,f)=>({...d,[f.collection]:QIe(f)}),{}):void 0,c=a(4),u=a(5),l={storage:(0,Rt.nonNullish)(i)?ba(i):void 0,datastore:(0,Rt.nonNullish)(s)?ba(s):void 0,auth:(0,Rt.nonNullish)(o)?ba(o):void 0,settings:(0,Rt.nonNullish)(t)?ba(t):void 0,collections:(0,Rt.nonNullish)(c)||(0,Rt.nonNullish)(u)?{storage:c,datastore:u}:void 0};UIe({lastAppliedConfig:l,satelliteId:r})},Wor=e=>{let t=e.filter(s=>s.status==="rejected"),r=s=>e[s].status==="fulfilled"?(e[s].value??[]).filter(o=>o.status==="rejected"):[],n=[...r(4),...r(5)],i=[...t,...n];if(i.length===0){console.log("\u2705 Configuration applied.");return}console.log((0,XIe.red)(`The configuration failed with ${i.length} error${i.length>1?"s":""} \u{1F622}.`)),i.forEach((s,o)=>{console.log(`${o}:`,s.reason instanceof Error?s.reason.message:s.reason)})},Kor=async({satellite:e,satelliteConfig:t})=>{let{storage:r,datastore:n,authentication:i,settings:s,collections:o}=t,a=o?.storage,c=o?.datastore,[u,l,p,d,f,h]=await Promise.all([(0,Rt.nonNullish)(r)?HCe({satellite:e}):Promise.resolve(),(0,Rt.nonNullish)(n)?GCe({satellite:e}):Promise.resolve(),(0,Rt.nonNullish)(i)?KCe({satellite:e}):Promise.resolve(),(0,Rt.nonNullish)(s)?YIe({satellite:e}):Promise.resolve(),(0,Rt.nonNullish)(a)&&a.length>0?hH({type:"storage",satellite:e}):Promise.resolve(void 0),(0,Rt.nonNullish)(c)&&c.length>0?hH({type:"db",satellite:e}):Promise.resolve(void 0)]),m=({items:y})=>y.reduce((g,v)=>({...g,[v.collection]:[v,QIe(v)]}),{});return{...(0,Rt.nonNullish)(u)&&{storage:[u,ba(u)]},...(0,Rt.nonNullish)(l)&&{datastore:[l,ba(l)]},...(0,Rt.nonNullish)(p)&&{auth:[p,ba(p)]},...(0,Rt.nonNullish)(d)&&{settings:[d,ba(d)]},...(0,Rt.nonNullish)(f)&&{storageCollections:m(f)},...(0,Rt.nonNullish)(h)&&{datastoreCollections:m(h)}}},Hor=async e=>{let t=Gn("Loading configuration...").start();try{return await Kor(e)}finally{t.stop()}},Gor=async({satellite:e,editConfig:t})=>{let r=Gn("Configuring...").start();try{return await Yor({satellite:e,editConfig:t})}finally{r.stop()}},Yor=async({satellite:e,editConfig:t})=>{let{storage:r,authentication:n,datastore:i,settings:s,collections:o}=t,a=o?.storage,c=o?.datastore,u=async({collections:l,type:p})=>await Promise.allSettled(l.map(async d=>await eIe({rule:d,type:p,satellite:e})));return await Promise.allSettled([(0,Rt.isNullish)(r)?Promise.resolve():VCe({config:{...r,headers:r.headers??[]},satellite:e}),(0,Rt.isNullish)(i)?Promise.resolve():ZCe({config:i,satellite:e}),(0,Rt.isNullish)(n)?Promise.resolve():WCe({config:n,satellite:e}),(0,Rt.isNullish)(s)?Promise.resolve():JIe({settings:s,satellite:e}),(0,Rt.isNullish)(a)||a.length===0?Promise.resolve(void 0):u({type:"storage",collections:a}),(0,Rt.isNullish)(c)||c.length===0?Promise.resolve(void 0):u({type:"db",collections:c})])},Jor=async({currentConfig:e,lastAppliedConfig:t,satelliteConfig:r})=>{let{storage:n,datastore:i,auth:s,settings:o,storageCollections:a,datastoreCollections:c}=e,u=()=>{if((0,Rt.isNullish)(o))return!0;let[I]=o;return I.computeAllocation===KIe&&I.memoryAllocation===WIe&&I.heapMemoryLimit===qIe&&I.freezingThreshold===zIe&&I.reservedCyclesLimit===VIe&&I.logVisibility===ZIe},l=()=>{let I=n?.[0].version;if((0,Rt.nonNullish)(I))return!1;let L=i?.[0].version;if((0,Rt.nonNullish)(L))return!1;let W=s?.[0].version;return(0,Rt.nonNullish)(W)||(0,Rt.nonNullish)(a)&&Object.keys(a).length>0||(0,Rt.nonNullish)(c)&&Object.keys(c).length>0?!1:u()},p=(0,Rt.isNullish)(t);if(p&&l())return r;let{storage:d,datastore:f,authentication:h,settings:m,collections:y}=r,g=y?.storage,v=y?.datastore,b=()=>{let I=n?.[0]?.version,L=i?.[0]?.version,W=s?.[0]?.version,he=({collections:U,currentCollections:R})=>(U??[]).map(({collection:ee,version:H,...D})=>({...D,collection:ee,version:H??R?.[ee]?.[0].version})),ae=he({collections:g,currentCollections:a}),Ee=he({collections:v,currentCollections:c});return{storage:(0,Rt.nonNullish)(d)&&(0,Rt.isNullish)(d.version)?{...d,version:I}:d,datastore:(0,Rt.nonNullish)(f)&&(0,Rt.isNullish)(f.version)?{...f,version:L}:f,authentication:(0,Rt.nonNullish)(h)&&(0,Rt.isNullish)(h.version)?{...h,version:W}:h,settings:m,...(0,Rt.nonNullish)(y)&&{collections:{...(0,Rt.nonNullish)(g)&&{storage:ae},...(0,Rt.nonNullish)(v)&&{datastore:Ee}}}}},x=I=>{let{storage:L,datastore:W,authentication:he,settings:ae,collections:Ee}=I,U=n?.[1],R=i?.[1],ee=s?.[1],H=o?.[1],D=({collections:ie,currentCollections:ge})=>ie?.filter(Pe=>{let V=ge?.[Pe.collection]?.[1],C={...Pe,...!("mutablePermissions"in Pe)&&{mutablePermissions:!0}};return(0,Rt.isNullish)(V)||V!==ba(C)}),j=D({collections:Ee?.storage,currentCollections:a}),k=D({collections:Ee?.datastore,currentCollections:c});return{storage:(0,Rt.nonNullish)(U)&&(0,Rt.nonNullish)(L)&&U===ba(L)?void 0:L,datastore:(0,Rt.nonNullish)(R)&&(0,Rt.nonNullish)(W)&&R===ba(W)?void 0:W,authentication:(0,Rt.nonNullish)(ee)&&(0,Rt.nonNullish)(he)&&ee===ba(he)?void 0:he,settings:(0,Rt.nonNullish)(H)&&(0,Rt.nonNullish)(ae)&&H===ba(ae)?void 0:ae,...((0,Rt.nonNullish)(j)&&j.length>0||(0,Rt.nonNullish)(k)&&k.length>0)&&{collections:{...(0,Rt.nonNullish)(j)&&j.length>0&&{storage:j},...(0,Rt.nonNullish)(k)&&k.length>0&&{datastore:k}}}}},E=async()=>(await si("This action will overwrite the current configuration of the Satellite. Are you sure you want to continue?"),x(b()));return p?await E():(()=>{let{storage:I,datastore:L,auth:W,settings:he,collections:ae}=t;if(n?.[1]!==I||i?.[1]!==L||s?.[1]!==W)return!1;let ee=({lastCollectionsHashes:D,currentCollections:j})=>Object.entries(D??{}).every(([k,ie])=>j?.[k]?.[1]===ie);if(!ee({lastCollectionsHashes:ae?.storage,currentCollections:a})||!ee({lastCollectionsHashes:ae?.datastore,currentCollections:c}))return!1;let H=o?.[1];return(0,Rt.nonNullish)(H)&&H===he||u()&&(0,Rt.isNullish)(m)})()?x(b()):await E()},QIe=({createdAt:e,updatedAt:t,...r})=>ba(r);var eNe=async()=>{await s4()};var fNe=ne(et(),1),LH=ne(Uu(),1);var sNe=ne(Xe(),1);var oNe=ne(et(),1);import{lstatSync as Xor}from"node:fs";var nNe=ne(et(),1),iNe=ne(Uu(),1);var tNe="0.0.14",rNe=900000000n;var o4=async()=>{let{satellite:e,satelliteConfig:t}=await on(),{assertions:r}=t;if(r?.heapMemory===!1)return;let n=await C0({satellite:e});if((0,iNe.compare)(n,tNe)<0){console.log(`Your satellite (${(0,nNe.yellow)(`v${n}`)}) is not up-to-date, and the memory size cannot be verified.${ms}`);return}let i=r?.heapMemory!==void 0&&typeof r.heapMemory!="boolean"?BigInt(r.heapMemory):rNe,{heap:s}=await YCe({satellite:e});if(s<i)return;let o=a=>Intl.NumberFormat("en-US",{maximumSignificantDigits:3}).format(Number(a)/1e6);await si(`\u26A0\uFE0F Your satellite's heap memory is ${o(s)} MB, which exceeds the recommended limit of ${o(i)} MB. Are you sure you want to proceed with the deployment?`)};var a4=e=>{let{length:t,[t-1]:r}=e;return r};var MH=async({startAfter:e,satellite:t})=>{let{items:r,items_page:n,matches_pages:i}=await n4({collection:ey,satellite:t,filter:{order:{desc:!0,field:"keys"},paginate:{startAfter:e,limit:500}}});if((n??0n)<(i??0n)){let s=await MH({startAfter:a4(r)?.fullPath,satellite:t});return[...r,...s]}return r};var aNe=async({deployFn:e,uploadFileFn:t,options:r})=>await uNe({deployFn:e,uploadFileFn:t,options:r}),cNe=async({deployFn:e,uploadFileFn:t,options:r})=>await uNe({deployFn:e,uploadFileFn:t,options:r}),uNe=async({deployFn:e,uploadFileFn:t,options:r})=>{let n=async()=>{await o4()},{satellite:i,satelliteConfig:s}=await on(),o=s.gzip??r.deprecatedGzip,a={...s,...(0,sNe.nonNullish)(o)&&{gzip:o}},c=async({startAfter:p})=>await MH({startAfter:p,satellite:i}),u=async p=>{let d={...p,satellite:i};await t(d)};await Cre({config:a});let l=await e({deploy:{config:a,listAssets:c,assertSourceDirExists:Qor,assertMemory:n,uploadFile:u},satellite:i});return l.result==="skipped"&&process.exit(0),await Ire({config:a}),l},Qor=e=>{try{Xor(e)}catch{console.log(`${(0,oNe.red)("Cannot proceed deployment.")}
|
|
800
800
|
Are you sure the folder containing your built app (the "source" tag in the configuration file for Juno) files is correctly configured, or have you built your app?`),process.exit(1)}};var lNe=ne(et(),1);var c4=async({args:e,proposalId:t})=>{if(Qt({args:e,options:["-k","--keep-staged"]}))return;console.log("");let n=Gn("Deleting staged assets...").start();try{let{satellite:i}=await on();await p2({cdn:{satellite:i},proposalIds:[t]}),n.stop(),console.log(`${(0,lNe.green)("\u2714")} Staged assets deleted.`)}catch(i){throw n.stop(),i}};var VT=ne(Xe(),1);var pNe=ne(et(),1);var u4=async()=>{let{satellite:e}=await on(),{satelliteId:t,...r}=e,n=await O0({moduleId:t,...r});if((0,VT.nonNullish)(n)){let{dependencies:s,version:o}=n;if((0,VT.isNullish)(s))return{result:"success",version:o};let a=jT({dependencies:s,dependencyId:Yc});if((0,VT.isNullish)(a))return console.log((0,pNe.red)("Cannot retrieve the current version of your Satellite \u{1F622}.")),{result:"error"};let[c,u]=a;return{result:"success",version:u}}return{result:"success",version:await C0({satellite:e})}};var hNe=async e=>{let t=await u4();if(t.result==="error")return;let r=(0,LH.compare)(t.version,"0.1.1")<0?"**/*.+(css|js|mjs)":void 0,n=Qt({args:e,options:["--clear"]});if(Qt({args:e,options:["-i","--immediate"]})){await dNe({clearOption:n,deprecatedGzip:r});return}if((0,LH.compare)(t.version,"0.1.0")<0){console.log(`${(0,fNe.yellow)("[Warn]")} Your Satellite is outdated. Please upgrade to take full advantage of the new deployment flow.`),await dNe({clearOption:n,deprecatedGzip:r});return}await ear({args:e,clearOption:n,deprecatedGzip:r})},ear=async({args:e,clearOption:t,deprecatedGzip:r})=>{let n=Qt({args:e,options:["--no-apply"]}),o=await aNe({deployFn:async({deploy:c,satellite:u})=>await Fre({deploy:{...c,includeAllFiles:t},proposal:{clearAssets:t,autoCommit:!n,cdn:{satellite:u}}}),uploadFileFn:async({filename:c,fullPath:u,data:l,collection:p,headers:d=[],encoding:f,satellite:h,proposalId:m})=>{let y=decodeURI(c),g=u??`/${p}/${y}`;await d2({cdn:{satellite:h},proposalId:m,asset:{filename:y,fullPath:g,data:l,collection:p,headers:d,encoding:f}})},options:{deprecatedGzip:r}});if(o.result!=="deployed")return;let{proposalId:a}=o;await c4({args:e,proposalId:a})},dNe=async({clearOption:e,deprecatedGzip:t})=>{e&&await i4(),await cNe({deployFn:async({deploy:i})=>await Nre(i),uploadFileFn:async({filename:i,fullPath:s,data:o,collection:a,headers:c,encoding:u,satellite:l})=>{await NIe({satellite:l,filename:i,fullPath:s,data:o,collection:a,headers:c,encoding:u})},options:{deprecatedGzip:t}})};var yNe=ne(et(),1);var mNe=ne(Xe(),1);var Nf=e=>{if(JA&&(0,mNe.nonNullish)(yr.containerUrl)){let t=URL.parse(yr.containerUrl);return`${t?.protocol??"http:"}//${e}.${(t?.host??"127.0.0.1:5987").replace("127.0.0.1","localhost")}`}return`https://${e}.icp0.io`},l4=e=>`${yr.console.urls.satellite}${e}`;var p4=async()=>{let{satellite:e}=await on(),{satelliteId:t}=e,r=Nf(t),n=l4(t);try{let i=sp()?[]:await vm({satellite:e});if(console.log(`
|
|
801
801
|
\u{1F6E0}\uFE0F ${T0(n)}`),i.length===0){console.log(`\u{1F6F0}\uFE0F ${T0(r)}`);return}i.forEach(({domain:s})=>{console.log(`\u{1F30D} ${T0(`https://${s}`)}`)})}catch{console.log((0,yNe.yellow)("Custom domains could not be listed"))}};var _Ne=ne(Xe(),1);var xNe=ne(et(),1);var N0=ne(Xe(),1);var d4=ne(et(),1),I0=ne(Ru(),1);import{unlink as tar}from"node:fs/promises";import{basename as rar}from"node:path";import{existsSync as UH}from"node:fs";import{join as qH}from"node:path";var s_=()=>{let e=qH(process.cwd(),"pnpm-lock.yaml");if(UH(e))return"pnpm";let t=qH(process.cwd(),"yarn.lock");if(UH(t))return"yarn";let r=qH(process.cwd(),"package-lock.json");if(UH(r))return"npm"};var nar=async()=>{let{configType:e}=await(0,I0.default)({type:"select",name:"configType",message:"What configuration file format do you prefer?",choices:[{title:"TypeScript",value:"ts"},{title:"JavaScript",value:"js"},{title:"JSON",value:"json"}],initial:0});return ki(e),e},f4=async({emulatorConfig:e}={})=>{await vNe({writeFn:async({source:r,...n})=>{await aDe({...n,config:{satellite:{source:r}},emulatorConfig:e})}})},bNe=async()=>{let e=await aar(),t=await car();await vNe({writeFn:async({source:n,...i})=>{await cDe({...i,config:{satellite:{id:e,source:n},...(0,N0.nonNullish)(t)&&{orbiter:{id:t}}}})}})},vNe=async({writeFn:e})=>{let t=s_(),r=await iar({pm:t}),{configType:n,configPath:i}=await sar();await e({configType:n,configPath:i,pm:t,source:r}),(0,N0.nonNullish)(i)&&rar(i)==="juno.json"&&await tar(i),n!=="json"&&oar({pm:t})},iar=async({pm:e})=>{let t=`${e??"npm"}${(0,N0.isNullish)(e)||e==="npm"?" run":""} build`,{output:r}=await(0,I0.default)({type:"select",name:"output",message:`What is the output folder of your \`${t}\` command?`,choices:[{title:"build",value:"build"},{title:"dist",value:"dist"},{title:"out",value:"out"},{title:"<not listed, manual entry>",value:"_manual_"}],initial:0});if(ki(r),r!=="_manual_")return r;let{source:n}=await(0,I0.default)([{type:"text",name:"source",message:"Please enter the name of your output folder"}]);return ki(n),n},sar=async()=>{if(!await Zo()){let e=dF();return(0,N0.nonNullish)(e)?e:{configType:await nar()}}return pF()},oar=({pm:e})=>{let t=`${e??"npm"} ${(0,N0.isNullish)(e)||e==="npm"?"i":"add"} @junobuild/config -D`;console.log(`${ms}\u{1F4A1} You can leverage your IDE's intellisense by installing the library: ${(0,d4.yellow)(t)}${ms}`)},aar=async()=>{let e=await q1(),t=await(e.length>0?uar(e):gNe());return t==="_manual_"?await gNe():t},car=async()=>{let e=await uc();if(e===void 0||e.length===0)return;let t=await lar(e);if(t!=="_none_")return t},uar=async e=>{let{satellite:t}=await(0,I0.default)({type:"select",name:"satellite",message:"Which satellite should be linked with this app?",choices:[...e.map(({p:r,n})=>({title:n,value:r})),{title:"<not listed, manual entry>",value:"_manual_"}],initial:0});return ki(t),t},gNe=async()=>{let{satellite:e}=await(0,I0.default)([{type:"text",name:"satellite",message:`What's the ${(0,d4.cyan)("id")} of your satellite?`}]);return ki(e,"The satellite ID is mandatory"),e},lar=async e=>{let{orbiter:t}=await(0,I0.default)({type:"select",name:"orbiter",message:"Which orbiter do you use for the analytics in this app?",choices:[...e.map(({p:r,n})=>({title:n??r,value:r})),{title:"<none>",value:"_none_"}],initial:0});return ki(t),t};var h4=async e=>{if(Qt({args:e,options:["--minimal"]})){await par();return}await dar(e)},par=async()=>{await ENe(),await f4()},dar=async e=>{let t=await pd();if((0,_Ne.isNullish)(t)){if(!await xy(`Your terminal is not authenticated. Would you like to ${(0,xNe.cyan)("log in")} now?`))return;await uT(e)}await ENe(),await bNe()},ENe=async()=>{await Zo()&&await si("Your existing configuration will be overwritten. Are you sure you want to continue?")};var wNe=async e=>{await Zo()||await h4(),await hNe(e),Qt({args:e,options:["--config"]})&&(console.log(""),await s4()),await p4()};var BFe=ne(et(),1);var Qs=ne(et(),1);var TNe=`Usage: ${(0,Qs.green)("juno")} ${(0,Qs.cyan)("dev")} ${(0,Qs.magenta)("<subcommand>")} ${(0,Qs.yellow)("[options]")}
|
|
802
802
|
|