From a640f9120513b21c74ec88e7fab9ecb744ebb85f Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Wed, 2 Oct 2024 13:11:30 +0100 Subject: [PATCH 01/14] fix: change default instace type to M5 large --- src/bin/super/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/super/util.rs b/src/bin/super/util.rs index c78e2dc2..de3e7a5f 100644 --- a/src/bin/super/util.rs +++ b/src/bin/super/util.rs @@ -351,7 +351,7 @@ async fn create_ec2_instance( let result = client .run_instances() .image_id(image_id) - .instance_type(InstanceType::T3Medium) + .instance_type(InstanceType::M5Large) .security_group_ids(security_group_id) .key_name(key_name) .min_count(1) From 6adb9e6cdcb739b39be3c4e1c4b6e73441e7af4a Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Wed, 2 Oct 2024 14:14:25 +0100 Subject: [PATCH 02/14] update: create ec2 backend --- src/bin/super/cmd.rs | 1 - src/bin/super/mod.rs | 5 +---- src/bin/super/util.rs | 21 +++++++++++---------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/bin/super/cmd.rs b/src/bin/super/cmd.rs index 20b37657..1fc85e0b 100644 --- a/src/bin/super/cmd.rs +++ b/src/bin/super/cmd.rs @@ -109,6 +109,5 @@ pub struct AccessNodesInfo { #[derive(Serialize, Deserialize, Debug, Clone)] pub struct CreateEc2InstanceInfo { pub name: String, - pub swarm_number: i64, pub vanity_address: Option, } diff --git a/src/bin/super/mod.rs b/src/bin/super/mod.rs index 128eb63c..e414f3a9 100644 --- a/src/bin/super/mod.rs +++ b/src/bin/super/mod.rs @@ -302,10 +302,7 @@ pub async fn super_handle( Ok(_) => { res = SuperSwarmResponse { success: true, - message: format!( - "Swarm{}.sphinx.chat was created successfully", - &info.swarm_number - ), + message: format!("{} was created successfully", &info.name.clone()), data: None, } } diff --git a/src/bin/super/util.rs b/src/bin/super/util.rs index 2e07c628..a04fcd21 100644 --- a/src/bin/super/util.rs +++ b/src/bin/super/util.rs @@ -21,6 +21,7 @@ use crate::cmd::{ AccessNodesInfo, AddSwarmResponse, CreateEc2InstanceInfo, LoginResponse, SuperSwarmResponse, }; use crate::state::{RemoteStack, Super}; +use rand::Rng; use tokio::time::{sleep, Duration}; pub fn add_new_swarm_details( @@ -241,9 +242,9 @@ pub async fn accessing_child_container_controller( } async fn create_ec2_instance( - swarm_number: i64, + swarm_name: String, vanity_address: Option, -) -> Result { +) -> Result<(String, i32), Error> { let region = getenv("AWS_S3_REGION_NAME")?; let region_provider = RegionProviderChain::first_try(Some(Region::new(region))); @@ -267,7 +268,9 @@ async fn create_ec2_instance( let super_token = getenv("SUPER_TOKEN")?; - let swarm_name = format!("swarm{}", swarm_number); + let swarm_name = format!("swarm{}", swarm_name); + + let swarm_number = rand::thread_rng().gen_range(100000..1000000); let device_name = getenv("AWS_DEVICE_NAME")?; @@ -307,7 +310,7 @@ async fn create_ec2_instance( docker network create sphinx-swarm && \ touch .env && \ - echo "HOST={swarm_name}.sphinx.chat" >> .env && \ + echo "HOST=swarm{swarm_number}.sphinx.chat" >> .env && \ echo 'NETWORK=bitcoin' >> .env && \ echo 'AWS_ACCESS_KEY_ID={aws_access_key_id}' >> .env && \ echo 'AWS_SECRET_ACCESS_KEY={aws_access_token}' >> .env && \ @@ -364,8 +367,6 @@ async fn create_ec2_instance( .send() .await?; - log::info!("Result from creating instance is back"); - if result.instances().is_empty() { return Err(anyhow!("Failed to create instance")); } @@ -373,7 +374,7 @@ async fn create_ec2_instance( let instance_id: String = result.instances()[0].instance_id().unwrap().to_string(); println!("Created instance with ID: {}", instance_id); - Ok(instance_id) + Ok((instance_id, swarm_number)) } async fn get_instance_ip(instance_id: &str) -> Result { @@ -473,13 +474,13 @@ async fn add_domain_name_to_route53(domain_name: &str, public_ip: &str) -> Resul //Sample execution function pub async fn create_swarm_ec2(info: &CreateEc2InstanceInfo) -> Result<(), Error> { let ec2_intance_id = - create_ec2_instance(info.swarm_number.clone(), info.vanity_address.clone()).await?; + create_ec2_instance(info.name.clone(), info.vanity_address.clone()).await?; sleep(Duration::from_secs(40)).await; - let ec2_ip_address = get_instance_ip(&ec2_intance_id).await?; + let ec2_ip_address = get_instance_ip(&ec2_intance_id.0).await?; let _ = add_domain_name_to_route53( - &format!("*.swarm{}.sphinx.chat", info.swarm_number), + &format!("*.swarm{}.sphinx.chat", &ec2_intance_id.1), &ec2_ip_address, ) .await?; From b441e11f913bd61d71fd6bb8088455dab35434c9 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Wed, 2 Oct 2024 16:51:41 +0100 Subject: [PATCH 03/14] update: update ui to accomodate new flow --- app/src/api/swarm.ts | 3 - src/bin/super/superapp/src/Remotes.svelte | 149 ++++++++++++++++++---- 2 files changed, 122 insertions(+), 30 deletions(-) diff --git a/app/src/api/swarm.ts b/app/src/api/swarm.ts index d041bbf3..35f9f221 100644 --- a/app/src/api/swarm.ts +++ b/app/src/api/swarm.ts @@ -293,15 +293,12 @@ export async function update_child_swarm_containers({ export async function create_new_swarm_ec2({ name, vanity_address, - swarm_number, }: { vanity_address?: string; name: string; - swarm_number: number; }) { return await swarmCmd("CreateNewEc2Instance", { vanity_address, name, - swarm_number, }); } diff --git a/src/bin/super/superapp/src/Remotes.svelte b/src/bin/super/superapp/src/Remotes.svelte index d146098e..4c9bb047 100644 --- a/src/bin/super/superapp/src/Remotes.svelte +++ b/src/bin/super/superapp/src/Remotes.svelte @@ -48,8 +48,11 @@ let loading = false; let errors = []; let name = ""; - let swarm_num; let vanity_address = ""; + let domain = ".sphinx.chat"; + let swarm_name_suffix = "-Swarm"; + let vanity_input_width = 1000; + let swarm_name_width = 1000; let selectedRowIds = []; @@ -442,20 +445,38 @@ async function handleSubmitCreateEc2() { isSubmitting = true; - const data = { name, swarm_number: Number(swarm_num), vanity_address }; + const data = { + name: `${name}${swarm_name_suffix}`, + vanity_address: `${vanity_address}${domain}`, + }; const response = await create_new_swarm_ec2(data); message = response.message; if (response.success === true) { open_create_ec2 = false; name = ""; vanity_address = ""; - swarm_num = null; show_notification = true; } else { error_notification = true; } isSubmitting = false; } + + function updateVanityAddressWidth() { + const span = document.querySelector(".vanity_address_measure"); + vanity_input_width = span.offsetWidth; + if (!vanity_input_width) { + vanity_input_width = 1000; + } + } + + function updateSwarmnameWidth() { + const span = document.querySelector(".swarm_name_measure"); + swarm_name_width = span.offsetWidth; + if (!swarm_name_width) { + swarm_name_width = 1000; + } + }
@@ -615,7 +636,7 @@ (open_create_ec2 = false)} @@ -636,30 +657,43 @@ /> {/if} -
- -
-
- +
+ +
+
+ {name} + +
+ {#if name.length > 0} + {swarm_name_suffix} + {/if} +
-
- +
+ +
+
+ {vanity_address} + +
+ {#if vanity_address.length > 0} + {domain} + {/if} +
@@ -678,4 +712,65 @@ .success_toast_container { margin-bottom: 1.2rem; } + + .custom_text_input_container { + margin-top: 1rem; + display: flex; + flex-direction: column; + gap: 0.4rem; + } + + .custom_input_container { + display: flex; + align-items: center; + width: 100%; + padding: 1rem; + /* overflow: hidden; */ + border: solid 1px #494949; + border-radius: 0.5rem; + margin-bottom: 1rem; + } + + .suffix { + font-size: 1rem; + font-family: "Barlow"; + width: 100%; + color: #49c998; + margin-left: -2px; + } + + .custom_input { + border: none; + outline: none; + margin: 0; + padding: 0; + font-size: 1rem; + font-family: "Barlow"; + background-color: transparent; + width: auto; + color: white; + padding: 0; + } + + .vanity_address_measure { + visibility: hidden; + position: absolute; + white-space: nowrap; + font-family: "Barlow"; + font-size: 1rem; + padding: 0; + border: none; + margin: 0; + } + + .swarm_name_measure { + visibility: hidden; + position: absolute; + white-space: nowrap; + font-family: "Barlow"; + font-size: 1rem; + padding: 0; + border: none; + margin: 0; + } From 93b7015f0a06db8e3b07dd129d28373e7f5ffe7f Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Wed, 2 Oct 2024 19:29:41 +0100 Subject: [PATCH 04/14] update: added subnet id for vpc production and log error when creating instance --- src/bin/super/util.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/super/util.rs b/src/bin/super/util.rs index a04fcd21..64e308fa 100644 --- a/src/bin/super/util.rs +++ b/src/bin/super/util.rs @@ -278,6 +278,8 @@ async fn create_ec2_instance( let security_group_id = getenv("AWS_SECURITY_GROUP_ID")?; + let subnet_id = getenv("AWS_SUBNET_ID")?; + let key_name = getenv("AWS_KEY_NAME")?; let custom_domain = vanity_address.unwrap_or_else(|| String::from("")); @@ -364,7 +366,12 @@ async fn create_ec2_instance( .user_data(base64::encode(user_data_script)) .block_device_mappings(block_device) .tag_specifications(tag_specification) + .subnet_id(subnet_id) .send() + .map_err(|err| { + log::error!("Error Creating instance instance: {}", err); + anyhow!(err.to_string()) + }) .await?; if result.instances().is_empty() { From 006e7ce4b02e298a0038ac59d8a3c3c0ea82bbd8 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Wed, 2 Oct 2024 20:42:51 +0100 Subject: [PATCH 05/14] fix: input does not over flow --- src/bin/super/superapp/src/Remotes.svelte | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/bin/super/superapp/src/Remotes.svelte b/src/bin/super/superapp/src/Remotes.svelte index 4c9bb047..994c9e77 100644 --- a/src/bin/super/superapp/src/Remotes.svelte +++ b/src/bin/super/superapp/src/Remotes.svelte @@ -51,8 +51,9 @@ let vanity_address = ""; let domain = ".sphinx.chat"; let swarm_name_suffix = "-Swarm"; - let vanity_input_width = 1000; - let swarm_name_width = 1000; + const max_input_with = 600; + let vanity_input_width = max_input_with; + let swarm_name_width = max_input_with; let selectedRowIds = []; @@ -462,19 +463,22 @@ isSubmitting = false; } - function updateVanityAddressWidth() { + function updateVanityAddressWidth(event) { + console.log("We got here too"); + vanity_address = event.target.value.replace(/\s+/g, ""); const span = document.querySelector(".vanity_address_measure"); vanity_input_width = span.offsetWidth; if (!vanity_input_width) { - vanity_input_width = 1000; + vanity_input_width = max_input_with; } } - function updateSwarmnameWidth() { + function updateSwarmnameWidth(event) { + name = event.target.value.replace(/\s+/g, ""); const span = document.querySelector(".swarm_name_measure"); swarm_name_width = span.offsetWidth; if (!swarm_name_width) { - swarm_name_width = 1000; + swarm_name_width = max_input_with; } } @@ -725,7 +729,7 @@ align-items: center; width: 100%; padding: 1rem; - /* overflow: hidden; */ + overflow: hidden; border: solid 1px #494949; border-radius: 0.5rem; margin-bottom: 1rem; @@ -743,7 +747,6 @@ border: none; outline: none; margin: 0; - padding: 0; font-size: 1rem; font-family: "Barlow"; background-color: transparent; From ffa25ceb3f8e99b2373f151eb6946a7660a6a199 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Wed, 2 Oct 2024 20:44:14 +0100 Subject: [PATCH 06/14] clear details onclose --- src/bin/super/superapp/src/Remotes.svelte | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bin/super/superapp/src/Remotes.svelte b/src/bin/super/superapp/src/Remotes.svelte index 994c9e77..d571589d 100644 --- a/src/bin/super/superapp/src/Remotes.svelte +++ b/src/bin/super/superapp/src/Remotes.svelte @@ -442,6 +442,8 @@ function handleOnCloseCreateEc2() { open_create_ec2 = false; + name = ""; + vanity_address = ""; } async function handleSubmitCreateEc2() { From 3d9ac6da935a00b8e0547827c084c8ec3eea42f3 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Wed, 2 Oct 2024 21:12:58 +0100 Subject: [PATCH 07/14] feat: trim pubkey to only needed part --- .../SecondBrain/roles/setSuperAdmin.svelte | 1 + .../SecondBrain/roles/userRecord.svelte | 3 +++ app/src/components/input/input.svelte | 19 +++++++++++++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/app/src/components/SecondBrain/roles/setSuperAdmin.svelte b/app/src/components/SecondBrain/roles/setSuperAdmin.svelte index 1013fcd6..29ef7baf 100644 --- a/app/src/components/SecondBrain/roles/setSuperAdmin.svelte +++ b/app/src/components/SecondBrain/roles/setSuperAdmin.svelte @@ -142,6 +142,7 @@ placeholder="Enter Admin Pubkey ..." bind:value={superAdminPubkey} onInput={handleAdminPubkeyInput} + isPubkey={true} />
diff --git a/app/src/components/SecondBrain/roles/userRecord.svelte b/app/src/components/SecondBrain/roles/userRecord.svelte index 81ca0e56..9f5dbe6d 100644 --- a/app/src/components/SecondBrain/roles/userRecord.svelte +++ b/app/src/components/SecondBrain/roles/userRecord.svelte @@ -446,6 +446,7 @@ placeholder="Paste Pubkey ..." onInput={updateUserPubkey} value={userpubkey} + isPubkey={true} /> 66) { + value = splitPubkey(value); + } + + onInput(value); } From fc60dccfae1fbea058f223f26fc1253143332d05 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Thu, 3 Oct 2024 11:54:17 +0100 Subject: [PATCH 08/14] update: add instance type to create a swarm --- src/bin/super/cmd.rs | 1 + src/bin/super/util.rs | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/bin/super/cmd.rs b/src/bin/super/cmd.rs index 1fc85e0b..9befeea8 100644 --- a/src/bin/super/cmd.rs +++ b/src/bin/super/cmd.rs @@ -110,4 +110,5 @@ pub struct AccessNodesInfo { pub struct CreateEc2InstanceInfo { pub name: String, pub vanity_address: Option, + pub instance_type: String, } diff --git a/src/bin/super/util.rs b/src/bin/super/util.rs index 64e308fa..f29a97d4 100644 --- a/src/bin/super/util.rs +++ b/src/bin/super/util.rs @@ -1,4 +1,5 @@ use std::collections::HashMap; +use std::str::FromStr; use anyhow::{anyhow, Error}; use aws_config::meta::region::RegionProviderChain; @@ -244,6 +245,7 @@ pub async fn accessing_child_container_controller( async fn create_ec2_instance( swarm_name: String, vanity_address: Option, + instance_type_name: String, ) -> Result<(String, i32), Error> { let region = getenv("AWS_S3_REGION_NAME")?; let region_provider = RegionProviderChain::first_try(Some(Region::new(region))); @@ -355,10 +357,15 @@ async fn create_ec2_instance( .ebs(EbsBlockDevice::builder().volume_size(100).build()) .build(); + let instance_type = InstanceType::from_str(&instance_type_name).map_err(|err| { + log::error!("Invalid instance type: {}", err); + anyhow!(err.to_string()) + })?; + let result = client .run_instances() .image_id(image_id) - .instance_type(InstanceType::M5Large) + .instance_type(instance_type) .security_group_ids(security_group_id) .key_name(key_name) .min_count(1) @@ -480,8 +487,12 @@ async fn add_domain_name_to_route53(domain_name: &str, public_ip: &str) -> Resul //Sample execution function pub async fn create_swarm_ec2(info: &CreateEc2InstanceInfo) -> Result<(), Error> { - let ec2_intance_id = - create_ec2_instance(info.name.clone(), info.vanity_address.clone()).await?; + let ec2_intance_id = create_ec2_instance( + info.name.clone(), + info.vanity_address.clone(), + info.instance_type.clone(), + ) + .await?; sleep(Duration::from_secs(40)).await; From df073a3ed7b257bd4610ac6c5b4098a05455b6a5 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Thu, 3 Oct 2024 12:33:07 +0100 Subject: [PATCH 09/14] feat: add aws instance type --- src/bin/super/cmd.rs | 1 + src/bin/super/mod.rs | 8 ++++++-- src/bin/super/state.rs | 6 ++++++ src/bin/super/util.rs | 32 +++++++++++++++++++++++++++++++- 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/bin/super/cmd.rs b/src/bin/super/cmd.rs index 9befeea8..500eb2c9 100644 --- a/src/bin/super/cmd.rs +++ b/src/bin/super/cmd.rs @@ -75,6 +75,7 @@ pub enum SwarmCmd { StartChildSwarmContainers(AccessNodesInfo), UpdateChildSwarmContainers(AccessNodesInfo), CreateNewEc2Instance(CreateEc2InstanceInfo), + GetAwsInstanceTypes, } #[derive(Serialize, Deserialize, Debug, Clone)] diff --git a/src/bin/super/mod.rs b/src/bin/super/mod.rs index e414f3a9..08551e8f 100644 --- a/src/bin/super/mod.rs +++ b/src/bin/super/mod.rs @@ -11,8 +11,8 @@ use sphinx_swarm::utils::getenv; use state::RemoteStack; use state::Super; use util::{ - accessing_child_container_controller, add_new_swarm_details, get_child_swarm_config, - get_child_swarm_containers, + accessing_child_container_controller, add_new_swarm_details, get_aws_instance_types, + get_child_swarm_config, get_child_swarm_containers, }; use crate::checker::swarm_checker; @@ -296,6 +296,10 @@ pub async fn super_handle( Some(serde_json::to_string(&res)?) } + SwarmCmd::GetAwsInstanceTypes => { + let res = get_aws_instance_types(); + Some(serde_json::to_string(&res)?) + } SwarmCmd::CreateNewEc2Instance(info) => { let res: SuperSwarmResponse; match create_swarm_ec2(&info).await { diff --git a/src/bin/super/state.rs b/src/bin/super/state.rs index e4cd2ad6..24c46412 100644 --- a/src/bin/super/state.rs +++ b/src/bin/super/state.rs @@ -22,6 +22,12 @@ pub struct RemoteStack { pub default_host: Option, } +#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Default)] +pub struct AwsInstanceType { + pub name: String, + pub value: String, +} + #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Default)] pub struct BotCred { pub bot_id: String, diff --git a/src/bin/super/util.rs b/src/bin/super/util.rs index f29a97d4..2265ec7b 100644 --- a/src/bin/super/util.rs +++ b/src/bin/super/util.rs @@ -21,7 +21,7 @@ use sphinx_swarm::utils::{getenv, make_reqwest_client}; use crate::cmd::{ AccessNodesInfo, AddSwarmResponse, CreateEc2InstanceInfo, LoginResponse, SuperSwarmResponse, }; -use crate::state::{RemoteStack, Super}; +use crate::state::{AwsInstanceType, RemoteStack, Super}; use rand::Rng; use tokio::time::{sleep, Duration}; @@ -242,6 +242,36 @@ pub async fn accessing_child_container_controller( res } +pub fn get_aws_instance_types() -> SuperSwarmResponse { + let instance_types: Vec = vec![ + AwsInstanceType { + name: "G4dn 2XLarge".to_string(), + value: "G4dn2xlarge".to_string(), + }, + AwsInstanceType { + name: "M5 Large".to_string(), + value: "M5Large".to_string(), + }, + AwsInstanceType { + name: "M5 XLarge".to_string(), + value: "M5Xlarge".to_string(), + }, + ]; + + match serde_json::to_value(instance_types) { + Ok(instance_value) => SuperSwarmResponse { + success: true, + message: "Aws Instance types loaded successfully".to_string(), + data: Some(instance_value), + }, + Err(err) => SuperSwarmResponse { + success: false, + message: err.to_string(), + data: None, + }, + } +} + async fn create_ec2_instance( swarm_name: String, vanity_address: Option, From 05fc23e48ae083cc880aa2a26a4cb00a636d5169 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Thu, 3 Oct 2024 13:17:29 +0100 Subject: [PATCH 10/14] update: add ec2 size to frontend --- app/src/api/cmd.ts | 3 +- app/src/api/swarm.ts | 7 +++++ src/bin/super/superapp/src/Remotes.svelte | 36 +++++++++++++++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/app/src/api/cmd.ts b/app/src/api/cmd.ts index b4fd5c16..db1dd0ae 100644 --- a/app/src/api/cmd.ts +++ b/app/src/api/cmd.ts @@ -85,7 +85,8 @@ export type Cmd = | "StopChildSwarmContainers" | "StartChildSwarmContainers" | "UpdateChildSwarmContainers" - | "CreateNewEc2Instance"; + | "CreateNewEc2Instance" + | "GetAwsInstanceTypes"; interface CmdData { cmd: Cmd; diff --git a/app/src/api/swarm.ts b/app/src/api/swarm.ts index 35f9f221..a85819b2 100644 --- a/app/src/api/swarm.ts +++ b/app/src/api/swarm.ts @@ -293,12 +293,19 @@ export async function update_child_swarm_containers({ export async function create_new_swarm_ec2({ name, vanity_address, + instance_type, }: { vanity_address?: string; name: string; + instance_type: string; }) { return await swarmCmd("CreateNewEc2Instance", { vanity_address, name, + instance_type, }); } + +export async function get_aws_instance_types() { + return await swarmCmd("GetAwsInstanceTypes"); +} diff --git a/src/bin/super/superapp/src/Remotes.svelte b/src/bin/super/superapp/src/Remotes.svelte index d571589d..1be64ff8 100644 --- a/src/bin/super/superapp/src/Remotes.svelte +++ b/src/bin/super/superapp/src/Remotes.svelte @@ -11,6 +11,8 @@ InlineNotification, Loading, ToolbarBatchActions, + Select, + SelectItem, } from "carbon-components-svelte"; import { UpdateNow, Stop } from "carbon-icons-svelte"; @@ -29,6 +31,7 @@ start_child_swarm_containers, stop_child_swarm_containers, update_child_swarm_containers, + get_aws_instance_types, } from "../../../../../app/src/api/swarm"; let open_create_edit = false; @@ -54,6 +57,8 @@ const max_input_with = 600; let vanity_input_width = max_input_with; let swarm_name_width = max_input_with; + let aws_instance_types = []; + let selected_instance = ""; let selectedRowIds = []; @@ -101,10 +106,19 @@ } } + async function getAwsInstanceType() { + const instanceTypes = await get_aws_instance_types(); + if (instanceTypes.success) { + aws_instance_types = [...instanceTypes.data]; + } + } + onMount(async () => { await getConfig(); await getConfigSortByUnhealthy(); + + await getAwsInstanceType(); }); function openAddSwarmModal() { @@ -444,6 +458,9 @@ open_create_ec2 = false; name = ""; vanity_address = ""; + selected_instance = ""; + vanity_input_width = max_input_with; + swarm_name_width = max_input_with; } async function handleSubmitCreateEc2() { @@ -451,13 +468,18 @@ const data = { name: `${name}${swarm_name_suffix}`, vanity_address: `${vanity_address}${domain}`, + instance_type: selected_instance, }; + const response = await create_new_swarm_ec2(data); message = response.message; if (response.success === true) { open_create_ec2 = false; name = ""; vanity_address = ""; + selected_instance = ""; + vanity_input_width = max_input_with; + swarm_name_width = max_input_with; show_notification = true; } else { error_notification = true; @@ -466,7 +488,6 @@ } function updateVanityAddressWidth(event) { - console.log("We got here too"); vanity_address = event.target.value.replace(/\s+/g, ""); const span = document.querySelector(".vanity_address_measure"); vanity_input_width = span.offsetWidth; @@ -642,7 +663,7 @@ (open_create_ec2 = false)} @@ -682,6 +703,17 @@ {/if}
+
From e6af43f6384eb7092c3b0a3b738298f1c90a6a6a Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Thu, 3 Oct 2024 13:43:22 +0100 Subject: [PATCH 11/14] fix: get the right content for instance value --- src/bin/super/util.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bin/super/util.rs b/src/bin/super/util.rs index 2265ec7b..d9ee71fe 100644 --- a/src/bin/super/util.rs +++ b/src/bin/super/util.rs @@ -246,15 +246,15 @@ pub fn get_aws_instance_types() -> SuperSwarmResponse { let instance_types: Vec = vec![ AwsInstanceType { name: "G4dn 2XLarge".to_string(), - value: "G4dn2xlarge".to_string(), + value: "g4dn.2xlarge".to_string(), }, AwsInstanceType { - name: "M5 Large".to_string(), - value: "M5Large".to_string(), + name: "M5 XLarge".to_string(), + value: "m5.xlarge".to_string(), }, AwsInstanceType { - name: "M5 XLarge".to_string(), - value: "M5Xlarge".to_string(), + name: "M5 Large".to_string(), + value: "m5.large".to_string(), }, ]; From 7f6e4978d202e0e01ddf2b9cb51d75dc82897fd1 Mon Sep 17 00:00:00 2001 From: Oluwatobi Bamidele Date: Thu, 3 Oct 2024 17:59:34 +0100 Subject: [PATCH 12/14] fix: fix remove swarm prefix --- src/bin/super/util.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/super/util.rs b/src/bin/super/util.rs index d9ee71fe..49d3be06 100644 --- a/src/bin/super/util.rs +++ b/src/bin/super/util.rs @@ -300,7 +300,7 @@ async fn create_ec2_instance( let super_token = getenv("SUPER_TOKEN")?; - let swarm_name = format!("swarm{}", swarm_name); + let swarm_name = format!("{}", swarm_name); let swarm_number = rand::thread_rng().gen_range(100000..1000000); From 2faeb82d05b775de0a7a574241739c66234fbd88 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Thu, 3 Oct 2024 17:00:48 +0000 Subject: [PATCH 13/14] ci: automatic build --- app/dist/assets/{index-4d51d08f.js => index-ea82fb0b.js} | 6 +++--- app/dist/index.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) rename app/dist/assets/{index-4d51d08f.js => index-ea82fb0b.js} (98%) diff --git a/app/dist/assets/index-4d51d08f.js b/app/dist/assets/index-ea82fb0b.js similarity index 98% rename from app/dist/assets/index-4d51d08f.js rename to app/dist/assets/index-ea82fb0b.js index 30135dbf..d0487bef 100644 --- a/app/dist/assets/index-4d51d08f.js +++ b/app/dist/assets/index-ea82fb0b.js @@ -13,7 +13,7 @@ var ap=Object.defineProperty;var cp=(i,t,n)=>t in i?ap(i,t,{enumerable:!0,config `+(p[23]&&"bx--dropdown--inline")+` `+(p[9]&&"bx--dropdown--disabled")+` `+(p[8]&&"bx--dropdown--light")),g[0]&512&&(b.disabled=p[9]),g[0]&2&&(b.open=p[1]),g[0]&2048&&(b.invalid=p[11]),g[0]&4096&&(b.invalidText=p[12]),g[0]&256&&(b.light=p[8]),g[0]&8192&&(b.warn=p[13]),g[0]&16384&&(b.warnText=p[14]),g[0]&7154207|g[1]&64&&(b.$$scope={dirty:g,ctx:p}),s.$set(b),!p[23]&&!p[11]&&!p[13]&&p[15]?u?u.p(p,g):(u=create_if_block$1f(p),u.c(),u.m(t,null)):u&&(u.d(1),u=null),set_attributes(t,h=get_spread_update(f,[g[0]&67108864&&p[26]])),toggle_class(t,"bx--dropdown__wrapper",!0),toggle_class(t,"bx--list-box__wrapper",!0),toggle_class(t,"bx--dropdown__wrapper--inline",p[23]),toggle_class(t,"bx--list-box__wrapper--inline",p[23]),toggle_class(t,"bx--dropdown__wrapper--inline--invalid",p[23]&&p[11])},i(p){r||(transition_in(s.$$.fragment,p),r=!0)},o(p){transition_out(s.$$.fragment,p),r=!1},d(p){p&&detach(t),c&&c.d(),destroy_component(s),u&&u.d(),l=!1,a()}}}function instance$1T(i,t,n){let s,o;const r=["items","itemToString","selectedId","type","direction","size","open","light","disabled","titleText","invalid","invalidText","warn","warnText","helperText","label","hideLabel","translateWithId","id","name","ref"];let l=compute_rest_props(t,r),{$$slots:a={},$$scope:c}=t,{items:u=[]}=t,{itemToString:f=se=>se.text||se.id}=t,{selectedId:h}=t,{type:p="default"}=t,{direction:g="bottom"}=t,{size:b=void 0}=t,{open:v=!1}=t,{light:y=!1}=t,{disabled:S=!1}=t,{titleText:T=""}=t,{invalid:w=!1}=t,{invalidText:A=""}=t,{warn:x=!1}=t,{warnText:C=""}=t,{helperText:I=""}=t,{label:M=void 0}=t,{hideLabel:E=!1}=t,{translateWithId:L=void 0}=t,{id:R="ccs-"+Math.random().toString(36)}=t,{name:O=void 0}=t,{ref:B=null}=t;const z=createEventDispatcher();let F=-1;function q(se){let re=F+se;if(u.length===0)return;re<0?re=u.length-1:re>=u.length&&(re=0);let me=u[re].disabled;for(;me;)re=re+se,re<0?re=u.length-1:re>=u.length&&(re=0),me=u[re].disabled;n(21,F=re)}const N=()=>{z("select",{selectedId:h,selectedItem:o})},ee=({target:se})=>{v&&B&&!B.contains(se)&&n(1,v=!1)},K=se=>{se.stopPropagation(),!S&&n(1,v=!v)};function Q(se){binding_callbacks[se?"unshift":"push"](()=>{B=se,n(2,B)})}const J=se=>{const{key:re}=se;["Enter","ArrowDown","ArrowUp"].includes(re)&&se.preventDefault(),re==="Enter"?(n(1,v=!v),F>-1&&u[F].id!==h&&(n(0,h=u[F].id),N(),n(1,v=!1))):re==="Tab"?(n(1,v=!1),B.blur()):re==="ArrowDown"?(v||n(1,v=!0),q(1)):re==="ArrowUp"?(v||n(1,v=!0),q(-1)):re==="Escape"&&n(1,v=!1)},Y=se=>{const{key:re}=se;if([" "].includes(re))se.preventDefault();else return;n(1,v=!v),F>-1&&u[F].id!==h&&(n(0,h=u[F].id),N(),n(1,v=!1))},ce=(se,re)=>{if(se.disabled){re.stopPropagation();return}n(0,h=se.id),N(),B.focus()},Z=(se,re)=>{se.disabled||n(21,F=re)},ge=({target:se})=>{S||n(1,v=B.contains(se)?!v:!1)};return i.$$set=se=>{n(27,t=assign(assign({},t),exclude_internal_props(se))),n(26,l=compute_rest_props(t,r)),"items"in se&&n(3,u=se.items),"itemToString"in se&&n(4,f=se.itemToString),"selectedId"in se&&n(0,h=se.selectedId),"type"in se&&n(5,p=se.type),"direction"in se&&n(6,g=se.direction),"size"in se&&n(7,b=se.size),"open"in se&&n(1,v=se.open),"light"in se&&n(8,y=se.light),"disabled"in se&&n(9,S=se.disabled),"titleText"in se&&n(10,T=se.titleText),"invalid"in se&&n(11,w=se.invalid),"invalidText"in se&&n(12,A=se.invalidText),"warn"in se&&n(13,x=se.warn),"warnText"in se&&n(14,C=se.warnText),"helperText"in se&&n(15,I=se.helperText),"label"in se&&n(16,M=se.label),"hideLabel"in se&&n(17,E=se.hideLabel),"translateWithId"in se&&n(18,L=se.translateWithId),"id"in se&&n(19,R=se.id),"name"in se&&n(20,O=se.name),"ref"in se&&n(2,B=se.ref),"$$scope"in se&&n(37,c=se.$$scope)},i.$$.update=()=>{i.$$.dirty[0]&32&&n(23,s=p==="inline"),i.$$.dirty[0]&9&&n(22,o=u.find(se=>se.id===h)),i.$$.dirty[0]&2&&(v||n(21,F=-1))},t=exclude_internal_props(t),[h,v,B,u,f,p,g,b,y,S,T,w,A,x,C,I,M,E,L,R,O,F,o,s,q,N,l,t,a,ee,K,Q,J,Y,ce,Z,ge,c]}class Dropdown extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1T,create_fragment$1U,safe_not_equal,{items:3,itemToString:4,selectedId:0,type:5,direction:6,size:7,open:1,light:8,disabled:9,titleText:10,invalid:11,invalidText:12,warn:13,warnText:14,helperText:15,label:16,hideLabel:17,translateWithId:18,id:19,name:20,ref:2},null,[-1,-1])}}const Dropdown$1=Dropdown;function create_if_block$1e(i){let t,n;return{c(){t=svg_element("title"),n=text(i[1])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o&2&&set_data(n,s[1])},d(s){s&&detach(t)}}}function create_fragment$1T(i){let t,n,s,o=i[1]&&create_if_block$1e(i),r=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:i[0]},{height:i[0]},i[2],i[3]],l={};for(let a=0;a{n(5,t=assign(assign({},t),exclude_internal_props(u))),n(3,l=compute_rest_props(t,r)),"size"in u&&n(0,a=u.size),"title"in u&&n(1,c=u.title)},i.$$.update=()=>{n(4,s=t["aria-label"]||t["aria-labelledby"]||c),n(2,o={"aria-hidden":s?void 0:!0,role:s?"img":void 0,focusable:Number(t.tabindex)===0?!0:void 0})},t=exclude_internal_props(t),[a,c,o,l,s]}class CheckmarkFilled extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1S,create_fragment$1T,safe_not_equal,{size:0,title:1})}}const CheckmarkFilled$1=CheckmarkFilled;function create_else_block$w(i){let t,n,s,o,r,l,a,c,u,f=i[0]&&create_if_block_2$s(i),h=[{"aria-atomic":"true"},{"aria-labelledby":i[4]},{"aria-live":u=i[1]?"assertive":"off"},i[6]],p={};for(let g=0;g{t=assign(assign({},t),exclude_internal_props(h)),n(6,r=compute_rest_props(t,o)),"small"in h&&n(0,l=h.small),"active"in h&&n(1,a=h.active),"withOverlay"in h&&n(2,c=h.withOverlay),"description"in h&&n(3,u=h.description),"id"in h&&n(4,f=h.id)},i.$$.update=()=>{i.$$.dirty&1&&n(5,s=l?"42":"44")},[l,a,c,u,f,s,r]}class Loading extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1R,create_fragment$1S,safe_not_equal,{small:0,active:1,withOverlay:2,description:3,id:4})}}const Loading$1=Loading;function create_fragment$1R(i){let t,n,s,o;const r=i[3].default,l=create_slot(r,i,i[2],null);let a=[i[1]],c={};for(let u=0;u{a=v,n(0,a)})}return i.$$set=v=>{t=assign(assign({},t),exclude_internal_props(v)),n(1,o=compute_rest_props(t,s)),"ref"in v&&n(0,a=v.ref),"$$scope"in v&&n(2,l=v.$$scope)},[a,o,l,r,c,u,f,h,p,g,b]}class Form extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1Q,create_fragment$1R,safe_not_equal,{ref:0})}}const Form$1=Form;function create_if_block$1c(i){let t,n;return{c(){t=svg_element("title"),n=text(i[1])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o&2&&set_data(n,s[1])},d(s){s&&detach(t)}}}function create_fragment$1Q(i){let t,n,s,o=i[1]&&create_if_block$1c(i),r=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:i[0]},{height:i[0]},i[2],i[3]],l={};for(let a=0;a{n(5,t=assign(assign({},t),exclude_internal_props(u))),n(3,l=compute_rest_props(t,r)),"size"in u&&n(0,a=u.size),"title"in u&&n(1,c=u.title)},i.$$.update=()=>{n(4,s=t["aria-label"]||t["aria-labelledby"]||c),n(2,o={"aria-hidden":s?void 0:!0,role:s?"img":void 0,focusable:Number(t.tabindex)===0?!0:void 0})},t=exclude_internal_props(t),[a,c,o,l,s]}class ErrorFilled extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1P,create_fragment$1Q,safe_not_equal,{size:0,title:1})}}const ErrorFilled$1=ErrorFilled;function create_if_block_3$k(i){let t,n;return t=new Loading$1({props:{small:!0,description:i[2],withOverlay:!1,active:i[0]==="active"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&4&&(r.description=s[2]),o&1&&(r.active=s[0]==="active"),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_2$r(i){let t,n;return t=new CheckmarkFilled$1({props:{class:"bx--inline-loading__checkmark-container",title:i[2]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&4&&(r.title=s[2]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$A(i){let t,n;return t=new ErrorFilled$1({props:{class:"bx--inline-loading--error",title:i[2]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&4&&(r.title=s[2]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$1b(i){let t,n;return{c(){t=element("div"),n=text(i[1]),toggle_class(t,"bx--inline-loading__text",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o&2&&set_data(n,s[1])},d(s){s&&detach(t)}}}function create_fragment$1P(i){let t,n,s,o,r,l,a,c;const u=[create_if_block_1$A,create_if_block_2$r,create_if_block_3$k],f=[];function h(v,y){return v[0]==="error"?0:v[0]==="finished"?1:v[0]==="inactive"||v[0]==="active"?2:-1}~(s=h(i))&&(o=f[s]=u[s](i));let p=i[1]&&create_if_block$1b(i),g=[{"aria-live":"assertive"},i[3]],b={};for(let v=0;v{f[S]=null}),check_outros()),~s?(o=f[s],o?o.p(v,y):(o=f[s]=u[s](v),o.c()),transition_in(o,1),o.m(n,null)):o=null),v[1]?p?p.p(v,y):(p=create_if_block$1b(v),p.c(),p.m(t,null)):p&&(p.d(1),p=null),set_attributes(t,b=get_spread_update(g,[{"aria-live":"assertive"},y&8&&v[3]])),toggle_class(t,"bx--inline-loading",!0)},i(v){l||(transition_in(o),l=!0)},o(v){transition_out(o),l=!1},d(v){v&&detach(t),~s&&f[s].d(),p&&p.d(),a=!1,run_all(c)}}}function instance$1O(i,t,n){const s=["status","description","iconDescription","successDelay"];let o=compute_rest_props(t,s),{status:r="active"}=t,{description:l=void 0}=t,{iconDescription:a=void 0}=t,{successDelay:c=1500}=t;const u=createEventDispatcher();let f;onMount(()=>()=>{clearTimeout(f)}),afterUpdate(()=>{r==="finished"&&(f=setTimeout(()=>{u("success")},c))});function h(v){bubble.call(this,i,v)}function p(v){bubble.call(this,i,v)}function g(v){bubble.call(this,i,v)}function b(v){bubble.call(this,i,v)}return i.$$set=v=>{t=assign(assign({},t),exclude_internal_props(v)),n(3,o=compute_rest_props(t,s)),"status"in v&&n(0,r=v.status),"description"in v&&n(1,l=v.description),"iconDescription"in v&&n(2,a=v.iconDescription),"successDelay"in v&&n(4,c=v.successDelay)},[r,l,a,o,c,h,p,g,b]}class InlineLoading extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1O,create_fragment$1P,safe_not_equal,{status:0,description:1,iconDescription:2,successDelay:4})}}const InlineLoading$1=InlineLoading;function create_fragment$1O(i){let t,n,s,o,r;var l=i[1];function a(f){return{props:{size:20,title:f[2],class:(f[0]==="toast"&&"bx--toast-notification__close-icon")+" "+(f[0]==="inline"&&"bx--inline-notification__close-icon")}}}l&&(n=construct_svelte_component(l,a(i)));let c=[{type:"button"},{"aria-label":i[3]},{title:i[3]},i[4]],u={};for(let f=0;f{destroy_component(g,1)}),check_outros()}l?(n=construct_svelte_component(l,a(f)),create_component(n.$$.fragment),transition_in(n.$$.fragment,1),mount_component(n,t,null)):n=null}else l&&n.$set(p);set_attributes(t,u=get_spread_update(c,[{type:"button"},(!s||h&8)&&{"aria-label":f[3]},(!s||h&8)&&{title:f[3]},h&16&&f[4]])),toggle_class(t,"bx--toast-notification__close-button",f[0]==="toast"),toggle_class(t,"bx--inline-notification__close-button",f[0]==="inline")},i(f){s||(n&&transition_in(n.$$.fragment,f),s=!0)},o(f){n&&transition_out(n.$$.fragment,f),s=!1},d(f){f&&detach(t),n&&destroy_component(n),o=!1,run_all(r)}}}function instance$1N(i,t,n){const s=["notificationType","icon","title","iconDescription"];let o=compute_rest_props(t,s),{notificationType:r="toast"}=t,{icon:l=Close$2}=t,{title:a=void 0}=t,{iconDescription:c="Close icon"}=t;function u(g){bubble.call(this,i,g)}function f(g){bubble.call(this,i,g)}function h(g){bubble.call(this,i,g)}function p(g){bubble.call(this,i,g)}return i.$$set=g=>{t=assign(assign({},t),exclude_internal_props(g)),n(4,o=compute_rest_props(t,s)),"notificationType"in g&&n(0,r=g.notificationType),"icon"in g&&n(1,l=g.icon),"title"in g&&n(2,a=g.title),"iconDescription"in g&&n(3,c=g.iconDescription)},[r,l,a,c,o,u,f,h,p]}class NotificationButton extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1N,create_fragment$1O,safe_not_equal,{notificationType:0,icon:1,title:2,iconDescription:3})}}const NotificationButton$1=NotificationButton;function create_if_block$1a(i){let t,n;return{c(){t=svg_element("title"),n=text(i[1])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o&2&&set_data(n,s[1])},d(s){s&&detach(t)}}}function create_fragment$1N(i){let t,n,s,o=i[1]&&create_if_block$1a(i),r=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:i[0]},{height:i[0]},i[2],i[3]],l={};for(let a=0;a{n(5,t=assign(assign({},t),exclude_internal_props(u))),n(3,l=compute_rest_props(t,r)),"size"in u&&n(0,a=u.size),"title"in u&&n(1,c=u.title)},i.$$.update=()=>{n(4,s=t["aria-label"]||t["aria-labelledby"]||c),n(2,o={"aria-hidden":s?void 0:!0,role:s?"img":void 0,focusable:Number(t.tabindex)===0?!0:void 0})},t=exclude_internal_props(t),[a,c,o,l,s]}class InformationFilled extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1M,create_fragment$1N,safe_not_equal,{size:0,title:1})}}const InformationFilled$1=InformationFilled;function create_if_block$19(i){let t,n;return{c(){t=svg_element("title"),n=text(i[1])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o&2&&set_data(n,s[1])},d(s){s&&detach(t)}}}function create_fragment$1M(i){let t,n,s,o=i[1]&&create_if_block$19(i),r=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:i[0]},{height:i[0]},i[2],i[3]],l={};for(let a=0;a{n(5,t=assign(assign({},t),exclude_internal_props(u))),n(3,l=compute_rest_props(t,r)),"size"in u&&n(0,a=u.size),"title"in u&&n(1,c=u.title)},i.$$.update=()=>{n(4,s=t["aria-label"]||t["aria-labelledby"]||c),n(2,o={"aria-hidden":s?void 0:!0,role:s?"img":void 0,focusable:Number(t.tabindex)===0?!0:void 0})},t=exclude_internal_props(t),[a,c,o,l,s]}class InformationSquareFilled extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1L,create_fragment$1M,safe_not_equal,{size:0,title:1})}}const InformationSquareFilled$1=InformationSquareFilled;function create_fragment$1L(i){let t,n,s;var o=i[3][i[0]];function r(l){return{props:{size:20,title:l[2],class:(l[1]==="toast"&&"bx--toast-notification__icon")+" "+(l[1]==="inline"&&"bx--inline-notification__icon")}}}return o&&(t=construct_svelte_component(o,r(i))),{c(){t&&create_component(t.$$.fragment),n=empty$1()},m(l,a){t&&mount_component(t,l,a),insert(l,n,a),s=!0},p(l,[a]){const c={};if(a&4&&(c.title=l[2]),a&2&&(c.class=(l[1]==="toast"&&"bx--toast-notification__icon")+" "+(l[1]==="inline"&&"bx--inline-notification__icon")),o!==(o=l[3][l[0]])){if(t){group_outros();const u=t;transition_out(u.$$.fragment,1,0,()=>{destroy_component(u,1)}),check_outros()}o?(t=construct_svelte_component(o,r(l)),create_component(t.$$.fragment),transition_in(t.$$.fragment,1),mount_component(t,n.parentNode,n)):t=null}else o&&t.$set(c)},i(l){s||(t&&transition_in(t.$$.fragment,l),s=!0)},o(l){t&&transition_out(t.$$.fragment,l),s=!1},d(l){l&&detach(n),t&&destroy_component(t,l)}}}function instance$1K(i,t,n){let{kind:s="error"}=t,{notificationType:o="toast"}=t,{iconDescription:r}=t;const l={error:ErrorFilled$1,"info-square":InformationSquareFilled$1,info:InformationFilled$1,success:CheckmarkFilled$1,warning:WarningFilled$1,"warning-alt":WarningAltFilled$1};return i.$$set=a=>{"kind"in a&&n(0,s=a.kind),"notificationType"in a&&n(1,o=a.notificationType),"iconDescription"in a&&n(2,r=a.iconDescription)},[s,o,r,l]}class NotificationIcon extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1K,create_fragment$1L,safe_not_equal,{kind:0,notificationType:1,iconDescription:2})}}const NotificationIcon$1=NotificationIcon,get_caption_slot_changes=i=>({}),get_caption_slot_context=i=>({}),get_subtitle_slot_changes$1=i=>({}),get_subtitle_slot_context$1=i=>({}),get_title_slot_changes$1=i=>({}),get_title_slot_context$1=i=>({});function create_if_block$18(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v;n=new NotificationIcon$1({props:{kind:i[0],iconDescription:i[6]}});const y=i[15].title,S=create_slot(y,i,i[14],get_title_slot_context$1),T=S||fallback_block_2$2(i),w=i[15].subtitle,A=create_slot(w,i,i[14],get_subtitle_slot_context$1),x=A||fallback_block_1$4(i),C=i[15].caption,I=create_slot(C,i,i[14],get_caption_slot_context),M=I||fallback_block$8(i),E=i[15].default,L=create_slot(E,i,i[14],null);let R=!i[8]&&create_if_block_1$z(i),O=[{role:i[2]},{kind:i[0]},i[12],{style:p=""+((i[9]&&"width: 100%;")+i[12].style)}],B={};for(let z=0;z{R=null}),check_outros()):R?(R.p(z,F),F&256&&transition_in(R,1)):(R=create_if_block_1$z(z),R.c(),transition_in(R,1),R.m(t,null)),set_attributes(t,B=get_spread_update(O,[(!g||F&4)&&{role:z[2]},(!g||F&1)&&{kind:z[0]},F&4096&&z[12],(!g||F&4608&&p!==(p=""+((z[9]&&"width: 100%;")+z[12].style)))&&{style:p}])),toggle_class(t,"bx--toast-notification",!0),toggle_class(t,"bx--toast-notification--low-contrast",z[1]),toggle_class(t,"bx--toast-notification--error",z[0]==="error"),toggle_class(t,"bx--toast-notification--info",z[0]==="info"),toggle_class(t,"bx--toast-notification--info-square",z[0]==="info-square"),toggle_class(t,"bx--toast-notification--success",z[0]==="success"),toggle_class(t,"bx--toast-notification--warning",z[0]==="warning"),toggle_class(t,"bx--toast-notification--warning-alt",z[0]==="warning-alt")},i(z){g||(transition_in(n.$$.fragment,z),transition_in(T,z),transition_in(x,z),transition_in(M,z),transition_in(L,z),transition_in(R),g=!0)},o(z){transition_out(n.$$.fragment,z),transition_out(T,z),transition_out(x,z),transition_out(M,z),transition_out(L,z),transition_out(R),g=!1},d(z){z&&detach(t),destroy_component(n),T&&T.d(z),x&&x.d(z),M&&M.d(z),L&&L.d(z),R&&R.d(),b=!1,run_all(v)}}}function fallback_block_2$2(i){let t;return{c(){t=text(i[3])},m(n,s){insert(n,t,s)},p(n,s){s&8&&set_data(t,n[3])},d(n){n&&detach(t)}}}function fallback_block_1$4(i){let t;return{c(){t=text(i[4])},m(n,s){insert(n,t,s)},p(n,s){s&16&&set_data(t,n[4])},d(n){n&&detach(t)}}}function fallback_block$8(i){let t;return{c(){t=text(i[5])},m(n,s){insert(n,t,s)},p(n,s){s&32&&set_data(t,n[5])},d(n){n&&detach(t)}}}function create_if_block_1$z(i){let t,n;return t=new NotificationButton$1({props:{iconDescription:i[7]}}),t.$on("click",i[11]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&128&&(r.iconDescription=s[7]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$1K(i){let t,n,s=i[10]&&create_if_block$18(i);return{c(){s&&s.c(),t=empty$1()},m(o,r){s&&s.m(o,r),insert(o,t,r),n=!0},p(o,[r]){o[10]?s?(s.p(o,r),r&1024&&transition_in(s,1)):(s=create_if_block$18(o),s.c(),transition_in(s,1),s.m(t.parentNode,t)):s&&(group_outros(),transition_out(s,1,1,()=>{s=null}),check_outros())},i(o){n||(transition_in(s),n=!0)},o(o){transition_out(s),n=!1},d(o){s&&s.d(o),o&&detach(t)}}}function instance$1J(i,t,n){const s=["kind","lowContrast","timeout","role","title","subtitle","caption","statusIconDescription","closeButtonDescription","hideCloseButton","fullWidth"];let o=compute_rest_props(t,s),{$$slots:r={},$$scope:l}=t,{kind:a="error"}=t,{lowContrast:c=!1}=t,{timeout:u=0}=t,{role:f="alert"}=t,{title:h=""}=t,{subtitle:p=""}=t,{caption:g=""}=t,{statusIconDescription:b=a+" icon"}=t,{closeButtonDescription:v="Close notification"}=t,{hideCloseButton:y=!1}=t,{fullWidth:S=!1}=t;const T=createEventDispatcher();let w=!0,A;function x(L){T("close",{timeout:L===!0},{cancelable:!0})&&n(10,w=!1)}onMount(()=>(u&&(A=setTimeout(()=>x(!0),u)),()=>{clearTimeout(A)}));function C(L){bubble.call(this,i,L)}function I(L){bubble.call(this,i,L)}function M(L){bubble.call(this,i,L)}function E(L){bubble.call(this,i,L)}return i.$$set=L=>{t=assign(assign({},t),exclude_internal_props(L)),n(12,o=compute_rest_props(t,s)),"kind"in L&&n(0,a=L.kind),"lowContrast"in L&&n(1,c=L.lowContrast),"timeout"in L&&n(13,u=L.timeout),"role"in L&&n(2,f=L.role),"title"in L&&n(3,h=L.title),"subtitle"in L&&n(4,p=L.subtitle),"caption"in L&&n(5,g=L.caption),"statusIconDescription"in L&&n(6,b=L.statusIconDescription),"closeButtonDescription"in L&&n(7,v=L.closeButtonDescription),"hideCloseButton"in L&&n(8,y=L.hideCloseButton),"fullWidth"in L&&n(9,S=L.fullWidth),"$$scope"in L&&n(14,l=L.$$scope)},[a,c,f,h,p,g,b,v,y,S,w,x,o,u,l,r,C,I,M,E]}class ToastNotification extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1J,create_fragment$1K,safe_not_equal,{kind:0,lowContrast:1,timeout:13,role:2,title:3,subtitle:4,caption:5,statusIconDescription:6,closeButtonDescription:7,hideCloseButton:8,fullWidth:9})}}const ToastNotification$1=ToastNotification,get_actions_slot_changes=i=>({}),get_actions_slot_context=i=>({}),get_subtitle_slot_changes=i=>({}),get_subtitle_slot_context=i=>({}),get_title_slot_changes=i=>({}),get_title_slot_context=i=>({});function create_if_block$17(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b;s=new NotificationIcon$1({props:{notificationType:"inline",kind:i[0],iconDescription:i[6]}});const v=i[13].title,y=create_slot(v,i,i[12],get_title_slot_context),S=y||fallback_block_1$3(i),T=i[13].subtitle,w=create_slot(T,i,i[12],get_subtitle_slot_context),A=w||fallback_block$7(i),x=i[13].default,C=create_slot(x,i,i[12],null),I=i[13].actions,M=create_slot(I,i,i[12],get_actions_slot_context);let E=!i[5]&&create_if_block_1$y(i),L=[{role:i[2]},{kind:i[0]},i[10]],R={};for(let O=0;O{E=null}),check_outros()):E?(E.p(O,B),B&32&&transition_in(E,1)):(E=create_if_block_1$y(O),E.c(),transition_in(E,1),E.m(t,null)),set_attributes(t,R=get_spread_update(L,[(!p||B&4)&&{role:O[2]},(!p||B&1)&&{kind:O[0]},B&1024&&O[10]])),toggle_class(t,"bx--inline-notification",!0),toggle_class(t,"bx--inline-notification--low-contrast",O[1]),toggle_class(t,"bx--inline-notification--hide-close-button",O[5]),toggle_class(t,"bx--inline-notification--error",O[0]==="error"),toggle_class(t,"bx--inline-notification--info",O[0]==="info"),toggle_class(t,"bx--inline-notification--info-square",O[0]==="info-square"),toggle_class(t,"bx--inline-notification--success",O[0]==="success"),toggle_class(t,"bx--inline-notification--warning",O[0]==="warning"),toggle_class(t,"bx--inline-notification--warning-alt",O[0]==="warning-alt")},i(O){p||(transition_in(s.$$.fragment,O),transition_in(S,O),transition_in(A,O),transition_in(C,O),transition_in(M,O),transition_in(E),p=!0)},o(O){transition_out(s.$$.fragment,O),transition_out(S,O),transition_out(A,O),transition_out(C,O),transition_out(M,O),transition_out(E),p=!1},d(O){O&&detach(t),destroy_component(s),S&&S.d(O),A&&A.d(O),C&&C.d(O),M&&M.d(O),E&&E.d(),g=!1,run_all(b)}}}function fallback_block_1$3(i){let t;return{c(){t=text(i[3])},m(n,s){insert(n,t,s)},p(n,s){s&8&&set_data(t,n[3])},d(n){n&&detach(t)}}}function fallback_block$7(i){let t;return{c(){t=text(i[4])},m(n,s){insert(n,t,s)},p(n,s){s&16&&set_data(t,n[4])},d(n){n&&detach(t)}}}function create_if_block_1$y(i){let t,n;return t=new NotificationButton$1({props:{iconDescription:i[7],notificationType:"inline"}}),t.$on("click",i[9]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&128&&(r.iconDescription=s[7]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$1J(i){let t,n,s=i[8]&&create_if_block$17(i);return{c(){s&&s.c(),t=empty$1()},m(o,r){s&&s.m(o,r),insert(o,t,r),n=!0},p(o,[r]){o[8]?s?(s.p(o,r),r&256&&transition_in(s,1)):(s=create_if_block$17(o),s.c(),transition_in(s,1),s.m(t.parentNode,t)):s&&(group_outros(),transition_out(s,1,1,()=>{s=null}),check_outros())},i(o){n||(transition_in(s),n=!0)},o(o){transition_out(s),n=!1},d(o){s&&s.d(o),o&&detach(t)}}}function instance$1I(i,t,n){const s=["kind","lowContrast","timeout","role","title","subtitle","hideCloseButton","statusIconDescription","closeButtonDescription"];let o=compute_rest_props(t,s),{$$slots:r={},$$scope:l}=t,{kind:a="error"}=t,{lowContrast:c=!1}=t,{timeout:u=0}=t,{role:f="alert"}=t,{title:h=""}=t,{subtitle:p=""}=t,{hideCloseButton:g=!1}=t,{statusIconDescription:b=a+" icon"}=t,{closeButtonDescription:v="Close notification"}=t;const y=createEventDispatcher();let S=!0,T;function w(M){y("close",{timeout:M===!0},{cancelable:!0})&&n(8,S=!1)}onMount(()=>(u&&(T=setTimeout(()=>w(!0),u)),()=>{clearTimeout(T)}));function A(M){bubble.call(this,i,M)}function x(M){bubble.call(this,i,M)}function C(M){bubble.call(this,i,M)}function I(M){bubble.call(this,i,M)}return i.$$set=M=>{t=assign(assign({},t),exclude_internal_props(M)),n(10,o=compute_rest_props(t,s)),"kind"in M&&n(0,a=M.kind),"lowContrast"in M&&n(1,c=M.lowContrast),"timeout"in M&&n(11,u=M.timeout),"role"in M&&n(2,f=M.role),"title"in M&&n(3,h=M.title),"subtitle"in M&&n(4,p=M.subtitle),"hideCloseButton"in M&&n(5,g=M.hideCloseButton),"statusIconDescription"in M&&n(6,b=M.statusIconDescription),"closeButtonDescription"in M&&n(7,v=M.closeButtonDescription),"$$scope"in M&&n(12,l=M.$$scope)},[a,c,f,h,p,g,b,v,S,w,o,u,l,r,A,x,C,I]}class InlineNotification extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1I,create_fragment$1J,safe_not_equal,{kind:0,lowContrast:1,timeout:11,role:2,title:3,subtitle:4,hideCloseButton:5,statusIconDescription:6,closeButtonDescription:7})}}const InlineNotification$1=InlineNotification;function create_if_block$16(i){let t,n;return{c(){t=svg_element("title"),n=text(i[1])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o&2&&set_data(n,s[1])},d(s){s&&detach(t)}}}function create_fragment$1I(i){let t,n,s=i[1]&&create_if_block$16(i),o=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:i[0]},{height:i[0]},i[2],i[3]],r={};for(let l=0;l{n(5,t=assign(assign({},t),exclude_internal_props(u))),n(3,l=compute_rest_props(t,r)),"size"in u&&n(0,a=u.size),"title"in u&&n(1,c=u.title)},i.$$.update=()=>{n(4,s=t["aria-label"]||t["aria-labelledby"]||c),n(2,o={"aria-hidden":s?void 0:!0,role:s?"img":void 0,focusable:Number(t.tabindex)===0?!0:void 0})},t=exclude_internal_props(t),[a,c,o,l,s]}let Add$1=class extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1H,create_fragment$1I,safe_not_equal,{size:0,title:1})}};const Add$2=Add$1;function create_if_block$15(i){let t,n;return{c(){t=svg_element("title"),n=text(i[1])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o&2&&set_data(n,s[1])},d(s){s&&detach(t)}}}function create_fragment$1H(i){let t,n,s=i[1]&&create_if_block$15(i),o=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:i[0]},{height:i[0]},i[2],i[3]],r={};for(let l=0;l{n(5,t=assign(assign({},t),exclude_internal_props(u))),n(3,l=compute_rest_props(t,r)),"size"in u&&n(0,a=u.size),"title"in u&&n(1,c=u.title)},i.$$.update=()=>{n(4,s=t["aria-label"]||t["aria-labelledby"]||c),n(2,o={"aria-hidden":s?void 0:!0,role:s?"img":void 0,focusable:Number(t.tabindex)===0?!0:void 0})},t=exclude_internal_props(t),[a,c,o,l,s]}class Subtract extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1G,create_fragment$1H,safe_not_equal,{size:0,title:1})}}const Subtract$1=Subtract;function create_if_block$14(i){let t,n;return{c(){t=svg_element("title"),n=text(i[1])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o&2&&set_data(n,s[1])},d(s){s&&detach(t)}}}function create_fragment$1G(i){let t,n,s=i[1]&&create_if_block$14(i),o=[{xmlns:"http://www.w3.org/2000/svg"},{viewBox:"0 0 32 32"},{fill:"currentColor"},{preserveAspectRatio:"xMidYMid meet"},{width:i[0]},{height:i[0]},i[2],i[3]],r={};for(let l=0;l{n(5,t=assign(assign({},t),exclude_internal_props(u))),n(3,l=compute_rest_props(t,r)),"size"in u&&n(0,a=u.size),"title"in u&&n(1,c=u.title)},i.$$.update=()=>{n(4,s=t["aria-label"]||t["aria-labelledby"]||c),n(2,o={"aria-hidden":s?void 0:!0,role:s?"img":void 0,focusable:Number(t.tabindex)===0?!0:void 0})},t=exclude_internal_props(t),[a,c,o,l,s]}class EditOff extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1F,create_fragment$1G,safe_not_equal,{size:0,title:1})}}const EditOff$1=EditOff,get_label_slot_changes=i=>({}),get_label_slot_context=i=>({});function create_if_block_7$4(i){let t,n;const s=i[34].label,o=create_slot(s,i,i[33],get_label_slot_context),r=o||fallback_block$6(i);return{c(){t=element("label"),r&&r.c(),attr(t,"for",i[18]),toggle_class(t,"bx--label",!0),toggle_class(t,"bx--label--disabled",i[8]),toggle_class(t,"bx--visually-hidden",i[17])},m(l,a){insert(l,t,a),r&&r.m(t,null),n=!0},p(l,a){o?o.p&&(!n||a[1]&4)&&update_slot_base(o,s,l,l[33],n?get_slot_changes(s,l[33],a,get_label_slot_changes):get_all_dirty_from_scope(l[33]),get_label_slot_context):r&&r.p&&(!n||a[0]&65536)&&r.p(l,n?a:[-1,-1]),(!n||a[0]&262144)&&attr(t,"for",l[18]),(!n||a[0]&256)&&toggle_class(t,"bx--label--disabled",l[8]),(!n||a[0]&131072)&&toggle_class(t,"bx--visually-hidden",l[17])},i(l){n||(transition_in(r,l),n=!0)},o(l){transition_out(r,l),n=!1},d(l){l&&detach(t),r&&r.d(l)}}}function fallback_block$6(i){let t;return{c(){t=text(i[16])},m(n,s){insert(n,t,s)},p(n,s){s[0]&65536&&set_data(t,n[16])},d(n){n&&detach(t)}}}function create_if_block_6$4(i){let t,n;return t=new WarningFilled$1({props:{class:"bx--number__invalid"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_5$6(i){let t,n;return t=new WarningAltFilled$1({props:{class:"bx--number__invalid bx--number__invalid--warning"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_4$8(i){let t,n;return t=new EditOff$1({props:{class:"bx--text-input__readonly-icon"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_3$j(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S;return s=new Subtract$1({props:{class:"down-icon"}}),f=new Add$2({props:{class:"up-icon"}}),{c(){t=element("div"),n=element("button"),create_component(s.$$.fragment),l=space(),a=element("div"),c=space(),u=element("button"),create_component(f.$$.fragment),g=space(),b=element("div"),attr(n,"type","button"),attr(n,"tabindex","-1"),attr(n,"title",o=i[23]||i[10]),attr(n,"aria-label",r=i[23]||i[10]),n.disabled=i[8],toggle_class(n,"bx--number__control-btn",!0),toggle_class(n,"down-icon",!0),toggle_class(a,"bx--number__rule-divider",!0),attr(u,"type","button"),attr(u,"tabindex","-1"),attr(u,"title",h=i[24]||i[10]),attr(u,"aria-label",p=i[24]||i[10]),u.disabled=i[8],toggle_class(u,"bx--number__control-btn",!0),toggle_class(u,"up-icon",!0),toggle_class(b,"bx--number__rule-divider",!0),toggle_class(t,"bx--number__controls",!0)},m(T,w){insert(T,t,w),append(t,n),mount_component(s,n,null),append(t,l),append(t,a),append(t,c),append(t,u),mount_component(f,u,null),append(t,g),append(t,b),v=!0,y||(S=[listen(n,"click",i[45]),listen(u,"click",i[46])],y=!0)},p(T,w){(!v||w[0]&8389632&&o!==(o=T[23]||T[10]))&&attr(n,"title",o),(!v||w[0]&8389632&&r!==(r=T[23]||T[10]))&&attr(n,"aria-label",r),(!v||w[0]&256)&&(n.disabled=T[8]),(!v||w[0]&16778240&&h!==(h=T[24]||T[10]))&&attr(u,"title",h),(!v||w[0]&16778240&&p!==(p=T[24]||T[10]))&&attr(u,"aria-label",p),(!v||w[0]&256)&&(u.disabled=T[8])},i(T){v||(transition_in(s.$$.fragment,T),transition_in(f.$$.fragment,T),v=!0)},o(T){transition_out(s.$$.fragment,T),transition_out(f.$$.fragment,T),v=!1},d(T){T&&detach(t),destroy_component(s),destroy_component(f),y=!1,run_all(S)}}}function create_if_block_2$q(i){let t,n;return{c(){t=element("div"),n=text(i[15]),toggle_class(t,"bx--form__helper-text",!0),toggle_class(t,"bx--form__helper-text--disabled",i[8])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&32768&&set_data(n,s[15]),o[0]&256&&toggle_class(t,"bx--form__helper-text--disabled",s[8])},d(s){s&&detach(t)}}}function create_if_block_1$x(i){let t,n;return{c(){t=element("div"),n=text(i[12]),attr(t,"id",i[21]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&4096&&set_data(n,s[12]),o[0]&2097152&&attr(t,"id",s[21])},d(s){s&&detach(t)}}}function create_if_block$13(i){let t,n;return{c(){t=element("div"),n=text(i[14]),attr(t,"id",i[21]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&16384&&set_data(n,s[14]),o[0]&2097152&&attr(t,"id",s[21])},d(s){s&&detach(t)}}}function create_fragment$1F(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x=(i[28].label||i[16])&&create_if_block_7$4(i),C=[{type:"number"},{pattern:"[0-9]*"},{"aria-describedby":i[21]},{"data-invalid":l=i[11]||void 0},{"aria-invalid":a=i[11]||void 0},{"aria-label":c=i[16]?void 0:i[20]},{disabled:i[8]},{id:i[18]},{name:i[19]},{max:i[4]},{min:i[5]},{step:i[3]},{value:u=i[0]??""},{readOnly:i[7]},i[29]],I={};for(let F=0;F{x=null}),check_outros()),set_attributes(r,I=get_spread_update(C,[{type:"number"},{pattern:"[0-9]*"},(!T||q[0]&2097152)&&{"aria-describedby":F[21]},(!T||q[0]&2048&&l!==(l=F[11]||void 0))&&{"data-invalid":l},(!T||q[0]&2048&&a!==(a=F[11]||void 0))&&{"aria-invalid":a},(!T||q[0]&1114112&&c!==(c=F[16]?void 0:F[20]))&&{"aria-label":c},(!T||q[0]&256)&&{disabled:F[8]},(!T||q[0]&262144)&&{id:F[18]},(!T||q[0]&524288)&&{name:F[19]},(!T||q[0]&16)&&{max:F[4]},(!T||q[0]&32)&&{min:F[5]},(!T||q[0]&8)&&{step:F[3]},(!T||q[0]&1&&u!==(u=F[0]??"")&&r.value!==u)&&{value:u},(!T||q[0]&128)&&{readOnly:F[7]},q[0]&536870912&&F[29]])),F[11]?M?q[0]&2048&&transition_in(M,1):(M=create_if_block_6$4(),M.c(),transition_in(M,1),M.m(o,h)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros()),!F[11]&&F[13]?E?q[0]&10240&&transition_in(E,1):(E=create_if_block_5$6(),E.c(),transition_in(E,1),E.m(o,p)):E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros()),F[7]?L?q[0]&128&&transition_in(L,1):(L=create_if_block_4$8(),L.c(),transition_in(L,1),L.m(o,g)):L&&(group_outros(),transition_out(L,1,1,()=>{L=null}),check_outros()),F[9]?R&&(group_outros(),transition_out(R,1,1,()=>{R=null}),check_outros()):R?(R.p(F,q),q[0]&512&&transition_in(R,1)):(R=create_if_block_3$j(F),R.c(),transition_in(R,1),R.m(o,null)),(!T||q[0]&10240)&&toggle_class(o,"bx--number__input-wrapper--warning",!F[11]&&F[13]),!F[22]&&!F[13]&&F[15]?O?O.p(F,q):(O=create_if_block_2$q(F),O.c(),O.m(n,v)):O&&(O.d(1),O=null),F[22]?B?B.p(F,q):(B=create_if_block_1$x(F),B.c(),B.m(n,y)):B&&(B.d(1),B=null),!F[22]&&F[13]?z?z.p(F,q):(z=create_if_block$13(F),z.c(),z.m(n,null)):z&&(z.d(1),z=null),(!T||q[0]&4194304&&S!==(S=F[22]||void 0))&&attr(n,"data-invalid",S),(!T||q[0]&128)&&toggle_class(n,"bx--number--readonly",F[7]),(!T||q[0]&64)&&toggle_class(n,"bx--number--light",F[6]),(!T||q[0]&131072)&&toggle_class(n,"bx--number--nolabel",F[17]),(!T||q[0]&512)&&toggle_class(n,"bx--number--nosteppers",F[9]),(!T||q[0]&4)&&toggle_class(n,"bx--number--sm",F[2]==="sm"),(!T||q[0]&4)&&toggle_class(n,"bx--number--xl",F[2]==="xl")},i(F){T||(transition_in(x),transition_in(M),transition_in(E),transition_in(L),transition_in(R),T=!0)},o(F){transition_out(x),transition_out(M),transition_out(E),transition_out(L),transition_out(R),T=!1},d(F){F&&detach(t),x&&x.d(),i[44](null),M&&M.d(),E&&E.d(),L&&L.d(),R&&R.d(),O&&O.d(),B&&B.d(),z&&z.d(),w=!1,run_all(A)}}}function parse$1(i){return i!=""?Number(i):null}function instance$1E(i,t,n){let s,o,r,l,a;const c=["size","value","step","max","min","light","readonly","allowEmpty","disabled","hideSteppers","iconDescription","invalid","invalidText","warn","warnText","helperText","label","hideLabel","translateWithId","translationIds","id","name","ref"];let u=compute_rest_props(t,c),{$$slots:f={},$$scope:h}=t;const p=compute_slots(f);let{size:g=void 0}=t,{value:b=null}=t,{step:v=1}=t,{max:y=void 0}=t,{min:S=void 0}=t,{light:T=!1}=t,{readonly:w=!1}=t,{allowEmpty:A=!1}=t,{disabled:x=!1}=t,{hideSteppers:C=!1}=t,{iconDescription:I=""}=t,{invalid:M=!1}=t,{invalidText:E=""}=t,{warn:L=!1}=t,{warnText:R=""}=t,{helperText:O=""}=t,{label:B=""}=t,{hideLabel:z=!1}=t,{translateWithId:F=te=>Q[te]}=t;const q={increment:"increment",decrement:"decrement"};let{id:N="ccs-"+Math.random().toString(36)}=t,{name:ee=void 0}=t,{ref:K=null}=t;const Q={[q.increment]:"Increment number",[q.decrement]:"Decrement number"},J=createEventDispatcher();function Y(te){te?K.stepUp():K.stepDown(),n(0,b=+K.value),J("input",b),J("change",b)}function ce({target:te}){n(0,b=parse$1(te.value)),J("input",b)}function Z({target:te}){J("change",parse$1(te.value))}function ge(te){bubble.call(this,i,te)}function se(te){bubble.call(this,i,te)}function re(te){bubble.call(this,i,te)}function me(te){bubble.call(this,i,te)}function fe(te){bubble.call(this,i,te)}function le(te){bubble.call(this,i,te)}function Le(te){bubble.call(this,i,te)}function V(te){bubble.call(this,i,te)}function W(te){bubble.call(this,i,te)}function j(te){binding_callbacks[te?"unshift":"push"](()=>{K=te,n(1,K)})}const X=()=>{Y(!1)},oe=()=>{Y(!0)};return i.$$set=te=>{n(49,t=assign(assign({},t),exclude_internal_props(te))),n(29,u=compute_rest_props(t,c)),"size"in te&&n(2,g=te.size),"value"in te&&n(0,b=te.value),"step"in te&&n(3,v=te.step),"max"in te&&n(4,y=te.max),"min"in te&&n(5,S=te.min),"light"in te&&n(6,T=te.light),"readonly"in te&&n(7,w=te.readonly),"allowEmpty"in te&&n(30,A=te.allowEmpty),"disabled"in te&&n(8,x=te.disabled),"hideSteppers"in te&&n(9,C=te.hideSteppers),"iconDescription"in te&&n(10,I=te.iconDescription),"invalid"in te&&n(11,M=te.invalid),"invalidText"in te&&n(12,E=te.invalidText),"warn"in te&&n(13,L=te.warn),"warnText"in te&&n(14,R=te.warnText),"helperText"in te&&n(15,O=te.helperText),"label"in te&&n(16,B=te.label),"hideLabel"in te&&n(17,z=te.hideLabel),"translateWithId"in te&&n(31,F=te.translateWithId),"id"in te&&n(18,N=te.id),"name"in te&&n(19,ee=te.name),"ref"in te&&n(1,K=te.ref),"$$scope"in te&&n(33,h=te.$$scope)},i.$$.update=()=>{i.$$.dirty[1]&1&&n(24,s=F("increment")),i.$$.dirty[1]&1&&n(23,o=F("decrement")),i.$$.dirty[0]&1073743921&&n(22,r=M||!A&&b==null||b>y||typeof b=="number"&&b{n(5,t=assign(assign({},t),exclude_internal_props(u))),n(3,l=compute_rest_props(t,r)),"size"in u&&n(0,a=u.size),"title"in u&&n(1,c=u.title)},i.$$.update=()=>{n(4,s=t["aria-label"]||t["aria-labelledby"]||c),n(2,o={"aria-hidden":s?void 0:!0,role:s?"img":void 0,focusable:Number(t.tabindex)===0?!0:void 0})},t=exclude_internal_props(t),[a,c,o,l,s]}class CaretLeft extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1D,create_fragment$1E,safe_not_equal,{size:0,title:1})}}const CaretLeft$1=CaretLeft,get_labelText_slot_changes$3=i=>({}),get_labelText_slot_context$3=i=>({});function create_if_block_10$2(i){let t,n;const s=i[26].labelText,o=create_slot(s,i,i[25],get_labelText_slot_context$3),r=o||fallback_block$5(i);return{c(){t=element("label"),r&&r.c(),attr(t,"for",i[5]),toggle_class(t,"bx--label",!0),toggle_class(t,"bx--visually-hidden",i[14]),toggle_class(t,"bx--label--disabled",i[4])},m(l,a){insert(l,t,a),r&&r.m(t,null),n=!0},p(l,a){o?o.p&&(!n||a[0]&33554432)&&update_slot_base(o,s,l,l[25],n?get_slot_changes(s,l[25],a,get_labelText_slot_changes$3):get_all_dirty_from_scope(l[25]),get_labelText_slot_context$3):r&&r.p&&(!n||a[0]&8192)&&r.p(l,n?a:[-1,-1]),(!n||a[0]&32)&&attr(t,"for",l[5]),(!n||a[0]&16384)&&toggle_class(t,"bx--visually-hidden",l[14]),(!n||a[0]&16)&&toggle_class(t,"bx--label--disabled",l[4])},i(l){n||(transition_in(r,l),n=!0)},o(l){transition_out(r,l),n=!1},d(l){l&&detach(t),r&&r.d(l)}}}function fallback_block$5(i){let t;return{c(){t=text(i[13])},m(n,s){insert(n,t,s)},p(n,s){s[0]&8192&&set_data(t,n[13])},d(n){n&&detach(t)}}}function create_if_block_6$3(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S;const T=i[26].default,w=create_slot(T,i,i[25],null);u=new ChevronDown$1({props:{class:"bx--select__arrow"}});let A=i[7]&&create_if_block_9$2(),x=i[7]&&create_if_block_8$3(i),C=i[11]&&create_if_block_7$3(i);return{c(){t=element("div"),n=element("div"),s=element("select"),w&&w.c(),c=space(),create_component(u.$$.fragment),f=space(),A&&A.c(),p=space(),x&&x.c(),g=space(),C&&C.c(),b=empty$1(),attr(s,"aria-describedby",o=i[7]?i[16]:void 0),attr(s,"aria-invalid",r=i[7]||void 0),s.disabled=l=i[4]||void 0,s.required=a=i[15]||void 0,attr(s,"id",i[5]),attr(s,"name",i[6]),toggle_class(s,"bx--select-input",!0),toggle_class(s,"bx--select-input--sm",i[1]==="sm"),toggle_class(s,"bx--select-input--xl",i[1]==="xl"),attr(n,"data-invalid",h=i[7]||void 0),toggle_class(n,"bx--select-input__wrapper",!0),toggle_class(t,"bx--select-input--inline__wrapper",!0)},m(I,M){insert(I,t,M),append(t,n),append(n,s),w&&w.m(s,null),i[35](s),append(n,c),mount_component(u,n,null),append(n,f),A&&A.m(n,null),append(t,p),x&&x.m(t,null),insert(I,g,M),C&&C.m(I,M),insert(I,b,M),v=!0,y||(S=[listen(s,"change",i[21]),listen(s,"change",i[31]),listen(s,"input",i[32]),listen(s,"focus",i[33]),listen(s,"blur",i[34])],y=!0)},p(I,M){w&&w.p&&(!v||M[0]&33554432)&&update_slot_base(w,T,I,I[25],v?get_slot_changes(T,I[25],M,null):get_all_dirty_from_scope(I[25]),null),(!v||M[0]&65664&&o!==(o=I[7]?I[16]:void 0))&&attr(s,"aria-describedby",o),(!v||M[0]&128&&r!==(r=I[7]||void 0))&&attr(s,"aria-invalid",r),(!v||M[0]&16&&l!==(l=I[4]||void 0))&&(s.disabled=l),(!v||M[0]&32768&&a!==(a=I[15]||void 0))&&(s.required=a),(!v||M[0]&32)&&attr(s,"id",I[5]),(!v||M[0]&64)&&attr(s,"name",I[6]),(!v||M[0]&2)&&toggle_class(s,"bx--select-input--sm",I[1]==="sm"),(!v||M[0]&2)&&toggle_class(s,"bx--select-input--xl",I[1]==="xl"),I[7]?A?M[0]&128&&transition_in(A,1):(A=create_if_block_9$2(),A.c(),transition_in(A,1),A.m(n,null)):A&&(group_outros(),transition_out(A,1,1,()=>{A=null}),check_outros()),(!v||M[0]&128&&h!==(h=I[7]||void 0))&&attr(n,"data-invalid",h),I[7]?x?x.p(I,M):(x=create_if_block_8$3(I),x.c(),x.m(t,null)):x&&(x.d(1),x=null),I[11]?C?C.p(I,M):(C=create_if_block_7$3(I),C.c(),C.m(b.parentNode,b)):C&&(C.d(1),C=null)},i(I){v||(transition_in(w,I),transition_in(u.$$.fragment,I),transition_in(A),v=!0)},o(I){transition_out(w,I),transition_out(u.$$.fragment,I),transition_out(A),v=!1},d(I){I&&detach(t),w&&w.d(I),i[35](null),destroy_component(u),A&&A.d(),x&&x.d(),I&&detach(g),C&&C.d(I),I&&detach(b),y=!1,run_all(S)}}}function create_if_block_9$2(i){let t,n;return t=new WarningFilled$1({props:{class:"bx--select__invalid-icon"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_8$3(i){let t,n;return{c(){t=element("div"),n=text(i[8]),attr(t,"id",i[16]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&256&&set_data(n,s[8]),o[0]&65536&&attr(t,"id",s[16])},d(s){s&&detach(t)}}}function create_if_block_7$3(i){let t,n;return{c(){t=element("div"),n=text(i[11]),toggle_class(t,"bx--form__helper-text",!0),toggle_class(t,"bx--form__helper-text--disabled",i[4])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&2048&&set_data(n,s[11]),o[0]&16&&toggle_class(t,"bx--form__helper-text--disabled",s[4])},d(s){s&&detach(t)}}}function create_if_block$11(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T;const w=i[26].default,A=create_slot(w,i,i[25],null);c=new ChevronDown$1({props:{class:"bx--select__arrow"}});let x=i[7]&&create_if_block_5$5(),C=!i[7]&&i[9]&&create_if_block_4$7(),I=!i[7]&&i[11]&&create_if_block_3$i(i),M=i[7]&&create_if_block_2$p(i),E=!i[7]&&i[9]&&create_if_block_1$w(i);return{c(){t=element("div"),n=element("select"),A&&A.c(),a=space(),create_component(c.$$.fragment),u=space(),x&&x.c(),f=space(),C&&C.c(),p=space(),I&&I.c(),g=space(),M&&M.c(),b=space(),E&&E.c(),v=empty$1(),attr(n,"id",i[5]),attr(n,"name",i[6]),attr(n,"aria-describedby",s=i[7]?i[16]:void 0),n.disabled=o=i[4]||void 0,n.required=r=i[15]||void 0,attr(n,"aria-invalid",l=i[7]||void 0),toggle_class(n,"bx--select-input",!0),toggle_class(n,"bx--select-input--sm",i[1]==="sm"),toggle_class(n,"bx--select-input--xl",i[1]==="xl"),attr(t,"data-invalid",h=i[7]||void 0),toggle_class(t,"bx--select-input__wrapper",!0)},m(L,R){insert(L,t,R),append(t,n),A&&A.m(n,null),i[36](n),append(t,a),mount_component(c,t,null),append(t,u),x&&x.m(t,null),append(t,f),C&&C.m(t,null),insert(L,p,R),I&&I.m(L,R),insert(L,g,R),M&&M.m(L,R),insert(L,b,R),E&&E.m(L,R),insert(L,v,R),y=!0,S||(T=[listen(n,"change",i[21]),listen(n,"change",i[27]),listen(n,"input",i[28]),listen(n,"focus",i[29]),listen(n,"blur",i[30])],S=!0)},p(L,R){A&&A.p&&(!y||R[0]&33554432)&&update_slot_base(A,w,L,L[25],y?get_slot_changes(w,L[25],R,null):get_all_dirty_from_scope(L[25]),null),(!y||R[0]&32)&&attr(n,"id",L[5]),(!y||R[0]&64)&&attr(n,"name",L[6]),(!y||R[0]&65664&&s!==(s=L[7]?L[16]:void 0))&&attr(n,"aria-describedby",s),(!y||R[0]&16&&o!==(o=L[4]||void 0))&&(n.disabled=o),(!y||R[0]&32768&&r!==(r=L[15]||void 0))&&(n.required=r),(!y||R[0]&128&&l!==(l=L[7]||void 0))&&attr(n,"aria-invalid",l),(!y||R[0]&2)&&toggle_class(n,"bx--select-input--sm",L[1]==="sm"),(!y||R[0]&2)&&toggle_class(n,"bx--select-input--xl",L[1]==="xl"),L[7]?x?R[0]&128&&transition_in(x,1):(x=create_if_block_5$5(),x.c(),transition_in(x,1),x.m(t,f)):x&&(group_outros(),transition_out(x,1,1,()=>{x=null}),check_outros()),!L[7]&&L[9]?C?R[0]&640&&transition_in(C,1):(C=create_if_block_4$7(),C.c(),transition_in(C,1),C.m(t,null)):C&&(group_outros(),transition_out(C,1,1,()=>{C=null}),check_outros()),(!y||R[0]&128&&h!==(h=L[7]||void 0))&&attr(t,"data-invalid",h),!L[7]&&L[11]?I?I.p(L,R):(I=create_if_block_3$i(L),I.c(),I.m(g.parentNode,g)):I&&(I.d(1),I=null),L[7]?M?M.p(L,R):(M=create_if_block_2$p(L),M.c(),M.m(b.parentNode,b)):M&&(M.d(1),M=null),!L[7]&&L[9]?E?E.p(L,R):(E=create_if_block_1$w(L),E.c(),E.m(v.parentNode,v)):E&&(E.d(1),E=null)},i(L){y||(transition_in(A,L),transition_in(c.$$.fragment,L),transition_in(x),transition_in(C),y=!0)},o(L){transition_out(A,L),transition_out(c.$$.fragment,L),transition_out(x),transition_out(C),y=!1},d(L){L&&detach(t),A&&A.d(L),i[36](null),destroy_component(c),x&&x.d(),C&&C.d(),L&&detach(p),I&&I.d(L),L&&detach(g),M&&M.d(L),L&&detach(b),E&&E.d(L),L&&detach(v),S=!1,run_all(T)}}}function create_if_block_5$5(i){let t,n;return t=new WarningFilled$1({props:{class:"bx--select__invalid-icon"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_4$7(i){let t,n;return t=new WarningAltFilled$1({props:{class:"bx--select__invalid-icon bx--select__invalid-icon--warning"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_3$i(i){let t,n;return{c(){t=element("div"),n=text(i[11]),toggle_class(t,"bx--form__helper-text",!0),toggle_class(t,"bx--form__helper-text--disabled",i[4])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&2048&&set_data(n,s[11]),o[0]&16&&toggle_class(t,"bx--form__helper-text--disabled",s[4])},d(s){s&&detach(t)}}}function create_if_block_2$p(i){let t,n;return{c(){t=element("div"),n=text(i[8]),attr(t,"id",i[16]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&256&&set_data(n,s[8]),o[0]&65536&&attr(t,"id",s[16])},d(s){s&&detach(t)}}}function create_if_block_1$w(i){let t,n;return{c(){t=element("div"),n=text(i[10]),attr(t,"id",i[16]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&1024&&set_data(n,s[10]),o[0]&65536&&attr(t,"id",s[16])},d(s){s&&detach(t)}}}function create_fragment$1D(i){let t,n,s,o,r,l=!i[12]&&create_if_block_10$2(i),a=i[2]&&create_if_block_6$3(i),c=!i[2]&&create_if_block$11(i),u=[i[22]],f={};for(let h=0;h{l=null}),check_outros()):l?(l.p(h,p),p[0]&4096&&transition_in(l,1)):(l=create_if_block_10$2(h),l.c(),transition_in(l,1),l.m(n,s)),h[2]?a?(a.p(h,p),p[0]&4&&transition_in(a,1)):(a=create_if_block_6$3(h),a.c(),transition_in(a,1),a.m(n,o)):a&&(group_outros(),transition_out(a,1,1,()=>{a=null}),check_outros()),h[2]?c&&(group_outros(),transition_out(c,1,1,()=>{c=null}),check_outros()):c?(c.p(h,p),p[0]&4&&transition_in(c,1)):(c=create_if_block$11(h),c.c(),transition_in(c,1),c.m(n,null)),(!r||p[0]&4)&&toggle_class(n,"bx--select--inline",h[2]),(!r||p[0]&8)&&toggle_class(n,"bx--select--light",h[3]),(!r||p[0]&128)&&toggle_class(n,"bx--select--invalid",h[7]),(!r||p[0]&16)&&toggle_class(n,"bx--select--disabled",h[4]),(!r||p[0]&512)&&toggle_class(n,"bx--select--warning",h[9]),set_attributes(t,f=get_spread_update(u,[p[0]&4194304&&h[22]])),toggle_class(t,"bx--form-item",!0)},i(h){r||(transition_in(l),transition_in(a),transition_in(c),r=!0)},o(h){transition_out(l),transition_out(a),transition_out(c),r=!1},d(h){h&&detach(t),l&&l.d(),a&&a.d(),c&&c.d()}}}function instance$1C(i,t,n){let s;const o=["selected","size","inline","light","disabled","id","name","invalid","invalidText","warn","warnText","helperText","noLabel","labelText","hideLabel","ref","required"];let r=compute_rest_props(t,o),l,a,c,u,{$$slots:f={},$$scope:h}=t,{selected:p=void 0}=t,{size:g=void 0}=t,{inline:b=!1}=t,{light:v=!1}=t,{disabled:y=!1}=t,{id:S="ccs-"+Math.random().toString(36)}=t,{name:T=void 0}=t,{invalid:w=!1}=t,{invalidText:A=""}=t,{warn:x=!1}=t,{warnText:C=""}=t,{helperText:I=""}=t,{noLabel:M=!1}=t,{labelText:E=""}=t,{hideLabel:L=!1}=t,{ref:R=null}=t,{required:O=!1}=t;const B=createEventDispatcher(),z=writable(p);component_subscribe(i,z,le=>n(38,a=le));const F=writable(null);component_subscribe(i,F,le=>n(40,u=le));const q=writable(null);component_subscribe(i,q,le=>n(24,l=le));const N=writable({});component_subscribe(i,N,le=>n(39,c=le)),setContext("Select",{selectedValue:z,setDefaultValue:(le,Le)=>{l===null?(F.set(le),q.set(Le)):u===le&&z.set(Le),N.update(V=>({...V,[Le]:typeof Le}))}});const ee=({target:le})=>{let Le=le.value;c[Le]==="number"&&(Le=Number(Le)),z.set(Le)};let K;afterUpdate(()=>{n(23,p=a),K!==void 0&&p!==K&&B("update",a),K=p});function Q(le){bubble.call(this,i,le)}function J(le){bubble.call(this,i,le)}function Y(le){bubble.call(this,i,le)}function ce(le){bubble.call(this,i,le)}function Z(le){bubble.call(this,i,le)}function ge(le){bubble.call(this,i,le)}function se(le){bubble.call(this,i,le)}function re(le){bubble.call(this,i,le)}function me(le){binding_callbacks[le?"unshift":"push"](()=>{R=le,n(0,R)})}function fe(le){binding_callbacks[le?"unshift":"push"](()=>{R=le,n(0,R)})}return i.$$set=le=>{t=assign(assign({},t),exclude_internal_props(le)),n(22,r=compute_rest_props(t,o)),"selected"in le&&n(23,p=le.selected),"size"in le&&n(1,g=le.size),"inline"in le&&n(2,b=le.inline),"light"in le&&n(3,v=le.light),"disabled"in le&&n(4,y=le.disabled),"id"in le&&n(5,S=le.id),"name"in le&&n(6,T=le.name),"invalid"in le&&n(7,w=le.invalid),"invalidText"in le&&n(8,A=le.invalidText),"warn"in le&&n(9,x=le.warn),"warnText"in le&&n(10,C=le.warnText),"helperText"in le&&n(11,I=le.helperText),"noLabel"in le&&n(12,M=le.noLabel),"labelText"in le&&n(13,E=le.labelText),"hideLabel"in le&&n(14,L=le.hideLabel),"ref"in le&&n(0,R=le.ref),"required"in le&&n(15,O=le.required),"$$scope"in le&&n(25,h=le.$$scope)},i.$$.update=()=>{i.$$.dirty[0]&32&&n(16,s=`error-${S}`),i.$$.dirty[0]&25165824&&z.set(p??l)},[R,g,b,v,y,S,T,w,A,x,C,I,M,E,L,O,s,z,F,q,N,ee,r,p,l,h,f,Q,J,Y,ce,Z,ge,se,re,me,fe]}let Select$1=class extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1C,create_fragment$1D,safe_not_equal,{selected:23,size:1,inline:2,light:3,disabled:4,id:5,name:6,invalid:7,invalidText:8,warn:9,warnText:10,helperText:11,noLabel:12,labelText:13,hideLabel:14,ref:0,required:15},null,[-1,-1])}};const Select$2=Select$1;function create_fragment$1C(i){let t,n=(i[1]||i[0])+"",s,o,r;return{c(){t=element("option"),s=text(n),t.__value=i[0],t.value=t.__value,t.disabled=i[3],t.hidden=i[2],t.selected=i[4],attr(t,"class",o=i[5].class),attr(t,"style",r=i[5].style),toggle_class(t,"bx--select-option",!0)},m(l,a){insert(l,t,a),append(t,s)},p(l,[a]){a&3&&n!==(n=(l[1]||l[0])+"")&&set_data(s,n),a&1&&(t.__value=l[0],t.value=t.__value),a&8&&(t.disabled=l[3]),a&4&&(t.hidden=l[2]),a&16&&(t.selected=l[4]),a&32&&o!==(o=l[5].class)&&attr(t,"class",o),a&32&&r!==(r=l[5].style)&&attr(t,"style",r),a&32&&toggle_class(t,"bx--select-option",!0)},i:noop$2,o:noop$2,d(l){l&&detach(t)}}}function instance$1B(i,t,n){const s=["value","text","hidden","disabled"];let o=compute_rest_props(t,s),{value:r=""}=t,{text:l=""}=t,{hidden:a=!1}=t,{disabled:c=!1}=t;const u="ccs-"+Math.random().toString(36),f=getContext("Select")||getContext("TimePickerSelect");let h=!1;const p=f.selectedValue.subscribe(g=>{n(4,h=g===r)});return onMount(()=>()=>p()),i.$$set=g=>{t=assign(assign({},t),exclude_internal_props(g)),n(5,o=compute_rest_props(t,s)),"value"in g&&n(0,r=g.value),"text"in g&&n(1,l=g.text),"hidden"in g&&n(2,a=g.hidden),"disabled"in g&&n(3,c=g.disabled)},i.$$.update=()=>{var g;i.$$.dirty&1&&((g=f==null?void 0:f.setDefaultValue)==null||g.call(f,u,r))},[r,l,a,c,h,o]}class SelectItem extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1B,create_fragment$1C,safe_not_equal,{value:0,text:1,hidden:2,disabled:3})}}const SelectItem$1=SelectItem;function get_each_context$h(i,t,n){const s=i.slice();return s[28]=t[n],s[30]=n,s}function get_each_context_1$1(i,t,n){const s=i.slice();return s[28]=t[n],s[30]=n,s}function create_if_block_3$h(i){let t,n,s,o,r,l,a,c;function u(h){i[22](h)}let f={id:"bx--pagination-select-"+i[14],class:"bx--select__item-count",hideLabel:!0,noLabel:!0,inline:!0,$$slots:{default:[create_default_slot_1$d]},$$scope:{ctx:i}};return i[1]!==void 0&&(f.selected=i[1]),l=new Select$2({props:f}),binding_callbacks.push(()=>bind(l,"selected",u,i[1])),l.$on("change",i[23]),{c(){t=element("label"),n=text(i[5]),r=space(),create_component(l.$$.fragment),attr(t,"id",s="bx--pagination-select-"+i[14]+"-count-label"),attr(t,"for",o="bx--pagination-select-"+i[14]),toggle_class(t,"bx--pagination__text",!0)},m(h,p){insert(h,t,p),append(t,n),insert(h,r,p),mount_component(l,h,p),c=!0},p(h,p){(!c||p[0]&32)&&set_data(n,h[5]),(!c||p[0]&16384&&s!==(s="bx--pagination-select-"+h[14]+"-count-label"))&&attr(t,"id",s),(!c||p[0]&16384&&o!==(o="bx--pagination-select-"+h[14]))&&attr(t,"for",o);const g={};p[0]&16384&&(g.id="bx--pagination-select-"+h[14]),p[0]&1024|p[1]&2&&(g.$$scope={dirty:p,ctx:h}),!a&&p[0]&2&&(a=!0,g.selected=h[1],add_flush_callback(()=>a=!1)),l.$set(g)},i(h){c||(transition_in(l.$$.fragment,h),c=!0)},o(h){transition_out(l.$$.fragment,h),c=!1},d(h){h&&detach(t),h&&detach(r),destroy_component(l,h)}}}function create_each_block_1$1(i,t){let n,s,o;return s=new SelectItem$1({props:{value:t[28],text:t[28].toString()}}),{key:i,first:null,c(){n=empty$1(),create_component(s.$$.fragment),this.first=n},m(r,l){insert(r,n,l),mount_component(s,r,l),o=!0},p(r,l){t=r;const a={};l[0]&1024&&(a.value=t[28]),l[0]&1024&&(a.text=t[28].toString()),s.$set(a)},i(r){o||(transition_in(s.$$.fragment,r),o=!0)},o(r){transition_out(s.$$.fragment,r),o=!1},d(r){r&&detach(n),destroy_component(s,r)}}}function create_default_slot_1$d(i){let t=[],n=new Map,s,o,r=i[10];const l=a=>a[28];for(let a=0;abind(t,"selected",l,i[0])),t.$on("change",i[25]);function c(h,p){return h[11]?create_if_block_1$v:create_else_block$v}let u=c(i),f=u(i);return{c(){create_component(t.$$.fragment),s=space(),o=element("span"),f.c(),toggle_class(o,"bx--pagination__text",!0)},m(h,p){mount_component(t,h,p),insert(h,s,p),insert(h,o,p),f.m(o,null),r=!0},p(h,p){const g={};p[0]&16384&&(g.id="bx--pagination-select-"+(h[14]+2)),p[0]&32768&&(g.labelText="Page number, of "+h[15]+" pages"),p[0]&262144|p[1]&2&&(g.$$scope={dirty:p,ctx:h}),!n&&p[0]&1&&(n=!0,g.selected=h[0],add_flush_callback(()=>n=!1)),t.$set(g),u===(u=c(h))&&f?f.p(h,p):(f.d(1),f=u(h),f&&(f.c(),f.m(o,null)))},i(h){r||(transition_in(t.$$.fragment,h),r=!0)},o(h){transition_out(t.$$.fragment,h),r=!1},d(h){destroy_component(t,h),h&&detach(s),h&&detach(o),f.d()}}}function create_each_block$h(i,t){let n,s,o;return s=new SelectItem$1({props:{value:t[28]+1,text:(t[28]+1).toString()}}),{key:i,first:null,c(){n=empty$1(),create_component(s.$$.fragment),this.first=n},m(r,l){insert(r,n,l),mount_component(s,r,l),o=!0},p(r,l){t=r;const a={};l[0]&262144&&(a.value=t[28]+1),l[0]&262144&&(a.text=(t[28]+1).toString()),s.$set(a)},i(r){o||(transition_in(s.$$.fragment,r),o=!0)},o(r){transition_out(s.$$.fragment,r),o=!1},d(r){r&&detach(n),destroy_component(s,r)}}}function create_default_slot$p(i){let t=[],n=new Map,s,o,r=i[18];const l=a=>a[28];for(let a=0;a{p=null}),check_outros()):p?(p.p(w,A),A[0]&512&&transition_in(p,1)):(p=create_if_block_3$h(w),p.c(),transition_in(p,1),p.m(n,s)),b===(b=g(w))&&v?v.p(w,A):(v.d(1),v=b(w),v&&(v.c(),v.m(o,null))),(!h||A[0]&512)&&toggle_class(o,"bx--pagination__text",!w[9]),w[8]?y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros()):y?(y.p(w,A),A[0]&256&&transition_in(y,1)):(y=create_if_block$10(w),y.c(),transition_in(y,1),y.m(l,a));const x={};A[0]&16&&(x.iconDescription=w[4]),A[0]&131072&&(x.disabled=w[17]),A[0]&131072&&(x.class="bx--pagination__button bx--pagination__button--backward "+(w[17]?"bx--pagination__button--no-index":"")),c.$set(x);const C={};A[0]&8&&(C.iconDescription=w[3]),A[0]&65536&&(C.disabled=w[16]),A[0]&65536&&(C.class="bx--pagination__button bx--pagination__button--forward "+(w[16]?"bx--pagination__button--no-index":"")),f.$set(C),set_attributes(t,T=get_spread_update(S,[(!h||A[0]&16384)&&{id:w[14]},A[0]&1048576&&w[20]])),toggle_class(t,"bx--pagination",!0)},i(w){h||(transition_in(p),transition_in(y),transition_in(c.$$.fragment,w),transition_in(f.$$.fragment,w),h=!0)},o(w){transition_out(p),transition_out(y),transition_out(c.$$.fragment,w),transition_out(f.$$.fragment,w),h=!1},d(w){w&&detach(t),p&&p.d(),v.d(),y&&y.d(),destroy_component(c),destroy_component(f)}}}function instance$1A(i,t,n){let s,o,r,l;const a=["page","totalItems","disabled","forwardText","backwardText","itemsPerPageText","itemText","itemRangeText","pageInputDisabled","pageSizeInputDisabled","pageSize","pageSizes","pagesUnknown","pageText","pageRangeText","id"];let c=compute_rest_props(t,a),{page:u=1}=t,{totalItems:f=0}=t,{disabled:h=!1}=t,{forwardText:p="Next page"}=t,{backwardText:g="Previous page"}=t,{itemsPerPageText:b="Items per page:"}=t,{itemText:v=(q,N)=>`${q}–${N} item${N===1?"":"s"}`}=t,{itemRangeText:y=(q,N,ee)=>`${q}–${N} of ${ee} item${N===1?"":"s"}`}=t,{pageInputDisabled:S=!1}=t,{pageSizeInputDisabled:T=!1}=t,{pageSize:w=10}=t,{pageSizes:A=[10]}=t,{pagesUnknown:x=!1}=t,{pageText:C=q=>`page ${q}`}=t,{pageRangeText:I=(q,N)=>`of ${N} page${N===1?"":"s"}`}=t,{id:M="ccs-"+Math.random().toString(36)}=t;const E=createEventDispatcher();afterUpdate(()=>{u>s&&n(0,u=s)});function L(q){w=q,n(1,w)}const R=()=>{E("change",{pageSize:w})};function O(q){u=q,n(0,u)}const B=()=>{E("change",{page:u})},z=()=>{n(0,u--,u),E("click:button--previous",{page:u}),E("change",{page:u})},F=()=>{n(0,u++,u),E("click:button--next",{page:u}),E("change",{page:u})};return i.$$set=q=>{t=assign(assign({},t),exclude_internal_props(q)),n(20,c=compute_rest_props(t,a)),"page"in q&&n(0,u=q.page),"totalItems"in q&&n(2,f=q.totalItems),"disabled"in q&&n(21,h=q.disabled),"forwardText"in q&&n(3,p=q.forwardText),"backwardText"in q&&n(4,g=q.backwardText),"itemsPerPageText"in q&&n(5,b=q.itemsPerPageText),"itemText"in q&&n(6,v=q.itemText),"itemRangeText"in q&&n(7,y=q.itemRangeText),"pageInputDisabled"in q&&n(8,S=q.pageInputDisabled),"pageSizeInputDisabled"in q&&n(9,T=q.pageSizeInputDisabled),"pageSize"in q&&n(1,w=q.pageSize),"pageSizes"in q&&n(10,A=q.pageSizes),"pagesUnknown"in q&&n(11,x=q.pagesUnknown),"pageText"in q&&n(12,C=q.pageText),"pageRangeText"in q&&n(13,I=q.pageRangeText),"id"in q&&n(14,M=q.id)},i.$$.update=()=>{i.$$.dirty[0]&3&&E("update",{pageSize:w,page:u}),i.$$.dirty[0]&6&&n(15,s=Math.max(Math.ceil(f/w),1)),i.$$.dirty[0]&32768&&n(18,o=Array.from({length:s},(q,N)=>N)),i.$$.dirty[0]&2097153&&n(17,r=h||u===1),i.$$.dirty[0]&2129921&&n(16,l=h||u===s)},[u,w,f,p,g,b,v,y,S,T,A,x,C,I,M,s,l,r,o,E,c,h,L,R,O,B,z,F]}class Pagination extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1A,create_fragment$1B,safe_not_equal,{page:0,totalItems:2,disabled:21,forwardText:3,backwardText:4,itemsPerPageText:5,itemText:6,itemRangeText:7,pageInputDisabled:8,pageSizeInputDisabled:9,pageSize:1,pageSizes:10,pagesUnknown:11,pageText:12,pageRangeText:13,id:14},null,[-1,-1])}}const Pagination$1=Pagination,get_content_slot_changes=i=>({}),get_content_slot_context=i=>({});function create_if_block$$(i){let t=i[3].label+"",n;return{c(){n=text(t)},m(s,o){insert(s,n,o)},p(s,o){o[0]&8&&t!==(t=s[3].label+"")&&set_data(n,t)},d(s){s&&detach(n)}}}function create_fragment$1A(i){let t,n,s,o,r,l,a,c,u,f,h,p,g=i[3]&&create_if_block$$(i);r=new ChevronDown$1({props:{"aria-hidden":"true",title:i[1]}});const b=i[20].default,v=create_slot(b,i,i[19],null);let y=[{role:"navigation"},i[10]],S={};for(let A=0;An(18,u=Q));const A=derived(w,Q=>Q.reduce((J,Y)=>({...J,[Y.id]:Y}),{}));component_subscribe(i,A,Q=>n(28,f=Q));const x=writable(v),C=writable(void 0);component_subscribe(i,C,Q=>n(16,a=Q));const I=writable([]);component_subscribe(i,I,Q=>n(17,c=Q));const M=derived(I,Q=>Q.reduce((J,Y)=>({...J,[Y.id]:Y}),{})),E=writable(void 0);let L=null;setContext("Tabs",{tabs:w,contentById:M,selectedTab:C,selectedContent:E,useAutoWidth:x,add:Q=>{w.update(J=>[...J,{...Q,index:J.length}])},addContent:Q=>{I.update(J=>[...J,{...Q,index:J.length}])},update:Q=>{n(14,O=f[Q].index)},change:async Q=>{let J=O+Q;J<0?J=u.length-1:J>=u.length&&(J=0);let Y=u[J].disabled;for(;Y;)J=J+Q,J<0?J=u.length-1:J>=u.length&&(J=0),Y=u[J].disabled;n(14,O=J),await tick();const ce=L==null?void 0:L.querySelectorAll("[role='tab']")[O];ce==null||ce.focus()}}),afterUpdate(()=>{n(12,g=O),B>-1&&B!==O&&T("change",O),B=O});let R=!0,O=g,B=-1;function z(Q){bubble.call(this,i,Q)}function F(Q){bubble.call(this,i,Q)}const q=()=>{n(5,R=!R)},N=()=>{n(5,R=!R)},ee=()=>{n(5,R=!R)};function K(Q){binding_callbacks[Q?"unshift":"push"](()=>{L=Q,n(4,L)})}return i.$$set=Q=>{n(11,t=assign(assign({},t),exclude_internal_props(Q))),n(10,l=compute_rest_props(t,r)),"selected"in Q&&n(12,g=Q.selected),"type"in Q&&n(0,b=Q.type),"autoWidth"in Q&&n(13,v=Q.autoWidth),"iconDescription"in Q&&n(1,y=Q.iconDescription),"triggerHref"in Q&&n(2,S=Q.triggerHref),"$$scope"in Q&&n(19,p=Q.$$scope)},i.$$.update=()=>{i.$$.dirty[0]&4096&&n(14,O=g),i.$$.dirty[0]&278528&&n(3,s=u[O]||void 0),i.$$.dirty[0]&147456&&n(15,o=c[O]||void 0),i.$$.dirty[0]&32776&&(s&&C.set(s.id),o&&E.set(o.id)),i.$$.dirty[0]&65536&&a&&n(5,R=!0),i.$$.dirty[0]&8192&&x.set(v)},t=exclude_internal_props(t),[b,y,S,s,L,R,w,A,C,I,l,t,g,v,O,o,a,c,u,p,h,z,F,q,N,ee,K]}class Tabs extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1z,create_fragment$1A,safe_not_equal,{selected:12,type:0,autoWidth:13,iconDescription:1,triggerHref:2},null,[-1,-1])}}const Tabs$1=Tabs;function fallback_block$4(i){let t;return{c(){t=text(i[1])},m(n,s){insert(n,t,s)},p(n,s){s&2&&set_data(t,n[1])},d(n){n&&detach(t)}}}function create_fragment$1z(i){let t,n,s,o,r,l,a;const c=i[15].default,u=create_slot(c,i,i[14],null),f=u||fallback_block$4(i);let h=[{tabindex:"-1"},{role:"presentation"},i[12]],p={};for(let g=0;gn(13,l=O)),component_subscribe(i,S,O=>n(7,a=O)),T({id:b,label:f,disabled:p});function x(O){bubble.call(this,i,O)}function C(O){bubble.call(this,i,O)}function I(O){bubble.call(this,i,O)}function M(O){bubble.call(this,i,O)}function E(O){binding_callbacks[O?"unshift":"push"](()=>{v=O,n(0,v)})}const L=()=>{p||w(b)},R=({key:O})=>{p||(O==="ArrowRight"?A(1):O==="ArrowLeft"?A(-1):(O===" "||O==="Enter")&&w(b))};return i.$$set=O=>{t=assign(assign({},t),exclude_internal_props(O)),n(12,r=compute_rest_props(t,o)),"label"in O&&n(1,f=O.label),"href"in O&&n(2,h=O.href),"disabled"in O&&n(3,p=O.disabled),"tabindex"in O&&n(4,g=O.tabindex),"id"in O&&n(5,b=O.id),"ref"in O&&n(0,v=O.ref),"$$scope"in O&&n(14,u=O.$$scope)},i.$$.update=()=>{i.$$.dirty&8224&&n(6,s=l===b)},[v,f,h,p,g,b,s,a,y,S,w,A,r,l,u,c,x,C,I,M,E,L,R]}class Tab extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1y,create_fragment$1z,safe_not_equal,{label:1,href:2,disabled:3,tabindex:4,id:5,ref:0})}}const Tab$1=Tab;function create_fragment$1y(i){let t,n,s,o;const r=i[12].default,l=create_slot(r,i,i[11],null);let a=[{role:"tabpanel"},{"aria-labelledby":i[1]},{"aria-hidden":n=!i[2]},{hidden:s=i[2]?void 0:""},{id:i[0]},i[6]],c={};for(let u=0;un(10,f=T)),component_subscribe(i,y,T=>n(8,c=T)),component_subscribe(i,S,T=>n(9,u=T)),v({id:g}),i.$$set=T=>{t=assign(assign({},t),exclude_internal_props(T)),n(6,a=compute_rest_props(t,l)),"id"in T&&n(0,g=T.id),"$$scope"in T&&n(11,p=T.$$scope)},i.$$.update=()=>{i.$$.dirty&1025&&n(2,s=f===g),i.$$.dirty&513&&n(7,o=u[g].index),i.$$.dirty&384&&n(1,r=c[o].id)},[g,r,s,b,y,S,a,o,c,u,f,p,h]}class TabContent extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1x,create_fragment$1y,safe_not_equal,{id:0})}}const TabContent$1=TabContent,get_labelText_slot_changes$2=i=>({}),get_labelText_slot_context$2=i=>({});function create_if_block_3$g(i){let t,n,s,o;const r=i[20].labelText,l=create_slot(r,i,i[19],get_labelText_slot_context$2),a=l||fallback_block$3(i);let c=i[5]&&create_if_block_4$6(i);return{c(){t=element("div"),n=element("label"),a&&a.c(),s=space(),c&&c.c(),attr(n,"for",i[14]),toggle_class(n,"bx--label",!0),toggle_class(n,"bx--visually-hidden",i[11]),toggle_class(n,"bx--label--disabled",i[7]),toggle_class(t,"bx--text-area__label-wrapper",!0)},m(u,f){insert(u,t,f),append(t,n),a&&a.m(n,null),append(t,s),c&&c.m(t,null),o=!0},p(u,f){l?l.p&&(!o||f[0]&524288)&&update_slot_base(l,r,u,u[19],o?get_slot_changes(r,u[19],f,get_labelText_slot_changes$2):get_all_dirty_from_scope(u[19]),get_labelText_slot_context$2):a&&a.p&&(!o||f[0]&1024)&&a.p(u,o?f:[-1,-1]),(!o||f[0]&16384)&&attr(n,"for",u[14]),(!o||f[0]&2048)&&toggle_class(n,"bx--visually-hidden",u[11]),(!o||f[0]&128)&&toggle_class(n,"bx--label--disabled",u[7]),u[5]?c?c.p(u,f):(c=create_if_block_4$6(u),c.c(),c.m(t,null)):c&&(c.d(1),c=null)},i(u){o||(transition_in(a,u),o=!0)},o(u){transition_out(a,u),o=!1},d(u){u&&detach(t),a&&a.d(u),c&&c.d()}}}function fallback_block$3(i){let t;return{c(){t=text(i[10])},m(n,s){insert(n,t,s)},p(n,s){s[0]&1024&&set_data(t,n[10])},d(n){n&&detach(t)}}}function create_if_block_4$6(i){let t,n=i[0].length+"",s,o,r;return{c(){t=element("div"),s=text(n),o=text("/"),r=text(i[5]),toggle_class(t,"bx--label",!0),toggle_class(t,"bx--label--disabled",i[7])},m(l,a){insert(l,t,a),append(t,s),append(t,o),append(t,r)},p(l,a){a[0]&1&&n!==(n=l[0].length+"")&&set_data(s,n),a[0]&32&&set_data(r,l[5]),a[0]&128&&toggle_class(t,"bx--label--disabled",l[7])},d(l){l&&detach(t)}}}function create_if_block_2$n(i){let t,n;return t=new WarningFilled$1({props:{class:"bx--text-area__invalid-icon"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$u(i){let t,n;return{c(){t=element("div"),n=text(i[9]),toggle_class(t,"bx--form__helper-text",!0),toggle_class(t,"bx--form__helper-text--disabled",i[7])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&512&&set_data(n,s[9]),o[0]&128&&toggle_class(t,"bx--form__helper-text--disabled",s[7])},d(s){s&&detach(t)}}}function create_if_block$_(i){let t,n;return{c(){t=element("div"),n=text(i[13]),attr(t,"id",i[16]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&8192&&set_data(n,s[13]),o[0]&65536&&attr(t,"id",s[16])},d(s){s&&detach(t)}}}function create_fragment$1x(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v=(i[10]||i[17].labelText)&&!i[11]&&create_if_block_3$g(i),y=i[12]&&create_if_block_2$n(),S=[{"aria-invalid":l=i[12]||void 0},{"aria-describedby":a=i[12]?i[16]:void 0},{disabled:i[7]},{id:i[14]},{name:i[15]},{cols:i[3]},{rows:i[4]},{placeholder:i[2]},{readOnly:i[8]},{maxlength:c=i[5]??void 0},i[18]],T={};for(let x=0;x{v=null}),check_outros()),x[12]?y?C[0]&4096&&transition_in(y,1):(y=create_if_block_2$n(),y.c(),transition_in(y,1),y.m(s,o)):y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros()),set_attributes(r,T=get_spread_update(S,[(!p||C[0]&4096&&l!==(l=x[12]||void 0))&&{"aria-invalid":l},(!p||C[0]&69632&&a!==(a=x[12]?x[16]:void 0))&&{"aria-describedby":a},(!p||C[0]&128)&&{disabled:x[7]},(!p||C[0]&16384)&&{id:x[14]},(!p||C[0]&32768)&&{name:x[15]},(!p||C[0]&8)&&{cols:x[3]},(!p||C[0]&16)&&{rows:x[4]},(!p||C[0]&4)&&{placeholder:x[2]},(!p||C[0]&256)&&{readOnly:x[8]},(!p||C[0]&32&&c!==(c=x[5]??void 0))&&{maxlength:c},C[0]&262144&&x[18]])),C[0]&1&&set_input_value(r,x[0]),toggle_class(r,"bx--text-area",!0),toggle_class(r,"bx--text-area--light",x[6]),toggle_class(r,"bx--text-area--invalid",x[12]),(!p||C[0]&4096&&u!==(u=x[12]||void 0))&&attr(s,"data-invalid",u),!x[12]&&x[9]?w?w.p(x,C):(w=create_if_block_1$u(x),w.c(),w.m(t,h)):w&&(w.d(1),w=null),x[12]?A?A.p(x,C):(A=create_if_block$_(x),A.c(),A.m(t,null)):A&&(A.d(1),A=null)},i(x){p||(transition_in(v),transition_in(y),p=!0)},o(x){transition_out(v),transition_out(y),p=!1},d(x){x&&detach(t),v&&v.d(),y&&y.d(),i[32](null),w&&w.d(),A&&A.d(),g=!1,run_all(b)}}}function instance$1w(i,t,n){let s;const o=["value","placeholder","cols","rows","maxCount","light","disabled","readonly","helperText","labelText","hideLabel","invalid","invalidText","id","name","ref"];let r=compute_rest_props(t,o),{$$slots:l={},$$scope:a}=t;const c=compute_slots(l);let{value:u=""}=t,{placeholder:f=""}=t,{cols:h=50}=t,{rows:p=4}=t,{maxCount:g=void 0}=t,{light:b=!1}=t,{disabled:v=!1}=t,{readonly:y=!1}=t,{helperText:S=""}=t,{labelText:T=""}=t,{hideLabel:w=!1}=t,{invalid:A=!1}=t,{invalidText:x=""}=t,{id:C="ccs-"+Math.random().toString(36)}=t,{name:I=void 0}=t,{ref:M=null}=t;function E(Y){bubble.call(this,i,Y)}function L(Y){bubble.call(this,i,Y)}function R(Y){bubble.call(this,i,Y)}function O(Y){bubble.call(this,i,Y)}function B(Y){bubble.call(this,i,Y)}function z(Y){bubble.call(this,i,Y)}function F(Y){bubble.call(this,i,Y)}function q(Y){bubble.call(this,i,Y)}function N(Y){bubble.call(this,i,Y)}function ee(Y){bubble.call(this,i,Y)}function K(Y){bubble.call(this,i,Y)}function Q(Y){binding_callbacks[Y?"unshift":"push"](()=>{M=Y,n(1,M)})}function J(){u=this.value,n(0,u)}return i.$$set=Y=>{t=assign(assign({},t),exclude_internal_props(Y)),n(18,r=compute_rest_props(t,o)),"value"in Y&&n(0,u=Y.value),"placeholder"in Y&&n(2,f=Y.placeholder),"cols"in Y&&n(3,h=Y.cols),"rows"in Y&&n(4,p=Y.rows),"maxCount"in Y&&n(5,g=Y.maxCount),"light"in Y&&n(6,b=Y.light),"disabled"in Y&&n(7,v=Y.disabled),"readonly"in Y&&n(8,y=Y.readonly),"helperText"in Y&&n(9,S=Y.helperText),"labelText"in Y&&n(10,T=Y.labelText),"hideLabel"in Y&&n(11,w=Y.hideLabel),"invalid"in Y&&n(12,A=Y.invalid),"invalidText"in Y&&n(13,x=Y.invalidText),"id"in Y&&n(14,C=Y.id),"name"in Y&&n(15,I=Y.name),"ref"in Y&&n(1,M=Y.ref),"$$scope"in Y&&n(19,a=Y.$$scope)},i.$$.update=()=>{i.$$.dirty[0]&16384&&n(16,s=`error-${C}`)},[u,M,f,h,p,g,b,v,y,S,T,w,A,x,C,I,s,c,r,a,l,E,L,R,O,B,z,F,q,N,ee,K,Q,J]}class TextArea extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1w,create_fragment$1x,safe_not_equal,{value:0,placeholder:2,cols:3,rows:4,maxCount:5,light:6,disabled:7,readonly:8,helperText:9,labelText:10,hideLabel:11,invalid:12,invalidText:13,id:14,name:15,ref:1},null,[-1,-1])}}const TextArea$1=TextArea,get_labelText_slot_changes_1=i=>({}),get_labelText_slot_context_1=i=>({}),get_labelText_slot_changes$1=i=>({}),get_labelText_slot_context$1=i=>({});function create_if_block_10$1(i){let t,n,s,o=i[9]&&create_if_block_12$1(i),r=!i[20]&&i[6]&&create_if_block_11$1(i);return{c(){t=element("div"),o&&o.c(),n=space(),r&&r.c(),toggle_class(t,"bx--text-input__label-helper-wrapper",!0)},m(l,a){insert(l,t,a),o&&o.m(t,null),append(t,n),r&&r.m(t,null),s=!0},p(l,a){l[9]?o?(o.p(l,a),a[0]&512&&transition_in(o,1)):(o=create_if_block_12$1(l),o.c(),transition_in(o,1),o.m(t,n)):o&&(group_outros(),transition_out(o,1,1,()=>{o=null}),check_outros()),!l[20]&&l[6]?r?r.p(l,a):(r=create_if_block_11$1(l),r.c(),r.m(t,null)):r&&(r.d(1),r=null)},i(l){s||(transition_in(o),s=!0)},o(l){transition_out(o),s=!1},d(l){l&&detach(t),o&&o.d(),r&&r.d()}}}function create_if_block_12$1(i){let t,n;const s=i[26].labelText,o=create_slot(s,i,i[25],get_labelText_slot_context$1),r=o||fallback_block_1$2(i);return{c(){t=element("label"),r&&r.c(),attr(t,"for",i[7]),toggle_class(t,"bx--label",!0),toggle_class(t,"bx--visually-hidden",i[10]),toggle_class(t,"bx--label--disabled",i[5]),toggle_class(t,"bx--label--inline",i[16]),toggle_class(t,"bx--label--inline--sm",i[2]==="sm"),toggle_class(t,"bx--label--inline--xl",i[2]==="xl")},m(l,a){insert(l,t,a),r&&r.m(t,null),n=!0},p(l,a){o?o.p&&(!n||a[0]&33554432)&&update_slot_base(o,s,l,l[25],n?get_slot_changes(s,l[25],a,get_labelText_slot_changes$1):get_all_dirty_from_scope(l[25]),get_labelText_slot_context$1):r&&r.p&&(!n||a[0]&512)&&r.p(l,n?a:[-1,-1]),(!n||a[0]&128)&&attr(t,"for",l[7]),(!n||a[0]&1024)&&toggle_class(t,"bx--visually-hidden",l[10]),(!n||a[0]&32)&&toggle_class(t,"bx--label--disabled",l[5]),(!n||a[0]&65536)&&toggle_class(t,"bx--label--inline",l[16]),(!n||a[0]&4)&&toggle_class(t,"bx--label--inline--sm",l[2]==="sm"),(!n||a[0]&4)&&toggle_class(t,"bx--label--inline--xl",l[2]==="xl")},i(l){n||(transition_in(r,l),n=!0)},o(l){transition_out(r,l),n=!1},d(l){l&&detach(t),r&&r.d(l)}}}function fallback_block_1$2(i){let t;return{c(){t=text(i[9])},m(n,s){insert(n,t,s)},p(n,s){s[0]&512&&set_data(t,n[9])},d(n){n&&detach(t)}}}function create_if_block_11$1(i){let t,n;return{c(){t=element("div"),n=text(i[6]),toggle_class(t,"bx--form__helper-text",!0),toggle_class(t,"bx--form__helper-text--disabled",i[5]),toggle_class(t,"bx--form__helper-text--inline",i[16])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&64&&set_data(n,s[6]),o[0]&32&&toggle_class(t,"bx--form__helper-text--disabled",s[5]),o[0]&65536&&toggle_class(t,"bx--form__helper-text--inline",s[16])},d(s){s&&detach(t)}}}function create_if_block_9$1(i){let t,n;const s=i[26].labelText,o=create_slot(s,i,i[25],get_labelText_slot_context_1),r=o||fallback_block$2(i);return{c(){t=element("label"),r&&r.c(),attr(t,"for",i[7]),toggle_class(t,"bx--label",!0),toggle_class(t,"bx--visually-hidden",i[10]),toggle_class(t,"bx--label--disabled",i[5]),toggle_class(t,"bx--label--inline",i[16]),toggle_class(t,"bx--label--inline-sm",i[16]&&i[2]==="sm"),toggle_class(t,"bx--label--inline-xl",i[16]&&i[2]==="xl")},m(l,a){insert(l,t,a),r&&r.m(t,null),n=!0},p(l,a){o?o.p&&(!n||a[0]&33554432)&&update_slot_base(o,s,l,l[25],n?get_slot_changes(s,l[25],a,get_labelText_slot_changes_1):get_all_dirty_from_scope(l[25]),get_labelText_slot_context_1):r&&r.p&&(!n||a[0]&512)&&r.p(l,n?a:[-1,-1]),(!n||a[0]&128)&&attr(t,"for",l[7]),(!n||a[0]&1024)&&toggle_class(t,"bx--visually-hidden",l[10]),(!n||a[0]&32)&&toggle_class(t,"bx--label--disabled",l[5]),(!n||a[0]&65536)&&toggle_class(t,"bx--label--inline",l[16]),(!n||a[0]&65540)&&toggle_class(t,"bx--label--inline-sm",l[16]&&l[2]==="sm"),(!n||a[0]&65540)&&toggle_class(t,"bx--label--inline-xl",l[16]&&l[2]==="xl")},i(l){n||(transition_in(r,l),n=!0)},o(l){transition_out(r,l),n=!1},d(l){l&&detach(t),r&&r.d(l)}}}function fallback_block$2(i){let t;return{c(){t=text(i[9])},m(n,s){insert(n,t,s)},p(n,s){s[0]&512&&set_data(t,n[9])},d(n){n&&detach(t)}}}function create_if_block_8$2(i){let t,n;return t=new WarningFilled$1({props:{class:"bx--text-input__invalid-icon"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_7$2(i){let t,n;return t=new WarningAltFilled$1({props:{class:`bx--text-input__invalid-icon - bx--text-input__invalid-icon--warning`}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_6$2(i){let t,n;return t=new EditOff$1({props:{class:"bx--text-input__readonly-icon"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_5$4(i){let t;return{c(){t=element("hr"),toggle_class(t,"bx--text-input__divider",!0)},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_4$5(i){let t,n;return{c(){t=element("div"),n=text(i[12]),attr(t,"id",i[19]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&4096&&set_data(n,s[12]),o[0]&524288&&attr(t,"id",s[19])},d(s){s&&detach(t)}}}function create_if_block_3$f(i){let t,n;return{c(){t=element("div"),n=text(i[14]),attr(t,"id",i[18]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&16384&&set_data(n,s[14]),o[0]&262144&&attr(t,"id",s[18])},d(s){s&&detach(t)}}}function create_if_block_2$m(i){let t,n;return{c(){t=element("div"),n=text(i[6]),toggle_class(t,"bx--form__helper-text",!0),toggle_class(t,"bx--form__helper-text--disabled",i[5]),toggle_class(t,"bx--form__helper-text--inline",i[16])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&64&&set_data(n,s[6]),o[0]&32&&toggle_class(t,"bx--form__helper-text--disabled",s[5]),o[0]&65536&&toggle_class(t,"bx--form__helper-text--inline",s[16])},d(s){s&&detach(t)}}}function create_if_block_1$t(i){let t,n;return{c(){t=element("div"),n=text(i[12]),attr(t,"id",i[19]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&4096&&set_data(n,s[12]),o[0]&524288&&attr(t,"id",s[19])},d(s){s&&detach(t)}}}function create_if_block$Z(i){let t,n;return{c(){t=element("div"),n=text(i[14]),attr(t,"id",i[18]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&16384&&set_data(n,s[14]),o[0]&262144&&attr(t,"id",s[18])},d(s){s&&detach(t)}}}function create_fragment$1w(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M,E=i[16]&&create_if_block_10$1(i),L=!i[16]&&(i[9]||i[24].labelText)&&create_if_block_9$1(i),R=i[11]&&create_if_block_8$2(),O=!i[11]&&i[13]&&create_if_block_7$2(),B=i[17]&&create_if_block_6$2(),z=[{"data-invalid":f=i[11]||void 0},{"aria-invalid":h=i[11]||void 0},{"data-warn":p=i[13]||void 0},{"aria-describedby":g=i[11]?i[19]:i[13]?i[18]:void 0},{disabled:i[5]},{id:i[7]},{name:i[8]},{placeholder:i[3]},{required:i[15]},{readOnly:i[17]},i[23]],F={};for(let Y=0;Y{E=null}),check_outros()),!Y[16]&&(Y[9]||Y[24].labelText)?L?(L.p(Y,ce),ce[0]&16843264&&transition_in(L,1)):(L=create_if_block_9$1(Y),L.c(),transition_in(L,1),L.m(t,s)):L&&(group_outros(),transition_out(L,1,1,()=>{L=null}),check_outros()),Y[11]?R?ce[0]&2048&&transition_in(R,1):(R=create_if_block_8$2(),R.c(),transition_in(R,1),R.m(r,l)):R&&(group_outros(),transition_out(R,1,1,()=>{R=null}),check_outros()),!Y[11]&&Y[13]?O?ce[0]&10240&&transition_in(O,1):(O=create_if_block_7$2(),O.c(),transition_in(O,1),O.m(r,a)):O&&(group_outros(),transition_out(O,1,1,()=>{O=null}),check_outros()),Y[17]?B?ce[0]&131072&&transition_in(B,1):(B=create_if_block_6$2(),B.c(),transition_in(B,1),B.m(r,c)):B&&(group_outros(),transition_out(B,1,1,()=>{B=null}),check_outros()),set_attributes(u,F=get_spread_update(z,[(!C||ce[0]&2048&&f!==(f=Y[11]||void 0))&&{"data-invalid":f},(!C||ce[0]&2048&&h!==(h=Y[11]||void 0))&&{"aria-invalid":h},(!C||ce[0]&8192&&p!==(p=Y[13]||void 0))&&{"data-warn":p},(!C||ce[0]&796672&&g!==(g=Y[11]?Y[19]:Y[13]?Y[18]:void 0))&&{"aria-describedby":g},(!C||ce[0]&32)&&{disabled:Y[5]},(!C||ce[0]&128)&&{id:Y[7]},(!C||ce[0]&256)&&{name:Y[8]},(!C||ce[0]&8)&&{placeholder:Y[3]},(!C||ce[0]&32768)&&{required:Y[15]},(!C||ce[0]&131072)&&{readOnly:Y[17]},ce[0]&8388608&&Y[23]])),ce[0]&1&&u.value!==Y[0]&&set_input_value(u,Y[0]),toggle_class(u,"bx--text-input",!0),toggle_class(u,"bx--text-input--light",Y[4]),toggle_class(u,"bx--text-input--invalid",Y[11]),toggle_class(u,"bx--text-input--warn",Y[13]),toggle_class(u,"bx--text-input--sm",Y[2]==="sm"),toggle_class(u,"bx--text-input--xl",Y[2]==="xl"),Y[20]?q||(q=create_if_block_5$4(),q.c(),q.m(r,v)):q&&(q.d(1),q=null),Y[20]&&!Y[16]&&Y[11]?N?N.p(Y,ce):(N=create_if_block_4$5(Y),N.c(),N.m(r,y)):N&&(N.d(1),N=null),Y[20]&&!Y[16]&&Y[13]?ee?ee.p(Y,ce):(ee=create_if_block_3$f(Y),ee.c(),ee.m(r,null)):ee&&(ee.d(1),ee=null),(!C||ce[0]&2048&&S!==(S=Y[11]||void 0))&&attr(r,"data-invalid",S),(!C||ce[0]&8192&&T!==(T=Y[13]||void 0))&&attr(r,"data-warn",T),(!C||ce[0]&10240)&&toggle_class(r,"bx--text-input__field-wrapper--warning",!Y[11]&&Y[13]),!Y[11]&&!Y[13]&&!Y[20]&&!Y[16]&&Y[6]?K?K.p(Y,ce):(K=create_if_block_2$m(Y),K.c(),K.m(o,A)):K&&(K.d(1),K=null),!Y[20]&&Y[11]?Q?Q.p(Y,ce):(Q=create_if_block_1$t(Y),Q.c(),Q.m(o,x)):Q&&(Q.d(1),Q=null),!Y[20]&&!Y[11]&&Y[13]?J?J.p(Y,ce):(J=create_if_block$Z(Y),J.c(),J.m(o,null)):J&&(J.d(1),J=null),(!C||ce[0]&65536)&&toggle_class(o,"bx--text-input__field-outer-wrapper--inline",Y[16]),(!C||ce[0]&65536)&&toggle_class(t,"bx--text-input-wrapper--inline",Y[16]),(!C||ce[0]&16)&&toggle_class(t,"bx--text-input-wrapper--light",Y[4]),(!C||ce[0]&131072)&&toggle_class(t,"bx--text-input-wrapper--readonly",Y[17])},i(Y){C||(transition_in(E),transition_in(L),transition_in(R),transition_in(O),transition_in(B),C=!0)},o(Y){transition_out(E),transition_out(L),transition_out(R),transition_out(O),transition_out(B),C=!1},d(Y){Y&&detach(t),E&&E.d(),L&&L.d(),R&&R.d(),O&&O.d(),B&&B.d(),i[36](null),q&&q.d(),N&&N.d(),ee&&ee.d(),K&&K.d(),Q&&Q.d(),J&&J.d(),I=!1,run_all(M)}}}function instance$1v(i,t,n){let s,o,r;const l=["size","value","placeholder","light","disabled","helperText","id","name","labelText","hideLabel","invalid","invalidText","warn","warnText","ref","required","inline","readonly"];let a=compute_rest_props(t,l),{$$slots:c={},$$scope:u}=t;const f=compute_slots(c);let{size:h=void 0}=t,{value:p=""}=t,{placeholder:g=""}=t,{light:b=!1}=t,{disabled:v=!1}=t,{helperText:y=""}=t,{id:S="ccs-"+Math.random().toString(36)}=t,{name:T=void 0}=t,{labelText:w=""}=t,{hideLabel:A=!1}=t,{invalid:x=!1}=t,{invalidText:C=""}=t,{warn:I=!1}=t,{warnText:M=""}=t,{ref:E=null}=t,{required:L=!1}=t,{inline:R=!1}=t,{readonly:O=!1}=t;const B=getContext("Form"),z=createEventDispatcher();function F(fe){return a.type!=="number"?fe:fe!=""?Number(fe):null}const q=fe=>{n(0,p=F(fe.target.value)),z("input",p)},N=fe=>{z("change",F(fe.target.value))};function ee(fe){bubble.call(this,i,fe)}function K(fe){bubble.call(this,i,fe)}function Q(fe){bubble.call(this,i,fe)}function J(fe){bubble.call(this,i,fe)}function Y(fe){bubble.call(this,i,fe)}function ce(fe){bubble.call(this,i,fe)}function Z(fe){bubble.call(this,i,fe)}function ge(fe){bubble.call(this,i,fe)}function se(fe){bubble.call(this,i,fe)}function re(fe){binding_callbacks[fe?"unshift":"push"](()=>{E=fe,n(1,E)})}function me(){p=this.value,n(0,p)}return i.$$set=fe=>{t=assign(assign({},t),exclude_internal_props(fe)),n(23,a=compute_rest_props(t,l)),"size"in fe&&n(2,h=fe.size),"value"in fe&&n(0,p=fe.value),"placeholder"in fe&&n(3,g=fe.placeholder),"light"in fe&&n(4,b=fe.light),"disabled"in fe&&n(5,v=fe.disabled),"helperText"in fe&&n(6,y=fe.helperText),"id"in fe&&n(7,S=fe.id),"name"in fe&&n(8,T=fe.name),"labelText"in fe&&n(9,w=fe.labelText),"hideLabel"in fe&&n(10,A=fe.hideLabel),"invalid"in fe&&n(11,x=fe.invalid),"invalidText"in fe&&n(12,C=fe.invalidText),"warn"in fe&&n(13,I=fe.warn),"warnText"in fe&&n(14,M=fe.warnText),"ref"in fe&&n(1,E=fe.ref),"required"in fe&&n(15,L=fe.required),"inline"in fe&&n(16,R=fe.inline),"readonly"in fe&&n(17,O=fe.readonly),"$$scope"in fe&&n(25,u=fe.$$scope)},i.$$.update=()=>{i.$$.dirty[0]&128&&n(19,o=`error-${S}`),i.$$.dirty[0]&128&&n(18,r=`warn-${S}`)},n(20,s=!!B&&B.isFluid),[p,E,h,g,b,v,y,S,T,w,A,x,C,I,M,L,R,O,r,o,s,q,N,a,f,u,c,ee,K,Q,J,Y,ce,Z,ge,se,re,me]}class TextInput extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1v,create_fragment$1w,safe_not_equal,{size:2,value:0,placeholder:3,light:4,disabled:5,helperText:6,id:7,name:8,labelText:9,hideLabel:10,invalid:11,invalidText:12,warn:13,warnText:14,ref:1,required:15,inline:16,readonly:17},null,[-1,-1])}}const TextInput$1=TextInput,get_labelB_slot_changes=i=>({}),get_labelB_slot_context=i=>({}),get_labelA_slot_changes=i=>({}),get_labelA_slot_context=i=>({}),get_labelText_slot_changes=i=>({}),get_labelText_slot_context=i=>({});function fallback_block_2$1(i){let t;return{c(){t=text(i[5])},m(n,s){insert(n,t,s)},p(n,s){s&32&&set_data(t,n[5])},d(n){n&&detach(t)}}}function fallback_block_1$1(i){let t;return{c(){t=text(i[3])},m(n,s){insert(n,t,s)},p(n,s){s&8&&set_data(t,n[3])},d(n){n&&detach(t)}}}function fallback_block$1(i){let t;return{c(){t=text(i[4])},m(n,s){insert(n,t,s)},p(n,s){s&16&&set_data(t,n[4])},d(n){n&&detach(t)}}}function create_fragment$1v(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y;const S=i[12].labelText,T=create_slot(S,i,i[11],get_labelText_slot_context),w=T||fallback_block_2$1(i),A=i[12].labelA,x=create_slot(A,i,i[11],get_labelA_slot_context),C=x||fallback_block_1$1(i),I=i[12].labelB,M=create_slot(I,i,i[11],get_labelB_slot_context),E=M||fallback_block$1(i);let L=[i[9],{style:g=i[9].style+"; user-select: none"}],R={};for(let O=0;O{n(0,c=!c)},L=R=>{(R.key===" "||R.key==="Enter")&&(R.preventDefault(),n(0,c=!c))};return i.$$set=R=>{n(10,t=assign(assign({},t),exclude_internal_props(R))),n(9,o=compute_rest_props(t,s)),"size"in R&&n(1,a=R.size),"toggled"in R&&n(0,c=R.toggled),"disabled"in R&&n(2,u=R.disabled),"labelA"in R&&n(3,f=R.labelA),"labelB"in R&&n(4,h=R.labelB),"labelText"in R&&n(5,p=R.labelText),"hideLabel"in R&&n(6,g=R.hideLabel),"id"in R&&n(7,b=R.id),"name"in R&&n(8,v=R.name),"$$scope"in R&&n(11,l=R.$$scope)},i.$$.update=()=>{i.$$.dirty&1&&y("toggle",{toggled:c})},t=exclude_internal_props(t),[c,a,u,f,h,p,g,b,v,o,t,l,r,S,T,w,A,x,C,I,M,E,L]}class Toggle extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1u,create_fragment$1v,safe_not_equal,{size:1,toggled:0,disabled:2,labelA:3,labelB:4,labelText:5,hideLabel:6,id:7,name:8})}}const Toggle$1=Toggle,IS_DEV$1=window.location.host==="localhost:5173"||window.location.host==="127.0.0.1:5173";let root$1="/api";IS_DEV$1&&(root$1="http://localhost:8000/api");const userKey="SPHINX_TOKEN";async function send_cmd(i,t,n){const s=JSON.stringify({type:i,data:t});let o="";try{o=await(await fetch(`${root$1}/cmd?txt=${s}&tag=${n||"SWARM"}`,{headers:{"x-jwt":localStorage.getItem(userKey)}})).text();const l=JSON.parse(o);return l&&l.stack_error?(console.warn("=> cmd err:",l.stack_error),l.stack_error):l}catch(r){console.warn("=> cmd error:",o,r)}}async function swarmCmd(i,t){return await send_cmd("Swarm",{cmd:i,content:t})}async function get_config(){return await swarmCmd("GetConfig")}async function get_image_digest(i){return await swarmCmd("GetImageDigest",i)}async function get_logs(i){return await swarmCmd("GetContainerLogs",i)}async function list_containers(){return await swarmCmd("ListContainers")}async function stop_container(i){return await swarmCmd("StopContainer",i)}async function start_container(i){return await swarmCmd("StartContainer",i)}async function update_node(i){return await swarmCmd("UpdateNode",{id:i,version:"latest"})}async function get_container_stat(i){return await swarmCmd("GetStatistics",i)}async function add_boltwall_admin_pubkey(i,t){return await swarmCmd("AddBoltwallAdminPubkey",{pubkey:i,name:t})}async function get_super_admin(){return await swarmCmd("GetBoltwallSuperAdmin")}async function add_user$1(i,t,n){return await swarmCmd("AddBoltwallUser",{pubkey:i,role:t,name:n})}async function list_admins(){return await swarmCmd("ListAdmins")}async function delete_sub_admin(i){return await swarmCmd("DeleteSubAdmin",i)}async function list_all_paid_endpoint(){return await swarmCmd("ListPaidEndpoint")}async function update_paid_endpoint(i,t){return await swarmCmd("UpdatePaidEndpoint",{id:i,status:t})}async function update_swarm(){return await swarmCmd("UpdateSwarm")}async function update_graph_accessibility(i){return await swarmCmd("UpdateBoltwallAccessibility",i)}async function get_graph_accessibility(){return await swarmCmd("GetBoltwallAccessibility")}async function get_second_brain_about_details(){return await swarmCmd("GetSecondBrainAboutDetails")}async function get_feature_flag(){return await swarmCmd("GetFeatureFlags")}async function update_second_brain_about(i){return await swarmCmd("UpdateSecondBrainAbout",i)}async function update_feature_flags(i){return await swarmCmd("UpdateFeatureFlags",i)}async function get_api_token(){return await swarmCmd("GetApiToken")}async function login(i,t){return await(await fetch(`${root$1}/login`,{method:"POST",body:JSON.stringify({username:i,password:t})})).json()}async function update_password(i,t,n){return await(await fetch(`${root$1}/admin/password`,{method:"PUT",body:JSON.stringify({old_pass:t,password:i}),headers:{"x-jwt":n}})).json()}async function refresh_token(i){return await(await fetch(`${root$1}/refresh_jwt`,{headers:{"x-jwt":i}})).json()}async function update_admin_pubkey(i,t){return await(await fetch(`${root$1}/admin/pubkey`,{method:"PUT",body:JSON.stringify({pubkey:i}),headers:{"x-jwt":t}})).json()}async function get_challenge(){return await(await fetch(`${root$1}/challenge`)).json()}async function get_challenge_status(i){return await(await fetch(`${root$1}/poll/${i}`)).json()}async function get_signup_challenge_status(i,t,n){return await(await fetch(`${root$1}/poll_signup_challenge/${i}?username=${t}`,{headers:{"x-jwt":n}})).json()}async function get_signup_challenge(i){return await(await fetch(`${root$1}/signup_challenge`,{headers:{"x-jwt":i}})).json()}async function get_image_tags(i,t,n){return await swarmCmd("GetDockerImageTags",{page:t,page_size:n,org_image_name:i})}async function update_user({pubkey:i,name:t,role:n,id:s}){return await swarmCmd("UpdateUser",{pubkey:i,name:t,role:n,id:s})}async function relayCmd(i,t,n){return await send_cmd("Relay",{cmd:i,content:n},t)}async function list_users(i){return await relayCmd("ListUsers",i)}async function get_chats(i){return await relayCmd("GetChats",i)}async function add_user(i,t){return await relayCmd("AddUser",i,{...t&&{initial_sats:t}})}async function add_default_tribe(i,t){return await relayCmd("AddDefaultTribe",i,{id:t})}async function remove_default_tribe(i,t){return await relayCmd("RemoveDefaultTribe",i,{id:t})}async function get_balance$2(i){return await relayCmd("GetBalance",i)}async function btcCmd(i,t,n){return await send_cmd("Bitcoind",{cmd:i,content:n},t)}async function get_info$2(i){return await btcCmd("GetInfo",i)}async function test_mine(i,t,n){return await btcCmd("TestMine",i,{blocks:t,...n&&{address:n}})}async function get_balance$1(i){return await btcCmd("GetBalance",i)}const IS_DEV=window.location.host==="localhost:8080",formatUrl=i=>i.includes("http://")?i:IS_DEV?`https://${i}`:`https://${i}`;async function get_tribes(i,t="",n="",s=1,o=75){try{let r;return n?r=await fetch(`${formatUrl(i)}/tribes?search=${n}`):t?r=await fetch(`${formatUrl(i)}/tribes/${t}`):r=await fetch(`${formatUrl(i)}/tribes?page=${s}&limit=${o}`),await r.json()}catch{console.warn("couldn't fetch tribes")}}async function get_people(i){return await(await fetch(`${formatUrl(i)}/people`)).json()}async function get_tribes_total(i){return await(await fetch(`${formatUrl(i)}/tribes/total`)).json()}async function lndCmd(i,t,n){return await send_cmd("Lnd",{cmd:i,content:n},t)}async function get_info$1(i){return await lndCmd("GetInfo",i)}async function list_channels(i){return await lndCmd("ListChannels",i)}async function add_peer$1(i,t,n){return await lndCmd("AddPeer",i,{pubkey:t,host:n})}async function list_peers$1(i){return await lndCmd("ListPeers",i)}async function get_balance(i){return await lndCmd("GetBalance",i)}async function list_pending_channels(i){return await lndCmd("ListPendingChannels",i)}async function create_channel$1(i,t,n,s){return await lndCmd("AddChannel",i,{pubkey:t,amount:n,satsperbyte:s})}async function new_address$1(i){return await lndCmd("NewAddress",i)}async function add_invoice$1(i,t){return await lndCmd("AddInvoice",i,{amt_paid_sat:t})}async function pay_invoice$1(i,t){return await lndCmd("PayInvoice",i,{payment_request:t})}async function keysend$1(i,t,n,s){const o={dest:t,amt:n};return s&&(o.tlvs=s),await lndCmd("PayKeysend",i,o)}async function list_invoices$1(i){return await lndCmd("ListInvoices",i)}async function list_payments(i){return await lndCmd("ListPayments",i)}async function clnCmd(i,t,n){return await send_cmd("Cln",{cmd:i,content:n},t)}async function get_info(i){return await clnCmd("GetInfo",i)}async function list_peers(i){return await clnCmd("ListPeers",i)}async function list_funds(i){return await clnCmd("ListFunds",i)}async function new_address(i){return await clnCmd("NewAddress",i)}async function add_invoice(i,t){return await clnCmd("AddInvoice",i,{amt_paid_sat:t})}async function pay_invoice(i,t){return await clnCmd("PayInvoice",i,{payment_request:t})}async function keysend(i,t,n,s,o,r){const l={dest:t,amt:n};return s&&(l.route_hint=s),o&&(l.maxfeepercent=o),r&&(l.exemptfee=r),console.log("=> keysend body:",l),await clnCmd("PayKeysend",i,l)}async function close_channel(i,t,n){return await clnCmd("CloseChannel",i,{id:t,destination:n})}async function list_invoices(i,t){return await clnCmd("ListInvoices",i,t&&{payment_hash:t})}async function list_pays(i,t){return await clnCmd("ListPays",i,t&&{payment_hash:t})}async function create_channel(i,t,n,s){return await clnCmd("AddChannel",i,{pubkey:t,amount:n,satsperbyte:s})}async function add_peer(i,t,n){return await clnCmd("AddPeer",i,{pubkey:t,host:n})}function formatSatsNumbers(i){return i?new Intl.NumberFormat().format(i).replaceAll(","," "):"0"}function formatMillisatsToSats(i){if(!i)return 0;const t=typeof i=="number"?Math.floor(i/1e3):0;formatSatsNumbers(t)}function convertMillisatsToSats(i){return i&&typeof i=="number"?Math.floor(i/1e3):0}function convertSatsToMilliSats(i){return Number(i)*1e3}function convertBtcToSats(i){return Number(i)*1e9}function bufferToHexString(i){return Array.from(i,function(t){return("0"+(t&255).toString(16)).slice(-2)}).join("")}function addZeroToSingleDigit(i){return i<=9?`0${i}`:`${i}`}function parseDate(i){let t=new Date(i*1e3);const n=t.getFullYear(),s=t.getMonth(),o=t.getDate();let r=t.getHours();r===0?r=0:(r=r%12,r=r||12);const l=t.getMinutes(),a=r>=12?"PM":"AM";return`${n}-${addZeroToSingleDigit(s+1)}-${addZeroToSingleDigit(o)} ${addZeroToSingleDigit(r)}:${addZeroToSingleDigit(l)} ${a}`}function shortTransactionId(i){return`${i.substring(0,4)}...${i.substring(i.length-4,i.length)}`}function shortPubkey(i){return`${i.substring(0,15)}...`}function contructQrString(i){const t=new Date().getTime();let n=root$1;return root$1==="/api"?n=`${window.location.host}${root$1}`:root$1.includes("https://")?n=n.substring(8):root$1.includes("http://")&&(n=n.substring(7)),`sphinx.chat://?action=auth&host=${n}&challenge=${i}&ts=${t}`}const input_svelte_svelte_type_style_lang="";function create_fragment$1u(i){let t,n,s,o,r,l,a;return{c(){t=element("div"),n=element("label"),s=text(i[2]),o=space(),r=element("input"),attr(n,"for",i[2]),attr(n,"class","label svelte-r7w6s1"),attr(r,"id",i[2]),attr(r,"class","input svelte-r7w6s1"),attr(r,"placeholder",i[1]),attr(t,"class","container svelte-r7w6s1")},m(c,u){insert(c,t,u),append(t,n),append(n,s),append(t,o),append(t,r),set_input_value(r,i[0]),l||(a=[listen(r,"input",i[5]),listen(r,"input",i[3])],l=!0)},p(c,[u]){u&4&&set_data(s,c[2]),u&4&&attr(n,"for",c[2]),u&4&&attr(r,"id",c[2]),u&2&&attr(r,"placeholder",c[1]),u&1&&r.value!==c[0]&&set_input_value(r,c[0])},i:noop$2,o:noop$2,d(c){c&&detach(t),l=!1,run_all(a)}}}function instance$1t(i,t,n){let{value:s=""}=t,{placeholder:o="Enter text"}=t,{onInput:r}=t,{label:l}=t;function a(u){const f=u.target.value;r(f)}function c(){s=this.value,n(0,s)}return i.$$set=u=>{"value"in u&&n(0,s=u.value),"placeholder"in u&&n(1,o=u.placeholder),"onInput"in u&&n(4,r=u.onInput),"label"in u&&n(2,l=u.label)},[s,o,l,a,r,c]}class Input extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1t,create_fragment$1u,safe_not_equal,{value:0,placeholder:1,onInput:4,label:2})}}const password_svelte_svelte_type_style_lang="";function create_else_block$u(i){let t,n,s,o,r,l;return{c(){t=element("input"),n=space(),s=element("img"),attr(t,"type","text"),attr(t,"id",i[2]),attr(t,"class","input svelte-8cxix1"),attr(t,"placeholder",i[1]),t.readOnly=i[3],src_url_equal(s.src,o="swarm/show.svg")||attr(s,"src",o),attr(s,"alt","visibility"),attr(s,"class","toggle svelte-8cxix1")},m(a,c){insert(a,t,c),set_input_value(t,i[0]),insert(a,n,c),insert(a,s,c),r||(l=[listen(t,"input",i[9]),listen(t,"input",i[5]),listen(s,"click",i[6])],r=!0)},p(a,c){c&4&&attr(t,"id",a[2]),c&2&&attr(t,"placeholder",a[1]),c&8&&(t.readOnly=a[3]),c&1&&t.value!==a[0]&&set_input_value(t,a[0])},d(a){a&&detach(t),a&&detach(n),a&&detach(s),r=!1,run_all(l)}}}function create_if_block$Y(i){let t,n,s,o,r,l;return{c(){t=element("input"),n=space(),s=element("img"),attr(t,"type","password"),attr(t,"id",i[2]),attr(t,"class","input svelte-8cxix1"),attr(t,"placeholder",i[1]),t.readOnly=i[3],src_url_equal(s.src,o="swarm/hide.svg")||attr(s,"src",o),attr(s,"alt","visibility"),attr(s,"class","toggle svelte-8cxix1")},m(a,c){insert(a,t,c),set_input_value(t,i[0]),insert(a,n,c),insert(a,s,c),r||(l=[listen(t,"input",i[8]),listen(t,"input",i[5]),listen(s,"click",i[6])],r=!0)},p(a,c){c&4&&attr(t,"id",a[2]),c&2&&attr(t,"placeholder",a[1]),c&8&&(t.readOnly=a[3]),c&1&&t.value!==a[0]&&set_input_value(t,a[0])},d(a){a&&detach(t),a&&detach(n),a&&detach(s),r=!1,run_all(l)}}}function create_fragment$1t(i){let t,n,s,o,r;function l(u,f){return u[4]?create_if_block$Y:create_else_block$u}let a=l(i),c=a(i);return{c(){t=element("div"),n=element("label"),s=text(i[2]),o=space(),r=element("div"),c.c(),attr(n,"for",i[2]),attr(n,"class","label svelte-8cxix1"),attr(r,"class","input_container svelte-8cxix1"),attr(t,"class","container svelte-8cxix1")},m(u,f){insert(u,t,f),append(t,n),append(n,s),append(t,o),append(t,r),c.m(r,null)},p(u,[f]){f&4&&set_data(s,u[2]),f&4&&attr(n,"for",u[2]),a===(a=l(u))&&c?c.p(u,f):(c.d(1),c=a(u),c&&(c.c(),c.m(r,null)))},i:noop$2,o:noop$2,d(u){u&&detach(t),c.d()}}}function instance$1s(i,t,n){let s,{value:o=""}=t,{placeholder:r="Enter text"}=t,{onInput:l}=t,{label:a}=t,{readonly:c=!1}=t;function u(g){const b=g.target.value;l(b)}function f(){n(4,s=!s)}function h(){o=this.value,n(0,o)}function p(){o=this.value,n(0,o)}return i.$$set=g=>{"value"in g&&n(0,o=g.value),"placeholder"in g&&n(1,r=g.placeholder),"onInput"in g&&n(7,l=g.onInput),"label"in g&&n(2,a=g.label),"readonly"in g&&n(3,c=g.readonly)},n(4,s=!0),[o,r,a,c,s,u,f,l,h,p]}let Password$1=class extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1s,create_fragment$1t,safe_not_equal,{value:0,placeholder:1,onInput:7,label:2,readonly:3})}};const Login_svelte_svelte_type_style_lang="";function create_if_block_2$l(i){let t,n,s;return n=new ToastNotification$1({props:{fullWidth:!0,title:"Error",subtitle:i[7]}}),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","toast_container svelte-17iyek0")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p(o,r){const l={};r&128&&(l.subtitle=o[7]),n.$set(l)},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_else_block_1$4(i){let t;return{c(){t=text("Login")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_1$s(i){let t;return{c(){t=element("div"),attr(t,"class","loading-spinner svelte-17iyek0")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_else_block$t(i){let t,n,s,o;return{c(){t=element("a"),n=element("img"),o=text("Login With Sphinx"),src_url_equal(n.src,s="swarm/sphinx_logo.svg")||attr(n,"src",s),attr(n,"alt","sphinx"),attr(n,"class","sphinx_logo svelte-17iyek0"),attr(t,"href",i[5]),attr(t,"class","sphinx_link svelte-17iyek0")},m(r,l){insert(r,t,l),append(t,n),append(t,o)},p(r,l){l&32&&attr(t,"href",r[5])},d(r){r&&detach(t)}}}function create_if_block$X(i){let t;return{c(){t=element("div"),t.innerHTML='
',attr(t,"class","sphinx_loading-spinner_container svelte-17iyek0")},m(n,s){insert(n,t,s)},p:noop$2,d(n){n&&detach(t)}}}function create_fragment$1s(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M,E,L,R,O,B=i[4]&&create_if_block_2$l(i);function z(Z){i[14](Z)}let F={label:"Username",placeholder:"Enter Username ...",onInput:i[10]};i[1]!==void 0&&(F.value=i[1]),h=new Input({props:F}),binding_callbacks.push(()=>bind(h,"value",z,i[1]));function q(Z){i[15](Z)}let N={label:"Password",placeholder:"Enter Password ...",onInput:i[11]};i[0]!==void 0&&(N.value=i[0]),b=new Password$1({props:N}),binding_callbacks.push(()=>bind(b,"value",q,i[0]));function ee(Z,ge){return Z[2]===!0?create_if_block_1$s:create_else_block_1$4}let K=ee(i),Q=K(i);function J(Z,ge){return Z[3]?create_if_block$X:create_else_block$t}let Y=J(i),ce=Y(i);return{c(){t=element("main"),n=element("div"),n.innerHTML=`
logo + bx--text-input__invalid-icon--warning`}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_6$2(i){let t,n;return t=new EditOff$1({props:{class:"bx--text-input__readonly-icon"}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_5$4(i){let t;return{c(){t=element("hr"),toggle_class(t,"bx--text-input__divider",!0)},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_4$5(i){let t,n;return{c(){t=element("div"),n=text(i[12]),attr(t,"id",i[19]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&4096&&set_data(n,s[12]),o[0]&524288&&attr(t,"id",s[19])},d(s){s&&detach(t)}}}function create_if_block_3$f(i){let t,n;return{c(){t=element("div"),n=text(i[14]),attr(t,"id",i[18]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&16384&&set_data(n,s[14]),o[0]&262144&&attr(t,"id",s[18])},d(s){s&&detach(t)}}}function create_if_block_2$m(i){let t,n;return{c(){t=element("div"),n=text(i[6]),toggle_class(t,"bx--form__helper-text",!0),toggle_class(t,"bx--form__helper-text--disabled",i[5]),toggle_class(t,"bx--form__helper-text--inline",i[16])},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&64&&set_data(n,s[6]),o[0]&32&&toggle_class(t,"bx--form__helper-text--disabled",s[5]),o[0]&65536&&toggle_class(t,"bx--form__helper-text--inline",s[16])},d(s){s&&detach(t)}}}function create_if_block_1$t(i){let t,n;return{c(){t=element("div"),n=text(i[12]),attr(t,"id",i[19]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&4096&&set_data(n,s[12]),o[0]&524288&&attr(t,"id",s[19])},d(s){s&&detach(t)}}}function create_if_block$Z(i){let t,n;return{c(){t=element("div"),n=text(i[14]),attr(t,"id",i[18]),toggle_class(t,"bx--form-requirement",!0)},m(s,o){insert(s,t,o),append(t,n)},p(s,o){o[0]&16384&&set_data(n,s[14]),o[0]&262144&&attr(t,"id",s[18])},d(s){s&&detach(t)}}}function create_fragment$1w(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M,E=i[16]&&create_if_block_10$1(i),L=!i[16]&&(i[9]||i[24].labelText)&&create_if_block_9$1(i),R=i[11]&&create_if_block_8$2(),O=!i[11]&&i[13]&&create_if_block_7$2(),B=i[17]&&create_if_block_6$2(),z=[{"data-invalid":f=i[11]||void 0},{"aria-invalid":h=i[11]||void 0},{"data-warn":p=i[13]||void 0},{"aria-describedby":g=i[11]?i[19]:i[13]?i[18]:void 0},{disabled:i[5]},{id:i[7]},{name:i[8]},{placeholder:i[3]},{required:i[15]},{readOnly:i[17]},i[23]],F={};for(let Y=0;Y{E=null}),check_outros()),!Y[16]&&(Y[9]||Y[24].labelText)?L?(L.p(Y,ce),ce[0]&16843264&&transition_in(L,1)):(L=create_if_block_9$1(Y),L.c(),transition_in(L,1),L.m(t,s)):L&&(group_outros(),transition_out(L,1,1,()=>{L=null}),check_outros()),Y[11]?R?ce[0]&2048&&transition_in(R,1):(R=create_if_block_8$2(),R.c(),transition_in(R,1),R.m(r,l)):R&&(group_outros(),transition_out(R,1,1,()=>{R=null}),check_outros()),!Y[11]&&Y[13]?O?ce[0]&10240&&transition_in(O,1):(O=create_if_block_7$2(),O.c(),transition_in(O,1),O.m(r,a)):O&&(group_outros(),transition_out(O,1,1,()=>{O=null}),check_outros()),Y[17]?B?ce[0]&131072&&transition_in(B,1):(B=create_if_block_6$2(),B.c(),transition_in(B,1),B.m(r,c)):B&&(group_outros(),transition_out(B,1,1,()=>{B=null}),check_outros()),set_attributes(u,F=get_spread_update(z,[(!C||ce[0]&2048&&f!==(f=Y[11]||void 0))&&{"data-invalid":f},(!C||ce[0]&2048&&h!==(h=Y[11]||void 0))&&{"aria-invalid":h},(!C||ce[0]&8192&&p!==(p=Y[13]||void 0))&&{"data-warn":p},(!C||ce[0]&796672&&g!==(g=Y[11]?Y[19]:Y[13]?Y[18]:void 0))&&{"aria-describedby":g},(!C||ce[0]&32)&&{disabled:Y[5]},(!C||ce[0]&128)&&{id:Y[7]},(!C||ce[0]&256)&&{name:Y[8]},(!C||ce[0]&8)&&{placeholder:Y[3]},(!C||ce[0]&32768)&&{required:Y[15]},(!C||ce[0]&131072)&&{readOnly:Y[17]},ce[0]&8388608&&Y[23]])),ce[0]&1&&u.value!==Y[0]&&set_input_value(u,Y[0]),toggle_class(u,"bx--text-input",!0),toggle_class(u,"bx--text-input--light",Y[4]),toggle_class(u,"bx--text-input--invalid",Y[11]),toggle_class(u,"bx--text-input--warn",Y[13]),toggle_class(u,"bx--text-input--sm",Y[2]==="sm"),toggle_class(u,"bx--text-input--xl",Y[2]==="xl"),Y[20]?q||(q=create_if_block_5$4(),q.c(),q.m(r,v)):q&&(q.d(1),q=null),Y[20]&&!Y[16]&&Y[11]?N?N.p(Y,ce):(N=create_if_block_4$5(Y),N.c(),N.m(r,y)):N&&(N.d(1),N=null),Y[20]&&!Y[16]&&Y[13]?ee?ee.p(Y,ce):(ee=create_if_block_3$f(Y),ee.c(),ee.m(r,null)):ee&&(ee.d(1),ee=null),(!C||ce[0]&2048&&S!==(S=Y[11]||void 0))&&attr(r,"data-invalid",S),(!C||ce[0]&8192&&T!==(T=Y[13]||void 0))&&attr(r,"data-warn",T),(!C||ce[0]&10240)&&toggle_class(r,"bx--text-input__field-wrapper--warning",!Y[11]&&Y[13]),!Y[11]&&!Y[13]&&!Y[20]&&!Y[16]&&Y[6]?K?K.p(Y,ce):(K=create_if_block_2$m(Y),K.c(),K.m(o,A)):K&&(K.d(1),K=null),!Y[20]&&Y[11]?Q?Q.p(Y,ce):(Q=create_if_block_1$t(Y),Q.c(),Q.m(o,x)):Q&&(Q.d(1),Q=null),!Y[20]&&!Y[11]&&Y[13]?J?J.p(Y,ce):(J=create_if_block$Z(Y),J.c(),J.m(o,null)):J&&(J.d(1),J=null),(!C||ce[0]&65536)&&toggle_class(o,"bx--text-input__field-outer-wrapper--inline",Y[16]),(!C||ce[0]&65536)&&toggle_class(t,"bx--text-input-wrapper--inline",Y[16]),(!C||ce[0]&16)&&toggle_class(t,"bx--text-input-wrapper--light",Y[4]),(!C||ce[0]&131072)&&toggle_class(t,"bx--text-input-wrapper--readonly",Y[17])},i(Y){C||(transition_in(E),transition_in(L),transition_in(R),transition_in(O),transition_in(B),C=!0)},o(Y){transition_out(E),transition_out(L),transition_out(R),transition_out(O),transition_out(B),C=!1},d(Y){Y&&detach(t),E&&E.d(),L&&L.d(),R&&R.d(),O&&O.d(),B&&B.d(),i[36](null),q&&q.d(),N&&N.d(),ee&&ee.d(),K&&K.d(),Q&&Q.d(),J&&J.d(),I=!1,run_all(M)}}}function instance$1v(i,t,n){let s,o,r;const l=["size","value","placeholder","light","disabled","helperText","id","name","labelText","hideLabel","invalid","invalidText","warn","warnText","ref","required","inline","readonly"];let a=compute_rest_props(t,l),{$$slots:c={},$$scope:u}=t;const f=compute_slots(c);let{size:h=void 0}=t,{value:p=""}=t,{placeholder:g=""}=t,{light:b=!1}=t,{disabled:v=!1}=t,{helperText:y=""}=t,{id:S="ccs-"+Math.random().toString(36)}=t,{name:T=void 0}=t,{labelText:w=""}=t,{hideLabel:A=!1}=t,{invalid:x=!1}=t,{invalidText:C=""}=t,{warn:I=!1}=t,{warnText:M=""}=t,{ref:E=null}=t,{required:L=!1}=t,{inline:R=!1}=t,{readonly:O=!1}=t;const B=getContext("Form"),z=createEventDispatcher();function F(fe){return a.type!=="number"?fe:fe!=""?Number(fe):null}const q=fe=>{n(0,p=F(fe.target.value)),z("input",p)},N=fe=>{z("change",F(fe.target.value))};function ee(fe){bubble.call(this,i,fe)}function K(fe){bubble.call(this,i,fe)}function Q(fe){bubble.call(this,i,fe)}function J(fe){bubble.call(this,i,fe)}function Y(fe){bubble.call(this,i,fe)}function ce(fe){bubble.call(this,i,fe)}function Z(fe){bubble.call(this,i,fe)}function ge(fe){bubble.call(this,i,fe)}function se(fe){bubble.call(this,i,fe)}function re(fe){binding_callbacks[fe?"unshift":"push"](()=>{E=fe,n(1,E)})}function me(){p=this.value,n(0,p)}return i.$$set=fe=>{t=assign(assign({},t),exclude_internal_props(fe)),n(23,a=compute_rest_props(t,l)),"size"in fe&&n(2,h=fe.size),"value"in fe&&n(0,p=fe.value),"placeholder"in fe&&n(3,g=fe.placeholder),"light"in fe&&n(4,b=fe.light),"disabled"in fe&&n(5,v=fe.disabled),"helperText"in fe&&n(6,y=fe.helperText),"id"in fe&&n(7,S=fe.id),"name"in fe&&n(8,T=fe.name),"labelText"in fe&&n(9,w=fe.labelText),"hideLabel"in fe&&n(10,A=fe.hideLabel),"invalid"in fe&&n(11,x=fe.invalid),"invalidText"in fe&&n(12,C=fe.invalidText),"warn"in fe&&n(13,I=fe.warn),"warnText"in fe&&n(14,M=fe.warnText),"ref"in fe&&n(1,E=fe.ref),"required"in fe&&n(15,L=fe.required),"inline"in fe&&n(16,R=fe.inline),"readonly"in fe&&n(17,O=fe.readonly),"$$scope"in fe&&n(25,u=fe.$$scope)},i.$$.update=()=>{i.$$.dirty[0]&128&&n(19,o=`error-${S}`),i.$$.dirty[0]&128&&n(18,r=`warn-${S}`)},n(20,s=!!B&&B.isFluid),[p,E,h,g,b,v,y,S,T,w,A,x,C,I,M,L,R,O,r,o,s,q,N,a,f,u,c,ee,K,Q,J,Y,ce,Z,ge,se,re,me]}class TextInput extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1v,create_fragment$1w,safe_not_equal,{size:2,value:0,placeholder:3,light:4,disabled:5,helperText:6,id:7,name:8,labelText:9,hideLabel:10,invalid:11,invalidText:12,warn:13,warnText:14,ref:1,required:15,inline:16,readonly:17},null,[-1,-1])}}const TextInput$1=TextInput,get_labelB_slot_changes=i=>({}),get_labelB_slot_context=i=>({}),get_labelA_slot_changes=i=>({}),get_labelA_slot_context=i=>({}),get_labelText_slot_changes=i=>({}),get_labelText_slot_context=i=>({});function fallback_block_2$1(i){let t;return{c(){t=text(i[5])},m(n,s){insert(n,t,s)},p(n,s){s&32&&set_data(t,n[5])},d(n){n&&detach(t)}}}function fallback_block_1$1(i){let t;return{c(){t=text(i[3])},m(n,s){insert(n,t,s)},p(n,s){s&8&&set_data(t,n[3])},d(n){n&&detach(t)}}}function fallback_block$1(i){let t;return{c(){t=text(i[4])},m(n,s){insert(n,t,s)},p(n,s){s&16&&set_data(t,n[4])},d(n){n&&detach(t)}}}function create_fragment$1v(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y;const S=i[12].labelText,T=create_slot(S,i,i[11],get_labelText_slot_context),w=T||fallback_block_2$1(i),A=i[12].labelA,x=create_slot(A,i,i[11],get_labelA_slot_context),C=x||fallback_block_1$1(i),I=i[12].labelB,M=create_slot(I,i,i[11],get_labelB_slot_context),E=M||fallback_block$1(i);let L=[i[9],{style:g=i[9].style+"; user-select: none"}],R={};for(let O=0;O{n(0,c=!c)},L=R=>{(R.key===" "||R.key==="Enter")&&(R.preventDefault(),n(0,c=!c))};return i.$$set=R=>{n(10,t=assign(assign({},t),exclude_internal_props(R))),n(9,o=compute_rest_props(t,s)),"size"in R&&n(1,a=R.size),"toggled"in R&&n(0,c=R.toggled),"disabled"in R&&n(2,u=R.disabled),"labelA"in R&&n(3,f=R.labelA),"labelB"in R&&n(4,h=R.labelB),"labelText"in R&&n(5,p=R.labelText),"hideLabel"in R&&n(6,g=R.hideLabel),"id"in R&&n(7,b=R.id),"name"in R&&n(8,v=R.name),"$$scope"in R&&n(11,l=R.$$scope)},i.$$.update=()=>{i.$$.dirty&1&&y("toggle",{toggled:c})},t=exclude_internal_props(t),[c,a,u,f,h,p,g,b,v,o,t,l,r,S,T,w,A,x,C,I,M,E,L]}class Toggle extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1u,create_fragment$1v,safe_not_equal,{size:1,toggled:0,disabled:2,labelA:3,labelB:4,labelText:5,hideLabel:6,id:7,name:8})}}const Toggle$1=Toggle,IS_DEV$1=window.location.host==="localhost:5173"||window.location.host==="127.0.0.1:5173";let root$1="/api";IS_DEV$1&&(root$1="http://localhost:8000/api");const userKey="SPHINX_TOKEN";async function send_cmd(i,t,n){const s=JSON.stringify({type:i,data:t});let o="";try{o=await(await fetch(`${root$1}/cmd?txt=${s}&tag=${n||"SWARM"}`,{headers:{"x-jwt":localStorage.getItem(userKey)}})).text();const l=JSON.parse(o);return l&&l.stack_error?(console.warn("=> cmd err:",l.stack_error),l.stack_error):l}catch(r){console.warn("=> cmd error:",o,r)}}async function swarmCmd(i,t){return await send_cmd("Swarm",{cmd:i,content:t})}async function get_config(){return await swarmCmd("GetConfig")}async function get_image_digest(i){return await swarmCmd("GetImageDigest",i)}async function get_logs(i){return await swarmCmd("GetContainerLogs",i)}async function list_containers(){return await swarmCmd("ListContainers")}async function stop_container(i){return await swarmCmd("StopContainer",i)}async function start_container(i){return await swarmCmd("StartContainer",i)}async function update_node(i){return await swarmCmd("UpdateNode",{id:i,version:"latest"})}async function get_container_stat(i){return await swarmCmd("GetStatistics",i)}async function add_boltwall_admin_pubkey(i,t){return await swarmCmd("AddBoltwallAdminPubkey",{pubkey:i,name:t})}async function get_super_admin(){return await swarmCmd("GetBoltwallSuperAdmin")}async function add_user$1(i,t,n){return await swarmCmd("AddBoltwallUser",{pubkey:i,role:t,name:n})}async function list_admins(){return await swarmCmd("ListAdmins")}async function delete_sub_admin(i){return await swarmCmd("DeleteSubAdmin",i)}async function list_all_paid_endpoint(){return await swarmCmd("ListPaidEndpoint")}async function update_paid_endpoint(i,t){return await swarmCmd("UpdatePaidEndpoint",{id:i,status:t})}async function update_swarm(){return await swarmCmd("UpdateSwarm")}async function update_graph_accessibility(i){return await swarmCmd("UpdateBoltwallAccessibility",i)}async function get_graph_accessibility(){return await swarmCmd("GetBoltwallAccessibility")}async function get_second_brain_about_details(){return await swarmCmd("GetSecondBrainAboutDetails")}async function get_feature_flag(){return await swarmCmd("GetFeatureFlags")}async function update_second_brain_about(i){return await swarmCmd("UpdateSecondBrainAbout",i)}async function update_feature_flags(i){return await swarmCmd("UpdateFeatureFlags",i)}async function get_api_token(){return await swarmCmd("GetApiToken")}async function login(i,t){return await(await fetch(`${root$1}/login`,{method:"POST",body:JSON.stringify({username:i,password:t})})).json()}async function update_password(i,t,n){return await(await fetch(`${root$1}/admin/password`,{method:"PUT",body:JSON.stringify({old_pass:t,password:i}),headers:{"x-jwt":n}})).json()}async function refresh_token(i){return await(await fetch(`${root$1}/refresh_jwt`,{headers:{"x-jwt":i}})).json()}async function update_admin_pubkey(i,t){return await(await fetch(`${root$1}/admin/pubkey`,{method:"PUT",body:JSON.stringify({pubkey:i}),headers:{"x-jwt":t}})).json()}async function get_challenge(){return await(await fetch(`${root$1}/challenge`)).json()}async function get_challenge_status(i){return await(await fetch(`${root$1}/poll/${i}`)).json()}async function get_signup_challenge_status(i,t,n){return await(await fetch(`${root$1}/poll_signup_challenge/${i}?username=${t}`,{headers:{"x-jwt":n}})).json()}async function get_signup_challenge(i){return await(await fetch(`${root$1}/signup_challenge`,{headers:{"x-jwt":i}})).json()}async function get_image_tags(i,t,n){return await swarmCmd("GetDockerImageTags",{page:t,page_size:n,org_image_name:i})}async function update_user({pubkey:i,name:t,role:n,id:s}){return await swarmCmd("UpdateUser",{pubkey:i,name:t,role:n,id:s})}async function relayCmd(i,t,n){return await send_cmd("Relay",{cmd:i,content:n},t)}async function list_users(i){return await relayCmd("ListUsers",i)}async function get_chats(i){return await relayCmd("GetChats",i)}async function add_user(i,t){return await relayCmd("AddUser",i,{...t&&{initial_sats:t}})}async function add_default_tribe(i,t){return await relayCmd("AddDefaultTribe",i,{id:t})}async function remove_default_tribe(i,t){return await relayCmd("RemoveDefaultTribe",i,{id:t})}async function get_balance$2(i){return await relayCmd("GetBalance",i)}async function btcCmd(i,t,n){return await send_cmd("Bitcoind",{cmd:i,content:n},t)}async function get_info$2(i){return await btcCmd("GetInfo",i)}async function test_mine(i,t,n){return await btcCmd("TestMine",i,{blocks:t,...n&&{address:n}})}async function get_balance$1(i){return await btcCmd("GetBalance",i)}const IS_DEV=window.location.host==="localhost:8080",formatUrl=i=>i.includes("http://")?i:IS_DEV?`https://${i}`:`https://${i}`;async function get_tribes(i,t="",n="",s=1,o=75){try{let r;return n?r=await fetch(`${formatUrl(i)}/tribes?search=${n}`):t?r=await fetch(`${formatUrl(i)}/tribes/${t}`):r=await fetch(`${formatUrl(i)}/tribes?page=${s}&limit=${o}`),await r.json()}catch{console.warn("couldn't fetch tribes")}}async function get_people(i){return await(await fetch(`${formatUrl(i)}/people`)).json()}async function get_tribes_total(i){return await(await fetch(`${formatUrl(i)}/tribes/total`)).json()}async function lndCmd(i,t,n){return await send_cmd("Lnd",{cmd:i,content:n},t)}async function get_info$1(i){return await lndCmd("GetInfo",i)}async function list_channels(i){return await lndCmd("ListChannels",i)}async function add_peer$1(i,t,n){return await lndCmd("AddPeer",i,{pubkey:t,host:n})}async function list_peers$1(i){return await lndCmd("ListPeers",i)}async function get_balance(i){return await lndCmd("GetBalance",i)}async function list_pending_channels(i){return await lndCmd("ListPendingChannels",i)}async function create_channel$1(i,t,n,s){return await lndCmd("AddChannel",i,{pubkey:t,amount:n,satsperbyte:s})}async function new_address$1(i){return await lndCmd("NewAddress",i)}async function add_invoice$1(i,t){return await lndCmd("AddInvoice",i,{amt_paid_sat:t})}async function pay_invoice$1(i,t){return await lndCmd("PayInvoice",i,{payment_request:t})}async function keysend$1(i,t,n,s){const o={dest:t,amt:n};return s&&(o.tlvs=s),await lndCmd("PayKeysend",i,o)}async function list_invoices$1(i){return await lndCmd("ListInvoices",i)}async function list_payments(i){return await lndCmd("ListPayments",i)}async function clnCmd(i,t,n){return await send_cmd("Cln",{cmd:i,content:n},t)}async function get_info(i){return await clnCmd("GetInfo",i)}async function list_peers(i){return await clnCmd("ListPeers",i)}async function list_funds(i){return await clnCmd("ListFunds",i)}async function new_address(i){return await clnCmd("NewAddress",i)}async function add_invoice(i,t){return await clnCmd("AddInvoice",i,{amt_paid_sat:t})}async function pay_invoice(i,t){return await clnCmd("PayInvoice",i,{payment_request:t})}async function keysend(i,t,n,s,o,r){const l={dest:t,amt:n};return s&&(l.route_hint=s),o&&(l.maxfeepercent=o),r&&(l.exemptfee=r),console.log("=> keysend body:",l),await clnCmd("PayKeysend",i,l)}async function close_channel(i,t,n){return await clnCmd("CloseChannel",i,{id:t,destination:n})}async function list_invoices(i,t){return await clnCmd("ListInvoices",i,t&&{payment_hash:t})}async function list_pays(i,t){return await clnCmd("ListPays",i,t&&{payment_hash:t})}async function create_channel(i,t,n,s){return await clnCmd("AddChannel",i,{pubkey:t,amount:n,satsperbyte:s})}async function add_peer(i,t,n){return await clnCmd("AddPeer",i,{pubkey:t,host:n})}function formatSatsNumbers(i){return i?new Intl.NumberFormat().format(i).replaceAll(","," "):"0"}function formatMillisatsToSats(i){if(!i)return 0;const t=typeof i=="number"?Math.floor(i/1e3):0;formatSatsNumbers(t)}function convertMillisatsToSats(i){return i&&typeof i=="number"?Math.floor(i/1e3):0}function convertSatsToMilliSats(i){return Number(i)*1e3}function convertBtcToSats(i){return Number(i)*1e9}function bufferToHexString(i){return Array.from(i,function(t){return("0"+(t&255).toString(16)).slice(-2)}).join("")}function addZeroToSingleDigit(i){return i<=9?`0${i}`:`${i}`}function parseDate(i){let t=new Date(i*1e3);const n=t.getFullYear(),s=t.getMonth(),o=t.getDate();let r=t.getHours();r===0?r=0:(r=r%12,r=r||12);const l=t.getMinutes(),a=r>=12?"PM":"AM";return`${n}-${addZeroToSingleDigit(s+1)}-${addZeroToSingleDigit(o)} ${addZeroToSingleDigit(r)}:${addZeroToSingleDigit(l)} ${a}`}function shortTransactionId(i){return`${i.substring(0,4)}...${i.substring(i.length-4,i.length)}`}function shortPubkey(i){return`${i.substring(0,15)}...`}function contructQrString(i){const t=new Date().getTime();let n=root$1;return root$1==="/api"?n=`${window.location.host}${root$1}`:root$1.includes("https://")?n=n.substring(8):root$1.includes("http://")&&(n=n.substring(7)),`sphinx.chat://?action=auth&host=${n}&challenge=${i}&ts=${t}`}const input_svelte_svelte_type_style_lang="";function create_fragment$1u(i){let t,n,s,o,r,l,a;return{c(){t=element("div"),n=element("label"),s=text(i[2]),o=space(),r=element("input"),attr(n,"for",i[2]),attr(n,"class","label svelte-r7w6s1"),attr(r,"id",i[2]),attr(r,"class","input svelte-r7w6s1"),attr(r,"placeholder",i[1]),attr(t,"class","container svelte-r7w6s1")},m(c,u){insert(c,t,u),append(t,n),append(n,s),append(t,o),append(t,r),set_input_value(r,i[0]),l||(a=[listen(r,"input",i[6]),listen(r,"input",i[3])],l=!0)},p(c,[u]){u&4&&set_data(s,c[2]),u&4&&attr(n,"for",c[2]),u&4&&attr(r,"id",c[2]),u&2&&attr(r,"placeholder",c[1]),u&1&&r.value!==c[0]&&set_input_value(r,c[0])},i:noop$2,o:noop$2,d(c){c&&detach(t),l=!1,run_all(a)}}}function splitPubkey(i){return i.includes("_")?i.split("_")[0]:i.includes(":")?i.split(":")[0]:i}function instance$1t(i,t,n){let{value:s=""}=t,{placeholder:o="Enter text"}=t,{onInput:r}=t,{label:l}=t,{isPubkey:a=!1}=t;function c(f){let h=f.target.value;a&&h.length>66&&(h=splitPubkey(h)),r(h)}function u(){s=this.value,n(0,s)}return i.$$set=f=>{"value"in f&&n(0,s=f.value),"placeholder"in f&&n(1,o=f.placeholder),"onInput"in f&&n(4,r=f.onInput),"label"in f&&n(2,l=f.label),"isPubkey"in f&&n(5,a=f.isPubkey)},[s,o,l,c,r,a,u]}class Input extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1t,create_fragment$1u,safe_not_equal,{value:0,placeholder:1,onInput:4,label:2,isPubkey:5})}}const password_svelte_svelte_type_style_lang="";function create_else_block$u(i){let t,n,s,o,r,l;return{c(){t=element("input"),n=space(),s=element("img"),attr(t,"type","text"),attr(t,"id",i[2]),attr(t,"class","input svelte-8cxix1"),attr(t,"placeholder",i[1]),t.readOnly=i[3],src_url_equal(s.src,o="swarm/show.svg")||attr(s,"src",o),attr(s,"alt","visibility"),attr(s,"class","toggle svelte-8cxix1")},m(a,c){insert(a,t,c),set_input_value(t,i[0]),insert(a,n,c),insert(a,s,c),r||(l=[listen(t,"input",i[9]),listen(t,"input",i[5]),listen(s,"click",i[6])],r=!0)},p(a,c){c&4&&attr(t,"id",a[2]),c&2&&attr(t,"placeholder",a[1]),c&8&&(t.readOnly=a[3]),c&1&&t.value!==a[0]&&set_input_value(t,a[0])},d(a){a&&detach(t),a&&detach(n),a&&detach(s),r=!1,run_all(l)}}}function create_if_block$Y(i){let t,n,s,o,r,l;return{c(){t=element("input"),n=space(),s=element("img"),attr(t,"type","password"),attr(t,"id",i[2]),attr(t,"class","input svelte-8cxix1"),attr(t,"placeholder",i[1]),t.readOnly=i[3],src_url_equal(s.src,o="swarm/hide.svg")||attr(s,"src",o),attr(s,"alt","visibility"),attr(s,"class","toggle svelte-8cxix1")},m(a,c){insert(a,t,c),set_input_value(t,i[0]),insert(a,n,c),insert(a,s,c),r||(l=[listen(t,"input",i[8]),listen(t,"input",i[5]),listen(s,"click",i[6])],r=!0)},p(a,c){c&4&&attr(t,"id",a[2]),c&2&&attr(t,"placeholder",a[1]),c&8&&(t.readOnly=a[3]),c&1&&t.value!==a[0]&&set_input_value(t,a[0])},d(a){a&&detach(t),a&&detach(n),a&&detach(s),r=!1,run_all(l)}}}function create_fragment$1t(i){let t,n,s,o,r;function l(u,f){return u[4]?create_if_block$Y:create_else_block$u}let a=l(i),c=a(i);return{c(){t=element("div"),n=element("label"),s=text(i[2]),o=space(),r=element("div"),c.c(),attr(n,"for",i[2]),attr(n,"class","label svelte-8cxix1"),attr(r,"class","input_container svelte-8cxix1"),attr(t,"class","container svelte-8cxix1")},m(u,f){insert(u,t,f),append(t,n),append(n,s),append(t,o),append(t,r),c.m(r,null)},p(u,[f]){f&4&&set_data(s,u[2]),f&4&&attr(n,"for",u[2]),a===(a=l(u))&&c?c.p(u,f):(c.d(1),c=a(u),c&&(c.c(),c.m(r,null)))},i:noop$2,o:noop$2,d(u){u&&detach(t),c.d()}}}function instance$1s(i,t,n){let s,{value:o=""}=t,{placeholder:r="Enter text"}=t,{onInput:l}=t,{label:a}=t,{readonly:c=!1}=t;function u(g){const b=g.target.value;l(b)}function f(){n(4,s=!s)}function h(){o=this.value,n(0,o)}function p(){o=this.value,n(0,o)}return i.$$set=g=>{"value"in g&&n(0,o=g.value),"placeholder"in g&&n(1,r=g.placeholder),"onInput"in g&&n(7,l=g.onInput),"label"in g&&n(2,a=g.label),"readonly"in g&&n(3,c=g.readonly)},n(4,s=!0),[o,r,a,c,s,u,f,l,h,p]}let Password$1=class extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1s,create_fragment$1t,safe_not_equal,{value:0,placeholder:1,onInput:7,label:2,readonly:3})}};const Login_svelte_svelte_type_style_lang="";function create_if_block_2$l(i){let t,n,s;return n=new ToastNotification$1({props:{fullWidth:!0,title:"Error",subtitle:i[7]}}),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","toast_container svelte-17iyek0")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p(o,r){const l={};r&128&&(l.subtitle=o[7]),n.$set(l)},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_else_block_1$4(i){let t;return{c(){t=text("Login")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_1$s(i){let t;return{c(){t=element("div"),attr(t,"class","loading-spinner svelte-17iyek0")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_else_block$t(i){let t,n,s,o;return{c(){t=element("a"),n=element("img"),o=text("Login With Sphinx"),src_url_equal(n.src,s="swarm/sphinx_logo.svg")||attr(n,"src",s),attr(n,"alt","sphinx"),attr(n,"class","sphinx_logo svelte-17iyek0"),attr(t,"href",i[5]),attr(t,"class","sphinx_link svelte-17iyek0")},m(r,l){insert(r,t,l),append(t,n),append(t,o)},p(r,l){l&32&&attr(t,"href",r[5])},d(r){r&&detach(t)}}}function create_if_block$X(i){let t;return{c(){t=element("div"),t.innerHTML='
',attr(t,"class","sphinx_loading-spinner_container svelte-17iyek0")},m(n,s){insert(n,t,s)},p:noop$2,d(n){n&&detach(t)}}}function create_fragment$1s(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M,E,L,R,O,B=i[4]&&create_if_block_2$l(i);function z(Z){i[14](Z)}let F={label:"Username",placeholder:"Enter Username ...",onInput:i[10]};i[1]!==void 0&&(F.value=i[1]),h=new Input({props:F}),binding_callbacks.push(()=>bind(h,"value",z,i[1]));function q(Z){i[15](Z)}let N={label:"Password",placeholder:"Enter Password ...",onInput:i[11]};i[0]!==void 0&&(N.value=i[0]),b=new Password$1({props:N}),binding_callbacks.push(()=>bind(b,"value",q,i[0]));function ee(Z,ge){return Z[2]===!0?create_if_block_1$s:create_else_block_1$4}let K=ee(i),Q=K(i);function J(Z,ge){return Z[3]?create_if_block$X:create_else_block$t}let Y=J(i),ce=Y(i);return{c(){t=element("main"),n=element("div"),n.innerHTML=`
logo

Welcome to Sphinx Swarm

`,s=space(),o=element("div"),r=element("div"),B&&B.c(),l=space(),a=element("h2"),a.textContent="Login",c=space(),u=element("div"),f=element("div"),create_component(h.$$.fragment),g=space(),create_component(b.$$.fragment),y=space(),S=element("div"),T=element("button"),Q.c(),A=space(),x=element("div"),x.innerHTML=`

OR

`,C=space(),I=element("div"),M=element("button"),ce.c(),attr(n,"class","image_container svelte-17iyek0"),attr(a,"class","login_text svelte-17iyek0"),attr(f,"class","inputs_container svelte-17iyek0"),T.disabled=w=i[2]||i[8]||i[3],attr(T,"class","submit_btn svelte-17iyek0"),attr(S,"class","submit_btn_container svelte-17iyek0"),attr(x,"class","alt_info svelte-17iyek0"),M.disabled=E=!i[6]||!i[5]||i[3]||i[2],attr(M,"class","sphinx_btn svelte-17iyek0"),attr(I,"class","sphinx_btn_container svelte-17iyek0"),attr(u,"class","form_container svelte-17iyek0"),attr(r,"class","login_inner_container svelte-17iyek0"),attr(o,"class","sign_contianer svelte-17iyek0"),attr(t,"class","container svelte-17iyek0")},m(Z,ge){insert(Z,t,ge),append(t,n),append(t,s),append(t,o),append(o,r),B&&B.m(r,null),append(r,l),append(r,a),append(r,c),append(r,u),append(u,f),mount_component(h,f,null),append(f,g),mount_component(b,f,null),append(u,y),append(u,S),append(S,T),Q.m(T,null),append(u,A),append(u,x),append(u,C),append(u,I),append(I,M),ce.m(M,null),L=!0,R||(O=[listen(T,"click",i[9]),listen(M,"click",i[12])],R=!0)},p(Z,[ge]){Z[4]?B?(B.p(Z,ge),ge&16&&transition_in(B,1)):(B=create_if_block_2$l(Z),B.c(),transition_in(B,1),B.m(r,l)):B&&(group_outros(),transition_out(B,1,1,()=>{B=null}),check_outros());const se={};!p&&ge&2&&(p=!0,se.value=Z[1],add_flush_callback(()=>p=!1)),h.$set(se);const re={};!v&&ge&1&&(v=!0,re.value=Z[0],add_flush_callback(()=>v=!1)),b.$set(re),K!==(K=ee(Z))&&(Q.d(1),Q=K(Z),Q&&(Q.c(),Q.m(T,null))),(!L||ge&268&&w!==(w=Z[2]||Z[8]||Z[3]))&&(T.disabled=w),Y===(Y=J(Z))&&ce?ce.p(Z,ge):(ce.d(1),ce=Y(Z),ce&&(ce.c(),ce.m(M,null))),(!L||ge&108&&E!==(E=!Z[6]||!Z[5]||Z[3]||Z[2]))&&(M.disabled=E)},i(Z){L||(transition_in(B),transition_in(h.$$.fragment,Z),transition_in(b.$$.fragment,Z),L=!0)},o(Z){transition_out(B),transition_out(h.$$.fragment,Z),transition_out(b.$$.fragment,Z),L=!1},d(Z){Z&&detach(t),B&&B.d(),destroy_component(h),destroy_component(b),Q.d(),ce.d(),R=!1,run_all(O)}}}function instance$1r(i,t,n){let s,o,r,l,a,c,{saveUserToStore:u=x=>{}}=t,f=!1,h=!1,p=!1,g;async function b(){try{n(2,f=!0);const x=await login(s,o);x&&(u(x.token),n(1,s=""),n(0,o="")),n(2,f=!1)}catch{n(2,f=!1)}}async function v(){let x=0;g=setInterval(async()=>{try{const C=await get_challenge_status(l);C.success&&(n(6,l=""),u(C.token),n(3,h=!1),g&&clearInterval(g)),!C.success&&C.message==="unauthorized"&&(n(6,l=""),n(3,h=!1),n(4,p=!0),n(7,a="You are not the authorized admin"),g&&clearInterval(g),setTimeout(()=>{n(4,p=!1)},2e4)),x++,x>100&&(n(3,h=!1),n(4,p=!0),n(7,a="Timeout, please try again"),g&&clearInterval(g),setTimeout(()=>{n(4,p=!1)},2e4))}catch(C){n(3,h=!1),console.log("Auth interval error",C)}},3e3)}function y(x){n(1,s=x)}function S(x){n(0,o=x)}async function T(x){try{n(3,h=!0),v()}catch{n(3,h=!1)}}onMount(async()=>{const x=await get_challenge();x&&(n(6,l=x.challenge),n(5,r=contructQrString(x.challenge)))}),onDestroy(()=>{g&&clearInterval(g)});function w(x){s=x,n(1,s)}function A(x){o=x,n(0,o)}return i.$$set=x=>{"saveUserToStore"in x&&n(13,u=x.saveUserToStore)},i.$$.update=()=>{i.$$.dirty&3&&n(8,c=!s||!o)},n(1,s=""),n(0,o=""),n(5,r=""),n(6,l=""),n(7,a=""),[o,s,f,h,p,r,l,a,c,b,y,S,T,u,w,A]}let Login$1=class extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1r,create_fragment$1s,safe_not_equal,{saveUserToStore:13})}};const initialUsers=[],_hasatob=typeof atob=="function",_hasBuffer=typeof Buffer=="function",_TD=typeof TextDecoder=="function"?new TextDecoder:void 0;typeof TextEncoder=="function"&&new TextEncoder;const b64ch="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",b64chs=Array.prototype.slice.call(b64ch),b64tab=(i=>{let t={};return i.forEach((n,s)=>t[n]=s),t})(b64chs),b64re=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_fromCC=String.fromCharCode.bind(String),_U8Afrom=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):(i,t=n=>n)=>new Uint8Array(Array.prototype.slice.call(i,0).map(t)),_tidyB64=i=>i.replace(/[^A-Za-z0-9\+\/]/g,""),re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=i=>{switch(i.length){case 4:var t=(7&i.charCodeAt(0))<<18|(63&i.charCodeAt(1))<<12|(63&i.charCodeAt(2))<<6|63&i.charCodeAt(3),n=t-65536;return _fromCC((n>>>10)+55296)+_fromCC((n&1023)+56320);case 3:return _fromCC((15&i.charCodeAt(0))<<12|(63&i.charCodeAt(1))<<6|63&i.charCodeAt(2));default:return _fromCC((31&i.charCodeAt(0))<<6|63&i.charCodeAt(1))}},btou=i=>i.replace(re_btou,cb_btou),atobPolyfill=i=>{if(i=i.replace(/\s+/g,""),!b64re.test(i))throw new TypeError("malformed base64.");i+="==".slice(2-(i.length&3));let t,n="",s,o;for(let r=0;r>16&255):o===64?_fromCC(t>>16&255,t>>8&255):_fromCC(t>>16&255,t>>8&255,t&255);return n},_atob=_hasatob?i=>atob(_tidyB64(i)):_hasBuffer?i=>Buffer.from(i,"base64").toString("binary"):atobPolyfill,_toUint8Array=_hasBuffer?i=>_U8Afrom(Buffer.from(i,"base64")):i=>_U8Afrom(_atob(i),t=>t.charCodeAt(0)),_decode=_hasBuffer?i=>Buffer.from(i,"base64").toString("utf8"):_TD?i=>_TD.decode(_toUint8Array(i)):i=>btou(_atob(i)),_unURI=i=>_tidyB64(i.replace(/[-_]/g,t=>t=="-"?"+":"/")),decode=i=>_decode(_unURI(i)),emptyStack={network:"regtest",nodes:[],ready:!1},selectedNode=writable(),stack=writable(emptyStack),users=writable(initialUsers),tribes=writable({page:1,total:0,data:[]}),people=writable([]),channels=writable({}),proxy=writable({total:0,user_count:0}),walletBalance=writable(0),lightningAddresses=writable({}),btcinfo=writable(),peers=writable({}),lndBalances=writable({}),unconfirmedBalance=writable({}),relayBalances=writable({}),activeInvoice=writable({}),activeUser=writable(),containers=writable([]),onChainAddressGeneratedForOnboarding=writable(!1),copiedAddressForOnboarding=writable(!1),createdPeerForOnboarding=writable(!1),channelCreatedForOnboarding=writable(!1),adminIsCreatedForOnboarding=writable(!1),isOnboarding=writable(!1),boltwallSuperAdminPubkey=writable("");derived([channels,selectedNode],([i,t])=>{if(!(t&&t.name))return{inbound:0,outbound:0};const n=t.name;return{inbound:i[n]&&i[n].length?i[n].reduce((s,o)=>s+o.remote_balance,0):0,outbound:i[n]&&i[n].length?i[n].reduce((s,o)=>s+o.local_balance,0):0}});function makeChannelBalances(i,t){if(!(t&&t.name))return{inbound:0,outbound:0};const n=t.name;return i[n]?{inbound:i[n]&&i[n].length?i[n].reduce((s,o)=>o.active?s+o.remote_balance:s,0):0,outbound:i[n]&&i[n].length?i[n].reduce((s,o)=>o.active?s+o.local_balance:s,0):0}:{inbound:0,outbound:0}}const channelBalances=derived([channels,selectedNode],([i,t])=>makeChannelBalances(i,t)),finishedOnboarding=derived([channels,users,lndBalances,peers],([i,t,n,s])=>{let o=!1,r=!1,l=!1,a=!1;for(let u in i)i[u].length>0&&(o=!0);for(let u in s)s[u].length>0&&(l=!0);for(let u in n)n[u]>0&&(r=!0);const c=t==null?void 0:t.find(u=>u.is_admin&&u.alias);return c&&t.length>1&&(a=!0),{hasAdmin:c,hasChannels:o,hasBalance:r,hasPeers:l,hasUsers:a}});function nodeHostLocalhost(i){if(i)return i.type==="Relay"?`localhost:${i.port||"3000"}`:i.type==="Lnd"?`localhost:${i.rpc_port||"10009"}`:i.type==="Cln"?`localhost:${i.grpc_port||"10009"}`:i.type==="Proxy"?`localhost:${i.port||"10009"}`:"localhost"}const node_host=derived([stack,selectedNode],([i,t])=>t?i.host?`${t.name}.${i.host}`:nodeHostLocalhost(t):""),node_state=derived([selectedNode,containers],([i,t])=>{if(!i||i.place==="External"||!t||!Array.isArray(t))return;const n=t==null?void 0:t.find(s=>s.Names.includes(`/${i.name}.sphinx`));if(n)return n.State}),nodes_exited=derived([containers],([i])=>{let t=[];for(let n of i)if(n.State==="exited"){let o=n.Names[0].split("/")[1].replace(".sphinx","");t=[...t,o]}return t}),saveUserToStore=async(i="")=>{if(i)return localStorage.setItem(userKey,i),activeUser.set(i);let t=localStorage.getItem(userKey);if(t){const n=t.split(".");if(JSON.parse(decode(n[1])).exp*1e3>Date.now()){const o=await refresh_token(t);return localStorage.setItem(userKey,o.token),activeUser.set(o.token)}}},logoutUser=()=>(localStorage.setItem(userKey,""),activeUser.set(""));saveUserToStore();async function sleep$1(i){return new Promise(t=>setTimeout(t,i))}const hsmd=writable(!1),hsmdClients=writable();var noop$1={value:()=>{}};function dispatch(){for(var i=0,t=arguments.length,n={},s;i=0&&(s=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:s}})}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function(i,t){var n=this._,s=parseTypenames$1(i+"",n),o,r=-1,l=s.length;if(arguments.length<2){for(;++r0)for(var n=new Array(o),s=0,o,r;s=0&&(t=i.slice(0,n))!=="xmlns"&&(i=i.slice(n+1)),namespaces.hasOwnProperty(t)?{space:namespaces[t],local:i}:i}function creatorInherit(i){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===xhtml&&t.documentElement.namespaceURI===xhtml?t.createElement(i):t.createElementNS(n,i)}}function creatorFixed(i){return function(){return this.ownerDocument.createElementNS(i.space,i.local)}}function creator(i){var t=namespace(i);return(t.local?creatorFixed:creatorInherit)(t)}function none(){}function selector(i){return i==null?none:function(){return this.querySelector(i)}}function selection_select(i){typeof i!="function"&&(i=selector(i));for(var t=this._groups,n=t.length,s=new Array(n),o=0;o=w&&(w=T+1);!(x=y[w])&&++w=0;)(l=s[o])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function selection_sort(i){i||(i=ascending);function t(h,p){return h&&p?i(h.__data__,p.__data__):!h-!p}for(var n=this._groups,s=n.length,o=new Array(s),r=0;rt?1:i>=t?0:NaN}function selection_call(){var i=arguments[0];return arguments[0]=this,i.apply(null,arguments),this}function selection_nodes(){return Array.from(this)}function selection_node(){for(var i=this._groups,t=0,n=i.length;t1?this.each((t==null?styleRemove$1:typeof t=="function"?styleFunction$1:styleConstant$1)(i,t,n??"")):styleValue(this.node(),i)}function styleValue(i,t){return i.style.getPropertyValue(t)||defaultView(i).getComputedStyle(i,null).getPropertyValue(t)}function propertyRemove(i){return function(){delete this[i]}}function propertyConstant(i,t){return function(){this[i]=t}}function propertyFunction(i,t){return function(){var n=t.apply(this,arguments);n==null?delete this[i]:this[i]=n}}function selection_property(i,t){return arguments.length>1?this.each((t==null?propertyRemove:typeof t=="function"?propertyFunction:propertyConstant)(i,t)):this.node()[i]}function classArray(i){return i.trim().split(/^|\s+/)}function classList(i){return i.classList||new ClassList(i)}function ClassList(i){this._node=i,this._names=classArray(i.getAttribute("class")||"")}ClassList.prototype={add:function(i){var t=this._names.indexOf(i);t<0&&(this._names.push(i),this._node.setAttribute("class",this._names.join(" ")))},remove:function(i){var t=this._names.indexOf(i);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(i){return this._names.indexOf(i)>=0}};function classedAdd(i,t){for(var n=classList(i),s=-1,o=t.length;++s=0&&(n=t.slice(s+1),t=t.slice(0,s)),{type:t,name:n}})}function onRemove(i){return function(){var t=this.__on;if(t){for(var n=0,s=-1,o=t.length,r;n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?rgba(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?rgba(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=reRgbInteger.exec(i))?new Rgb(t[1],t[2],t[3],1):(t=reRgbPercent.exec(i))?new Rgb(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=reRgbaInteger.exec(i))?rgba(t[1],t[2],t[3],t[4]):(t=reRgbaPercent.exec(i))?rgba(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=reHslPercent.exec(i))?hsla(t[1],t[2]/100,t[3]/100,1):(t=reHslaPercent.exec(i))?hsla(t[1],t[2]/100,t[3]/100,t[4]):named.hasOwnProperty(i)?rgbn(named[i]):i==="transparent"?new Rgb(NaN,NaN,NaN,0):null}function rgbn(i){return new Rgb(i>>16&255,i>>8&255,i&255,1)}function rgba(i,t,n,s){return s<=0&&(i=t=n=NaN),new Rgb(i,t,n,s)}function rgbConvert(i){return i instanceof Color$1||(i=color$1(i)),i?(i=i.rgb(),new Rgb(i.r,i.g,i.b,i.opacity)):new Rgb}function rgb(i,t,n,s){return arguments.length===1?rgbConvert(i):new Rgb(i,t,n,s??1)}function Rgb(i,t,n,s){this.r=+i,this.g=+t,this.b=+n,this.opacity=+s}define(Rgb,rgb,extend(Color$1,{brighter(i){return i=i==null?brighter:Math.pow(brighter,i),new Rgb(this.r*i,this.g*i,this.b*i,this.opacity)},darker(i){return i=i==null?darker:Math.pow(darker,i),new Rgb(this.r*i,this.g*i,this.b*i,this.opacity)},rgb(){return this},clamp(){return new Rgb(clampi(this.r),clampi(this.g),clampi(this.b),clampa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rgb_formatHex,formatHex:rgb_formatHex,formatHex8:rgb_formatHex8,formatRgb:rgb_formatRgb,toString:rgb_formatRgb}));function rgb_formatHex(){return`#${hex$1(this.r)}${hex$1(this.g)}${hex$1(this.b)}`}function rgb_formatHex8(){return`#${hex$1(this.r)}${hex$1(this.g)}${hex$1(this.b)}${hex$1((isNaN(this.opacity)?1:this.opacity)*255)}`}function rgb_formatRgb(){const i=clampa(this.opacity);return`${i===1?"rgb(":"rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${i===1?")":`, ${i})`}`}function clampa(i){return isNaN(i)?1:Math.max(0,Math.min(1,i))}function clampi(i){return Math.max(0,Math.min(255,Math.round(i)||0))}function hex$1(i){return i=clampi(i),(i<16?"0":"")+i.toString(16)}function hsla(i,t,n,s){return s<=0?i=t=n=NaN:n<=0||n>=1?i=t=NaN:t<=0&&(i=NaN),new Hsl(i,t,n,s)}function hslConvert(i){if(i instanceof Hsl)return new Hsl(i.h,i.s,i.l,i.opacity);if(i instanceof Color$1||(i=color$1(i)),!i)return new Hsl;if(i instanceof Hsl)return i;i=i.rgb();var t=i.r/255,n=i.g/255,s=i.b/255,o=Math.min(t,n,s),r=Math.max(t,n,s),l=NaN,a=r-o,c=(r+o)/2;return a?(t===r?l=(n-s)/a+(n0&&c<1?0:l,new Hsl(l,a,c,i.opacity)}function hsl(i,t,n,s){return arguments.length===1?hslConvert(i):new Hsl(i,t,n,s??1)}function Hsl(i,t,n,s){this.h=+i,this.s=+t,this.l=+n,this.opacity=+s}define(Hsl,hsl,extend(Color$1,{brighter(i){return i=i==null?brighter:Math.pow(brighter,i),new Hsl(this.h,this.s,this.l*i,this.opacity)},darker(i){return i=i==null?darker:Math.pow(darker,i),new Hsl(this.h,this.s,this.l*i,this.opacity)},rgb(){var i=this.h%360+(this.h<0)*360,t=isNaN(i)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,o=2*n-s;return new Rgb(hsl2rgb$1(i>=240?i-240:i+120,o,s),hsl2rgb$1(i,o,s),hsl2rgb$1(i<120?i+240:i-120,o,s),this.opacity)},clamp(){return new Hsl(clamph(this.h),clampt(this.s),clampt(this.l),clampa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const i=clampa(this.opacity);return`${i===1?"hsl(":"hsla("}${clamph(this.h)}, ${clampt(this.s)*100}%, ${clampt(this.l)*100}%${i===1?")":`, ${i})`}`}}));function clamph(i){return i=(i||0)%360,i<0?i+360:i}function clampt(i){return Math.max(0,Math.min(1,i||0))}function hsl2rgb$1(i,t,n){return(i<60?t+(n-t)*i/60:i<180?n:i<240?t+(n-t)*(240-i)/60:t)*255}const constant$1=i=>()=>i;function linear(i,t){return function(n){return i+n*t}}function exponential(i,t,n){return i=Math.pow(i,n),t=Math.pow(t,n)-i,n=1/n,function(s){return Math.pow(i+s*t,n)}}function gamma(i){return(i=+i)==1?nogamma:function(t,n){return n-t?exponential(t,n,i):constant$1(isNaN(t)?n:t)}}function nogamma(i,t){var n=t-i;return n?linear(i,n):constant$1(isNaN(i)?t:i)}const interpolateRgb=function i(t){var n=gamma(t);function s(o,r){var l=n((o=rgb(o)).r,(r=rgb(r)).r),a=n(o.g,r.g),c=n(o.b,r.b),u=nogamma(o.opacity,r.opacity);return function(f){return o.r=l(f),o.g=a(f),o.b=c(f),o.opacity=u(f),o+""}}return s.gamma=i,s}(1);function interpolateNumber(i,t){return i=+i,t=+t,function(n){return i*(1-n)+t*n}}var reA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,reB=new RegExp(reA.source,"g");function zero(i){return function(){return i}}function one(i){return function(t){return i(t)+""}}function interpolateString(i,t){var n=reA.lastIndex=reB.lastIndex=0,s,o,r,l=-1,a=[],c=[];for(i=i+"",t=t+"";(s=reA.exec(i))&&(o=reB.exec(t));)(r=o.index)>n&&(r=t.slice(n,r),a[l]?a[l]+=r:a[++l]=r),(s=s[0])===(o=o[0])?a[l]?a[l]+=o:a[++l]=o:(a[++l]=null,c.push({i:l,x:interpolateNumber(s,o)})),n=reB.lastIndex;return n180?f+=360:f-u>180&&(u+=360),p.push({i:h.push(o(h)+"rotate(",null,s)-2,x:interpolateNumber(u,f)})):f&&h.push(o(h)+"rotate("+f+s)}function a(u,f,h,p){u!==f?p.push({i:h.push(o(h)+"skewX(",null,s)-2,x:interpolateNumber(u,f)}):f&&h.push(o(h)+"skewX("+f+s)}function c(u,f,h,p,g,b){if(u!==h||f!==p){var v=g.push(o(g)+"scale(",null,",",null,")");b.push({i:v-4,x:interpolateNumber(u,h)},{i:v-2,x:interpolateNumber(f,p)})}else(h!==1||p!==1)&&g.push(o(g)+"scale("+h+","+p+")")}return function(u,f){var h=[],p=[];return u=i(u),f=i(f),r(u.translateX,u.translateY,f.translateX,f.translateY,h,p),l(u.rotate,f.rotate,h,p),a(u.skewX,f.skewX,h,p),c(u.scaleX,u.scaleY,f.scaleX,f.scaleY,h,p),u=f=null,function(g){for(var b=-1,v=p.length,y;++b=0&&i._call.call(void 0,t),i=i._next;--frame}function wake(){clockNow=(clockLast=clock.now())+clockSkew,frame=timeout$1=0;try{timerFlush()}finally{frame=0,nap(),clockNow=0}}function poke(){var i=clock.now(),t=i-clockLast;t>pokeDelay&&(clockSkew-=t,clockLast=i)}function nap(){for(var i,t=taskHead,n,s=1/0;t;)t._call?(s>t._time&&(s=t._time),i=t,t=t._next):(n=t._next,t._next=null,t=i?i._next=n:taskHead=n);taskTail=i,sleep(s)}function sleep(i){if(!frame){timeout$1&&(timeout$1=clearTimeout(timeout$1));var t=i-clockNow;t>24?(i<1/0&&(timeout$1=setTimeout(wake,i-clock.now()-clockSkew)),interval&&(interval=clearInterval(interval))):(interval||(clockLast=clock.now(),interval=setInterval(poke,pokeDelay)),frame=1,setFrame(wake))}}function timeout(i,t,n){var s=new Timer;return t=t==null?0:+t,s.restart(o=>{s.stop(),i(o+t)},t,n),s}var emptyOn=dispatch("start","end","cancel","interrupt"),emptyTween=[],CREATED=0,SCHEDULED=1,STARTING=2,STARTED=3,RUNNING=4,ENDING=5,ENDED=6;function schedule(i,t,n,s,o,r){var l=i.__transition;if(!l)i.__transition={};else if(n in l)return;create(i,n,{name:t,index:s,group:o,on:emptyOn,tween:emptyTween,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:CREATED})}function init(i,t){var n=get(i,t);if(n.state>CREATED)throw new Error("too late; already scheduled");return n}function set$1(i,t){var n=get(i,t);if(n.state>STARTED)throw new Error("too late; already running");return n}function get(i,t){var n=i.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function create(i,t,n){var s=i.__transition,o;s[t]=n,n.timer=timer(r,0,n.time);function r(u){n.state=SCHEDULED,n.timer.restart(l,n.delay,n.time),n.delay<=u&&l(u-n.delay)}function l(u){var f,h,p,g;if(n.state!==SCHEDULED)return c();for(f in s)if(g=s[f],g.name===n.name){if(g.state===STARTED)return timeout(l);g.state===RUNNING?(g.state=ENDED,g.timer.stop(),g.on.call("interrupt",i,i.__data__,g.index,g.group),delete s[f]):+fSTARTING&&s.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function onFunction(i,t,n){var s,o,r=start(t)?init:set$1;return function(){var l=r(this,i),a=l.on;a!==s&&(o=(s=a).copy()).on(t,n),l.on=o}}function transition_on(i,t){var n=this._id;return arguments.length<2?get(this.node(),n).on.on(i):this.each(onFunction(n,i,t))}function removeFunction(i){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==i)return;t&&t.removeChild(this)}}function transition_remove(){return this.on("end.remove",removeFunction(this._id))}function transition_select(i){var t=this._name,n=this._id;typeof i!="function"&&(i=selector(i));for(var s=this._groups,o=s.length,r=new Array(o),l=0;l()=>i;function ZoomEvent(i,{sourceEvent:t,target:n,transform:s,dispatch:o}){Object.defineProperties(this,{type:{value:i,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:s,enumerable:!0,configurable:!0},_:{value:o}})}function Transform(i,t,n){this.k=i,this.x=t,this.y=n}Transform.prototype={constructor:Transform,scale:function(i){return i===1?this:new Transform(this.k*i,this.x,this.y)},translate:function(i,t){return i===0&t===0?this:new Transform(this.k,this.x+this.k*i,this.y+this.k*t)},apply:function(i){return[i[0]*this.k+this.x,i[1]*this.k+this.y]},applyX:function(i){return i*this.k+this.x},applyY:function(i){return i*this.k+this.y},invert:function(i){return[(i[0]-this.x)/this.k,(i[1]-this.y)/this.k]},invertX:function(i){return(i-this.x)/this.k},invertY:function(i){return(i-this.y)/this.k},rescaleX:function(i){return i.copy().domain(i.range().map(this.invertX,this).map(i.invert,i))},rescaleY:function(i){return i.copy().domain(i.range().map(this.invertY,this).map(i.invert,i))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var identity=new Transform(1,0,0);transform.prototype=Transform.prototype;function transform(i){for(;!i.__zoom;)if(!(i=i.parentNode))return identity;return i.__zoom}function nopropagation(i){i.stopImmediatePropagation()}function noevent(i){i.preventDefault(),i.stopImmediatePropagation()}function defaultFilter(i){return(!i.ctrlKey||i.type==="wheel")&&!i.button}function defaultExtent(){var i=this;return i instanceof SVGElement?(i=i.ownerSVGElement||i,i.hasAttribute("viewBox")?(i=i.viewBox.baseVal,[[i.x,i.y],[i.x+i.width,i.y+i.height]]):[[0,0],[i.width.baseVal.value,i.height.baseVal.value]]):[[0,0],[i.clientWidth,i.clientHeight]]}function defaultTransform(){return this.__zoom||identity}function defaultWheelDelta(i){return-i.deltaY*(i.deltaMode===1?.05:i.deltaMode?1:.002)*(i.ctrlKey?10:1)}function defaultTouchable(){return navigator.maxTouchPoints||"ontouchstart"in this}function defaultConstrain(i,t,n){var s=i.invertX(t[0][0])-n[0][0],o=i.invertX(t[1][0])-n[1][0],r=i.invertY(t[0][1])-n[0][1],l=i.invertY(t[1][1])-n[1][1];return i.translate(o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function zoom(){var i=defaultFilter,t=defaultExtent,n=defaultConstrain,s=defaultWheelDelta,o=defaultTouchable,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],a=250,c=interpolateZoom,u=dispatch("start","zoom","end"),f,h,p,g=500,b=150,v=0,y=10;function S(z){z.property("__zoom",defaultTransform).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",L).filter(o).on("touchstart.zoom",R).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(z,F,q,N){var ee=z.selection?z.selection():z;ee.property("__zoom",defaultTransform),z!==ee?x(z,F,q,N):ee.interrupt().each(function(){C(this,arguments).event(N).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},S.scaleBy=function(z,F,q,N){S.scaleTo(z,function(){var ee=this.__zoom.k,K=typeof F=="function"?F.apply(this,arguments):F;return ee*K},q,N)},S.scaleTo=function(z,F,q,N){S.transform(z,function(){var ee=t.apply(this,arguments),K=this.__zoom,Q=q==null?A(ee):typeof q=="function"?q.apply(this,arguments):q,J=K.invert(Q),Y=typeof F=="function"?F.apply(this,arguments):F;return n(w(T(K,Y),Q,J),ee,l)},q,N)},S.translateBy=function(z,F,q,N){S.transform(z,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof q=="function"?q.apply(this,arguments):q),t.apply(this,arguments),l)},null,N)},S.translateTo=function(z,F,q,N,ee){S.transform(z,function(){var K=t.apply(this,arguments),Q=this.__zoom,J=N==null?A(K):typeof N=="function"?N.apply(this,arguments):N;return n(identity.translate(J[0],J[1]).scale(Q.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof q=="function"?-q.apply(this,arguments):-q),K,l)},N,ee)};function T(z,F){return F=Math.max(r[0],Math.min(r[1],F)),F===z.k?z:new Transform(F,z.x,z.y)}function w(z,F,q){var N=F[0]-q[0]*z.k,ee=F[1]-q[1]*z.k;return N===z.x&&ee===z.y?z:new Transform(z.k,N,ee)}function A(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function x(z,F,q,N){z.on("start.zoom",function(){C(this,arguments).event(N).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(N).end()}).tween("zoom",function(){var ee=this,K=arguments,Q=C(ee,K).event(N),J=t.apply(ee,K),Y=q==null?A(J):typeof q=="function"?q.apply(ee,K):q,ce=Math.max(J[1][0]-J[0][0],J[1][1]-J[0][1]),Z=ee.__zoom,ge=typeof F=="function"?F.apply(ee,K):F,se=c(Z.invert(Y).concat(ce/Z.k),ge.invert(Y).concat(ce/ge.k));return function(re){if(re===1)re=ge;else{var me=se(re),fe=ce/me[2];re=new Transform(fe,Y[0]-me[0]*fe,Y[1]-me[1]*fe)}Q.zoom(null,re)}})}function C(z,F,q){return!q&&z.__zooming||new I(z,F)}function I(z,F){this.that=z,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(z,F),this.taps=0}I.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,F){return this.mouse&&z!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var F=select(this.that).datum();u.call(z,this.that,new ZoomEvent(z,{sourceEvent:this.sourceEvent,target:S,type:z,transform:this.that.__zoom,dispatch:u}),F)}};function M(z,...F){if(!i.apply(this,arguments))return;var q=C(this,F).event(z),N=this.__zoom,ee=Math.max(r[0],Math.min(r[1],N.k*Math.pow(2,s.apply(this,arguments)))),K=pointer(z);if(q.wheel)(q.mouse[0][0]!==K[0]||q.mouse[0][1]!==K[1])&&(q.mouse[1]=N.invert(q.mouse[0]=K)),clearTimeout(q.wheel);else{if(N.k===ee)return;q.mouse=[K,N.invert(K)],interrupt(this),q.start()}noevent(z),q.wheel=setTimeout(Q,b),q.zoom("mouse",n(w(T(N,ee),q.mouse[0],q.mouse[1]),q.extent,l));function Q(){q.wheel=null,q.end()}}function E(z,...F){if(p||!i.apply(this,arguments))return;var q=z.currentTarget,N=C(this,F,!0).event(z),ee=select(z.view).on("mousemove.zoom",Y,!0).on("mouseup.zoom",ce,!0),K=pointer(z,q),Q=z.clientX,J=z.clientY;dragDisable(z.view),nopropagation(z),N.mouse=[K,this.__zoom.invert(K)],interrupt(this),N.start();function Y(Z){if(noevent(Z),!N.moved){var ge=Z.clientX-Q,se=Z.clientY-J;N.moved=ge*ge+se*se>v}N.event(Z).zoom("mouse",n(w(N.that.__zoom,N.mouse[0]=pointer(Z,q),N.mouse[1]),N.extent,l))}function ce(Z){ee.on("mousemove.zoom mouseup.zoom",null),yesdrag(Z.view,N.moved),noevent(Z),N.event(Z).end()}}function L(z,...F){if(i.apply(this,arguments)){var q=this.__zoom,N=pointer(z.changedTouches?z.changedTouches[0]:z,this),ee=q.invert(N),K=q.k*(z.shiftKey?.5:2),Q=n(w(T(q,K),N,ee),t.apply(this,F),l);noevent(z),a>0?select(this).transition().duration(a).call(x,Q,N,z):select(this).call(S.transform,Q,N,z)}}function R(z,...F){if(i.apply(this,arguments)){var q=z.touches,N=q.length,ee=C(this,F,z.changedTouches.length===N).event(z),K,Q,J,Y;for(nopropagation(z),Q=0;Q"u"||!r[0]?create_if_block$W:create_else_block$s}let s=n(i),o=s(i);return{c(){o.c(),t=empty$1()},m(r,l){o.m(r,l),insert(r,t,l)},p(r,[l]){s===(s=n(r))&&o?o.p(r,l):(o.d(1),o=s(r),o&&(o.c(),o.m(t.parentNode,t)))},i:noop$2,o:noop$2,d(r){o.d(r),r&&detach(t)}}}const shiftRectY=7;function instance$1q(i,t,n){let s,o,r,l,a,c,u,f,h,p,g,{edgeTextProps:b}=t;return i.$$set=v=>{"edgeTextProps"in v&&n(6,b=v.edgeTextProps)},i.$$.update=()=>{i.$$.dirty&64&&n(0,{label:s,labelBgColor:o,labelTextColor:r,centerX:l,centerY:a}=b,s,(n(5,o),n(6,b)),(n(4,r),n(6,b)),(n(11,l),n(6,b)),(n(10,a),n(6,b))),i.$$.dirty&1&&n(7,c=s.length<3?9:7),i.$$.dirty&2048&&n(3,u=l),i.$$.dirty&1024&&n(2,f=a),i.$$.dirty&1&&n(9,h=s.split(" ").length-1),i.$$.dirty&513&&n(8,p=s.length-h),i.$$.dirty&384&&n(1,g=p*c)},[s,g,f,u,r,o,b,c,p,h,a,l]}class EdgeText extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1q,create_fragment$1r,safe_not_equal,{edgeTextProps:6})}}const BaseEdge_svelte_svelte_type_style_lang="";function create_else_block$r(i){let t,n,s;return{c(){t=svg_element("path"),attr(t,"class",n=null_to_empty(i[3]?"animate":"")+" svelte-qtkn5z"),attr(t,"d",i[4]),attr(t,"fill","transparent"),attr(t,"stroke",s=i[1]?i[1]:"gray"),attr(t,"aria-label","svg-path")},m(o,r){insert(o,t,r)},p(o,r){r&8&&n!==(n=null_to_empty(o[3]?"animate":"")+" svelte-qtkn5z")&&attr(t,"class",n),r&16&&attr(t,"d",o[4]),r&2&&s!==(s=o[1]?o[1]:"gray")&&attr(t,"stroke",s)},d(o){o&&detach(t)}}}function create_if_block_1$r(i){let t,n,s;return{c(){t=svg_element("path"),attr(t,"class",n=null_to_empty(i[3]?"animate":"")+" svelte-qtkn5z"),attr(t,"d",i[4]),attr(t,"fill","transparent"),attr(t,"stroke",s=i[1]?i[1]:"gray"),attr(t,"marker-end","url(#arrow)"),attr(t,"aria-label","svg-path")},m(o,r){insert(o,t,r)},p(o,r){r&8&&n!==(n=null_to_empty(o[3]?"animate":"")+" svelte-qtkn5z")&&attr(t,"class",n),r&16&&attr(t,"d",o[4]),r&2&&s!==(s=o[1]?o[1]:"gray")&&attr(t,"stroke",s)},d(o){o&&detach(t)}}}function create_if_block$V(i){let t,n;return t=new EdgeText({props:{edgeTextProps:i[0]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.edgeTextProps=s[0]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$1q(i){let t,n,s,o,r,l,a;function c(p,g){return p[2]?create_if_block_1$r:create_else_block$r}let u=c(i),f=u(i),h=i[0].label&&create_if_block$V(i);return{c(){t=svg_element("defs"),n=svg_element("marker"),s=svg_element("polygon"),o=space(),f.c(),r=space(),h&&h.c(),l=empty$1(),attr(s,"points",i[5]),attr(s,"fill","gray"),attr(n,"id","arrow"),attr(n,"markerWidth","9"),attr(n,"markerHeight","9"),attr(n,"refX","8"),attr(n,"refY","4"),attr(n,"orient","auto")},m(p,g){insert(p,t,g),append(t,n),append(n,s),insert(p,o,g),f.m(p,g),insert(p,r,g),h&&h.m(p,g),insert(p,l,g),a=!0},p(p,[g]){u===(u=c(p))&&f?f.p(p,g):(f.d(1),f=u(p),f&&(f.c(),f.m(r.parentNode,r))),p[0].label?h?(h.p(p,g),g&1&&transition_in(h,1)):(h=create_if_block$V(p),h.c(),transition_in(h,1),h.m(l.parentNode,l)):h&&(group_outros(),transition_out(h,1,1,()=>{h=null}),check_outros())},i(p){a||(transition_in(h),a=!0)},o(p){transition_out(h),a=!1},d(p){p&&detach(t),p&&detach(o),f.d(p),p&&detach(r),h&&h.d(p),p&&detach(l)}}}function instance$1p(i,t,n){let s,o,r,l,a,c,u,f,h,p,{baseEdgeProps:g}=t;const b="0 0, 9 4.5, 0 9";return i.$$set=v=>{"baseEdgeProps"in v&&n(6,g=v.baseEdgeProps)},i.$$.update=()=>{i.$$.dirty&64&&n(4,{path:s,animate:o,arrow:r,label:l,labelBgColor:a,labelTextColor:c,edgeColor:u,centerX:f,centerY:h}=g,s,(n(3,o),n(6,g)),(n(2,r),n(6,g)),(n(11,l),n(6,g)),(n(10,a),n(6,g)),(n(9,c),n(6,g)),(n(1,u),n(6,g)),(n(8,f),n(6,g)),(n(7,h),n(6,g))),i.$$.dirty&3968&&n(0,p={label:l,labelBgColor:a,labelTextColor:c,centerX:f,centerY:h})},[p,u,r,o,s,b,g,h,f,c,a,l]}class BaseEdge extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1p,create_fragment$1q,safe_not_equal,{baseEdgeProps:6})}}var Position;(function(i){i.Left="left",i.Right="right",i.Top="top",i.Bottom="bottom"})(Position||(Position={}));function create_fragment$1p(i){let t,n;return t=new BaseEdge({props:{baseEdgeProps:i[0]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,[o]){const r={};o&1&&(r.baseEdgeProps=s[0]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function calculateControlOffset(i,t){return i>=0?.5*i:t*25*Math.sqrt(-i)}function instance$1o(i,t,n){let s,o,r,l,a;function c({pos:p,x1:g,y1:b,x2:v,y2:y,c:S}){let T,w;switch(p){case Position.Left:T=g-calculateControlOffset(g-v,S),w=b;break;case Position.Right:T=g+calculateControlOffset(v-g,S),w=b;break;case Position.Top:T=g,w=b-calculateControlOffset(b-y,S);break;case Position.Bottom:T=g,w=b+calculateControlOffset(y-b,S);break}return[T,w]}function u({sourceX:p,sourceY:g,sourcePosition:b=Position.Bottom,targetX:v,targetY:y,targetPosition:S=Position.Top,curvature:T=.25}){const[w,A]=c({pos:b,x1:p,y1:g,x2:v,y2:y,c:T}),[x,C]=c({pos:S,x1:v,y1:y,x2:p,y2:g,c:T});return`M${p},${g} C${w},${A} ${x},${C} ${v},${y}`}function f({sourceX:p,sourceY:g,sourcePosition:b=Position.Bottom,targetX:v,targetY:y,targetPosition:S=Position.Top,curvature:T=.25}){const[w,A]=c({pos:b,x1:p,y1:g,x2:v,y2:y,c:T}),[x,C]=c({pos:S,x1:v,y1:y,x2:p,y2:g,c:T}),I=p*.125+w*.375+x*.375+v*.125,M=g*.125+A*.375+C*.375+y*.125,E=Math.abs(I-p),L=Math.abs(M-g);return[I,M,E,L]}let{edge:h}=t;return i.$$set=p=>{"edge"in p&&n(1,h=p.edge)},i.$$.update=()=>{i.$$.dirty&2&&n(5,s={sourceX:h.sourceX,sourceY:h.sourceY,sourcePosition:h.sourcePosition,targetX:h.targetX,targetY:h.targetY,targetPosition:h.targetPosition,curvature:.25}),i.$$.dirty&32&&n(4,o=u(s)),i.$$.dirty&32&&n(3,[r,l]=f(s),r,(n(2,l),n(5,s),n(1,h))),i.$$.dirty&30&&n(0,a={...h,path:o,centerX:r,centerY:l})},[a,h,l,r,o,s]}class SimpleBezierEdge extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$1o,create_fragment$1p,safe_not_equal,{edge:1})}}function create_fragment$1o(i){let t,n;return t=new BaseEdge({props:{baseEdgeProps:i[0]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,[o]){const r={};o&1&&(r.baseEdgeProps=s[0]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function instance$1n(i,t,n){let s,o,r,l,a,c,{edge:u}=t;return i.$$set=f=>{"edge"in f&&n(1,u=f.edge)},i.$$.update=()=>{i.$$.dirty&2&&n(6,s=Math.abs(u.targetX-u.sourceX)/2),i.$$.dirty&2&&n(5,o=Math.abs(u.targetY-u.sourceY)/2),i.$$.dirty&66&&n(3,r=u.targetX{const l=LeftOrRight.includes(o),a=LeftOrRight.includes(r);if(l&&!a||a&&!l){const g=l?Math.abs(n-i):0,b=i>n?i-g:i+g,v=l?0:Math.abs(s-t),y=t{const w=get_store_value(coreSvelvetStore.boundary);w?coreSvelvetStore.nodesStore.update(A=>{const x=A.find(I=>I.id===T),C=get_store_value(coreSvelvetStore.d3Scale);return x.childNodes?(A.forEach(I=>{x.childNodes.includes(I.id)&&(I.position.x=Math.min(Math.max(I.position.x+S.movementX/C,1),w.x-50),I.position.y=Math.min(Math.max(I.position.y+S.movementY/C,1),w.y-50))}),x.position.x=Math.min(Math.max(x.position.x+S.movementX/C,1),w.x-50),x.position.y=Math.min(Math.max(x.position.y+S.movementY/C,1),w.y-50)):(x.position.x=Math.min(Math.max(x.position.x+S.movementX/C,1),w.x-50),x.position.y=Math.min(Math.max(x.position.y+S.movementY/C,1),w.y-50)),[...A]}):coreSvelvetStore.nodesStore.update(A=>{const x=A.find(I=>I.id===T),C=get_store_value(coreSvelvetStore.d3Scale);return x.childNodes?(A.forEach(I=>{x.childNodes.includes(I.id)&&(I.position.x+=S.movementX/C,I.position.y+=S.movementY/C)}),x.position.x+=S.movementX/C,x.position.y+=S.movementY/C):(x.position.x+=S.movementX/C,x.position.y+=S.movementY/C),[...A]})},s=(S,T)=>{coreSvelvetStore.edgesStore.update(w=>{const A=w.find(C=>C.id===T),x=get_store_value(coreSvelvetStore.d3Scale);return A.target||(A.targetX+=S.movementX/x,A.targetY+=S.movementY/x),A.source||(A.sourceX+=S.movementX/x,A.sourceY+=S.movementY/x),[...w]})},o=(S,T)=>{coreSvelvetStore.nodesStore.update(w=>(w.forEach(A=>{if(A.id===T){const{x,y:C,width:I,height:M}=S.target.getBoundingClientRect(),E=(S.touches[0].clientX-x)/I*S.target.offsetWidth,L=(S.touches[0].clientY-C)/M*S.target.offsetHeight;A.position.x+=E-A.width/2,A.position.y+=L-A.height/2}}),[...w]))},r=(S,T)=>{confirm("Are you sure you want to delete this node?")&&(coreSvelvetStore.nodesStore.update(A=>A.filter(x=>x.id!==T)),coreSvelvetStore.edgesStore.update(A=>A.filter(x=>x.source!==T&&x.target!==T)))},l=(S,T,w,A)=>{S.preventDefault();const x=(Math.random()+1).toString(36).substring(7)+"-"+(Math.random()+1).toString(36).substring(7),[C,I]=v(w,A,T),M=w==="source"?{id:x,source:T.id,target:null,targetX:C,targetY:I,animate:!0}:{id:x,source:null,target:T.id,sourceX:C,sourceY:I,animate:!0};return coreSvelvetStore.edgesStore.set([...get_store_value(g),M]),M},a=(S,T,w,A,x)=>{const C=get_store_value(coreSvelvetStore.nodesStore).map(L=>L.id),I=Math.max(...C);S.preventDefault();let M=x==="bottom"?{x:w.targetX,y:w.targetY}:{x:w.sourceX,y:w.sourceY};const E={id:I+1,position:M,data:T.data?{...T.data}:{label:""},width:T.width,height:T.height,className:T.className||"",bgColor:T.bgColor,textColor:T.textColor,borderRadius:T.borderRadius,borderColor:T.borderColor,delete:T.delete};x==="left"?A==="source"?(E.sourcePosition="left",E.targetPosition="right",w.target=E.id,E.position.x=w.targetX-E.width/2,E.position.y=w.targetY):(E.sourcePosition="right",E.targetPosition="left",w.source=E.id,E.position.x=w.sourceX-E.width/2,E.position.y=w.sourceY-E.height):x==="right"?A==="source"?(E.sourcePosition="right",E.targetPosition="left",w.target=E.id,E.position.x=w.targetX-E.width/2,E.position.y=w.targetY):(E.sourcePosition="left",E.targetPosition="right",w.source=E.id,E.position.x=w.sourceX-E.width/2,E.position.y=w.sourceY-E.height):A==="source"?(w.target=E.id,E.position.x=w.targetX-E.width/2,E.position.y=w.targetY):(w.source=E.id,E.position.x=w.sourceX-E.width/2,E.position.y=w.sourceY-E.height),coreSvelvetStore.nodesStore.set([...get_store_value(p),E])},c=(S,T)=>{let w,A,x;const C=document.styleSheets[1].cssRules;Object.values(C).forEach(M=>{if(M.selectorText===`.${T.className}`){const E=M.cssText,L=E.indexOf("{");x=E.substring(L+1,E.length-1);const R=x.split(" ");R.forEach((O,B)=>{O==="width:"&&(w=O.concat(R[B+1]),w=parseInt(R[B+1])),O==="height:"&&(A=O.concat(R[B+1]),A=parseInt(R[B+1]))})}});const I=get_store_value(coreSvelvetStore.nodesStore).map(M=>(T.id===M.id&&(M.width=w||T.width,M.height=A||T.height),M));return coreSvelvetStore.nodesStore.set(I),[w,A,x]},u=coreSvelvetStore.nodeIdSelected,f=(S,T)=>{get_store_value(p).forEach(w=>{var A;w.id===get_store_value(u)&&((A=w.clickCallback)==null||A.call(w,w))})},h=coreSvelvetStore.edgesStore,p=coreSvelvetStore.nodesStore,g=derived([p,h],([S,T])=>(T.forEach(w=>{let A={id:0,position:{x:25,y:475},data:{label:"9"},width:175,height:40,targetPosition:"right",sourcePosition:"left"},x={id:10,position:{x:750,y:475},data:{label:"10"},width:175,height:40,targetPosition:"right",sourcePosition:"left"};if(S.forEach(C=>{w.source===C.id&&(A=C),w.target===C.id&&(x=C)}),S.some(C=>C.id===w.target)||(x=null),S.some(C=>C.id===w.source)||(A=null),A){let C=A.position.x,I=A.position.y,M=A.width/2;A.sourcePosition==="bottom"||A.sourcePosition===void 0?(w.sourceX=C+M,w.sourceY=I+A.height,w.sourcePosition="bottom"):A.sourcePosition==="top"?(w.sourceX=C+M,w.sourceY=I,w.sourcePosition=A.sourcePosition):A.sourcePosition==="left"?(w.sourceX=C,w.sourceY=I+A.height/2,w.sourcePosition=A.sourcePosition):A.sourcePosition==="right"&&(w.sourceX=C+A.width,w.sourceY=I+A.height/2,w.sourcePosition=A.sourcePosition)}if(x){let C=x.position.x,I=x.position.y,M=x.width/2;x.targetPosition==="top"||x.targetPosition===void 0?(w.targetX=C+M,w.targetY=I,w.targetPosition="top"):x.targetPosition==="bottom"?(w.targetX=C+M,w.targetY=I+x.height,w.targetPosition=x.targetPosition):x.targetPosition==="left"?(w.targetX=C,w.targetY=I+x.height/2,w.targetPosition=x.targetPosition):x.targetPosition==="right"&&(w.targetX=C+x.width,w.targetY=I+x.height/2,w.targetPosition=x.targetPosition)}}),[...T])),b=(S,T,w,A,x)=>{let C,I;return S==="top"&&(C=-x/2,I=T/2-A/2),S==="bottom"&&(C=w-x/2,I=T/2-A/2),S==="left"&&(C=w/2-x/2,I=-A/2),S==="right"&&(C=w/2-x/2,I=T-A/2),[C,I]},v=(S,T,w)=>{let A=w.position.x,x=w.position.y,C=w.width/2,I,M;return S==="source"?(T==="top"?(I=A+C,M=x):T==="bottom"?(I=A+C,M=x+w.height):T==="left"?(I=A,M=x+w.height/2):T==="right"&&(I=A+w.width,M=x+w.height/2),[I,M]):(T==="top"?(I=A+C,M=x):T==="bottom"?(I=A+C,M=x+w.height):T==="left"?(I=A,M=x+w.height/2):T==="right"&&(I=A+w.width,M=x+w.height/2),[I,M])},y={...coreSvelvetStore,onTouchMove:o,onEdgeMove:s,onNodeMove:n,onNodeClick:f,setAnchorPosition:b,setNewEdgeProps:v,renderEdge:l,renderNewNode:a,getStyles:c,deleteNode:r,derivedEdges:g};return svelvetStores[i]=y,y}const EdgeAnchor_svelte_svelte_type_style_lang="";function create_else_block$q(i){let t,n;return{c(){t=element("div"),attr(t,"class","Anchor-inert svelte-q792jn"),attr(t,"style",n=` @@ -141,9 +141,9 @@ function print() { __p += __j.call(arguments, '') } Network:`,a=space(),c=element("div"),u=element("span"),f=text(i[1]),h=space(),p=element("span"),b=text(g),v=space(),y=element("div"),create_component(S.$$.fragment),attr(n,"class","head svelte-pjqwuy"),attr(l,"class","label-section svelte-pjqwuy"),attr(u,"class","svelte-pjqwuy"),attr(p,"class","svelte-pjqwuy"),attr(c,"class","label-section svelte-pjqwuy"),attr(r,"class","labels svelte-pjqwuy"),attr(y,"class","qr-wrap svelte-pjqwuy"),attr(o,"class","body svelte-pjqwuy"),attr(t,"class","wrap svelte-pjqwuy")},m(x,C){insert(x,t,C),append(t,n),append(t,s),append(t,o),append(o,r),append(r,l),append(r,a),append(r,c),append(c,u),append(u,f),append(c,h),append(c,p),append(p,b),append(o,v),append(o,y),mount_component(S,y,null),T=!0,w||(A=listen(y,"click",i[3]),w=!0)},p(x,[C]){(!T||C&2)&&set_data(f,x[1]),(!T||C&1)&&g!==(g=x[0].network+"")&&set_data(b,g);const I={};C&3&&(I.value=x[2](x[1],x[0].network)),S.$set(I)},i(x){T||(transition_in(S.$$.fragment,x),T=!0)},o(x){transition_out(S.$$.fragment,x),T=!1},d(x){x&&detach(t),destroy_component(S),w=!1,A()}}}function makeMqttHost(i,t){return i.ip?`${i.ip}:1883`:i.host&&t?`mqtt-${t.name}.${i.host}:8883`:"127.0.0.1:1883"}function makeRelayHost(i,t){return i.host&&t?`${t.name}.${i.host}`:"127.0.0.1:3000"}function instance$p(i,t,n){let s,o,r,l,a;component_subscribe(i,stack,f=>n(0,a=f));function c(f,h){return`sphinx.chat://?action=glyph&mqtt=${f}&network=${h}&relay=${l}`}function u(){const f=c(o,a.network);navigator.clipboard.writeText(f)}return i.$$.update=()=>{i.$$.dirty&1&&n(5,s=a&&a.nodes.find(f=>f.type==="Cln")),i.$$.dirty&33&&n(1,o=makeMqttHost(a,s)),i.$$.dirty&1&&n(4,r=a&&a.nodes.find(f=>f.type==="Relay")),i.$$.dirty&17&&(l=makeRelayHost(a,r))},[a,o,c,u,r,s]}class FirstConnect extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$p,create_fragment$q,safe_not_equal,{})}}async function hsmdCmd(i,t,n){return await send_cmd("Hsmd",{cmd:i,content:n},t)}async function get_clients(i){return await hsmdCmd("GetClients",i)}const Lnd_svelte_svelte_type_style_lang="";function create_else_block$c(i){let t,n,s,o,r,l,a,c,u,f,h,p,g;function b(y){i[9](y)}let v={$$slots:{content:[create_content_slot],default:[create_default_slot_3$1]},$$scope:{ctx:i}};return i[4]!==void 0&&(v.selected=i[4]),u=new Tabs$1({props:v}),binding_callbacks.push(()=>bind(u,"selected",b,i[4])),{c(){t=element("div"),n=element("div"),s=element("span"),s.textContent="Peering Address:",o=space(),r=element("span"),l=text(i[3]),c=space(),create_component(u.$$.fragment),attr(s,"class","svelte-5qzo08"),attr(r,"style",a=`transform:scale(${i[2]?1.1:1});`),attr(r,"class","svelte-5qzo08"),attr(n,"class","node-url svelte-5qzo08"),attr(t,"class","lnd-tabs-wrap")},m(y,S){insert(y,t,S),append(t,n),append(n,s),append(n,o),append(n,r),append(r,l),append(t,c),mount_component(u,t,null),h=!0,p||(g=listen(r,"click",i[6]),p=!0)},p(y,S){(!h||S&8)&&set_data(l,y[3]),(!h||S&4&&a!==(a=`transform:scale(${y[2]?1.1:1});`))&&attr(r,"style",a);const T={};S&4099&&(T.$$scope={dirty:S,ctx:y}),!f&&S&16&&(f=!0,T.selected=y[4],add_flush_callback(()=>f=!1)),u.$set(T)},i(y){h||(transition_in(u.$$.fragment,y),h=!0)},o(y){transition_out(u.$$.fragment,y),h=!1},d(y){y&&detach(t),destroy_component(u),p=!1,g()}}}function create_if_block$f(i){let t,n,s;return n=new FirstConnect({}),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","hsmd-wrap svelte-5qzo08")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p:noop$2,i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_default_slot_3$1(i){let t,n,s,o,r,l;return t=new Tab$1({props:{label:"Channels"}}),s=new Tab$1({props:{label:"Invoices"}}),r=new Tab$1({props:{label:"Onchain"}}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment),o=space(),create_component(r.$$.fragment)},m(a,c){mount_component(t,a,c),insert(a,n,c),mount_component(s,a,c),insert(a,o,c),mount_component(r,a,c),l=!0},p:noop$2,i(a){l||(transition_in(t.$$.fragment,a),transition_in(s.$$.fragment,a),transition_in(r.$$.fragment,a),l=!0)},o(a){transition_out(t.$$.fragment,a),transition_out(s.$$.fragment,a),transition_out(r.$$.fragment,a),l=!1},d(a){destroy_component(t,a),a&&detach(n),destroy_component(s,a),a&&detach(o),destroy_component(r,a)}}}function create_default_slot_2$1(i){let t,n;return t=new Channels({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot_1$2(i){let t,n;return t=new Invoices({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_default_slot$6(i){let t,n;return t=new Onchain({props:{tag:i[0],type:i[1]}}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&1&&(r.tag=s[0]),o&2&&(r.type=s[1]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_content_slot(i){let t,n,s,o,r,l;return t=new TabContent$1({props:{$$slots:{default:[create_default_slot_2$1]},$$scope:{ctx:i}}}),s=new TabContent$1({props:{$$slots:{default:[create_default_slot_1$2]},$$scope:{ctx:i}}}),r=new TabContent$1({props:{$$slots:{default:[create_default_slot$6]},$$scope:{ctx:i}}}),{c(){create_component(t.$$.fragment),n=space(),create_component(s.$$.fragment),o=space(),create_component(r.$$.fragment)},m(a,c){mount_component(t,a,c),insert(a,n,c),mount_component(s,a,c),insert(a,o,c),mount_component(r,a,c),l=!0},p(a,c){const u={};c&4099&&(u.$$scope={dirty:c,ctx:a}),t.$set(u);const f={};c&4099&&(f.$$scope={dirty:c,ctx:a}),s.$set(f);const h={};c&4099&&(h.$$scope={dirty:c,ctx:a}),r.$set(h)},i(a){l||(transition_in(t.$$.fragment,a),transition_in(s.$$.fragment,a),transition_in(r.$$.fragment,a),l=!0)},o(a){transition_out(t.$$.fragment,a),transition_out(s.$$.fragment,a),transition_out(r.$$.fragment,a),l=!1},d(a){destroy_component(t,a),a&&detach(n),destroy_component(s,a),a&&detach(o),destroy_component(r,a)}}}function create_fragment$p(i){let t,n,s,o;const r=[create_if_block$f,create_else_block$c],l=[];function a(c,u){return c[5]?0:1}return t=a(i),n=l[t]=r[t](i),{c(){n.c(),s=empty$1()},m(c,u){l[t].m(c,u),insert(c,s,u),o=!0},p(c,[u]){let f=t;t=a(c),t===f?l[t].p(c,u):(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),n=l[t],n?n.p(c,u):(n=l[t]=r[t](c),n.c()),transition_in(n,1),n.m(s.parentNode,s))},i(c){o||(transition_in(n),o=!0)},o(c){transition_out(n),o=!1},d(c){l[t].d(c),c&&detach(s)}}}function instance$o(i,t,n){let s,o,r,l,a,c;component_subscribe(i,selectedNode,v=>n(7,r=v)),component_subscribe(i,finishedOnboarding,v=>n(8,l=v)),component_subscribe(i,isOnboarding,v=>n(10,a=v)),component_subscribe(i,hsmd,v=>n(5,c=v));let{tag:u=""}=t,{type:f=""}=t;function h(){a&&(l.hasBalance?l.hasBalance&&!l.hasChannels&&n(4,s=0):n(4,s=2))}let p=!1;function g(){navigator.clipboard.writeText(o),n(2,p=!0),setTimeout(()=>n(2,p=!1),150)}onMount(async()=>{if(f==="Cln"){const v=await get_clients(u);v&&hsmdClients.set(v)}});function b(v){s=v,n(4,s)}return i.$$set=v=>{"tag"in v&&n(0,u=v.tag),"type"in v&&n(1,f=v.type)},i.$$.update=()=>{i.$$.dirty&256&&h(),i.$$.dirty&128&&console.log(r),i.$$.dirty&128&&n(3,o=r!=null&&r.host?`${r==null?void 0:r.host}:${r.peer_port}`:`${r.name}.sphinx:${r.peer_port}`)},n(4,s=0),[u,f,p,o,s,c,g,r,l,b]}class Lnd extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$o,create_fragment$p,safe_not_equal,{tag:0,type:1})}}const BitcoinMine_svelte_svelte_type_style_lang="";function create_default_slot$5(i){let t;return{c(){t=text("Mine blocks")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_fragment$o(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A;return S=new Button$1({props:{size:"field",icon:VirtualMachine,$$slots:{default:[create_default_slot$5]},$$scope:{ctx:i}}}),S.$on("click",i[2]),{c(){t=element("section"),n=element("aside"),s=element("section"),o=element("label"),o.textContent="Blocks",r=space(),l=element("input"),a=space(),c=element("aside"),u=space(),f=element("section"),h=element("label"),h.textContent="Address (Optional)",p=space(),g=element("input"),b=space(),v=element("aside"),y=space(),create_component(S.$$.fragment),attr(o,"for","blocks"),attr(o,"class","svelte-ziyxk9"),attr(l,"type","number"),attr(l,"placeholder","Enter number of blocks"),attr(l,"class","svelte-ziyxk9"),attr(s,"class","input-wrap svelte-ziyxk9"),attr(c,"class","spacer"),attr(h,"for","blocks"),attr(h,"class","svelte-ziyxk9"),attr(g,"placeholder","Enter Bitcoin address (optional)"),attr(g,"class","svelte-ziyxk9"),attr(f,"class","input-wrap svelte-ziyxk9"),attr(v,"class","spacer"),attr(n,"class","mine-wrap svelte-ziyxk9"),attr(t,"class","mine-blocks-btn")},m(x,C){insert(x,t,C),append(t,n),append(n,s),append(s,o),append(s,r),append(s,l),set_input_value(l,i[1]),append(n,a),append(n,c),append(n,u),append(n,f),append(f,h),append(f,p),append(f,g),set_input_value(g,i[0]),append(n,b),append(n,v),append(n,y),mount_component(S,n,null),T=!0,w||(A=[listen(l,"input",i[4]),listen(g,"input",i[5])],w=!0)},p(x,[C]){C&2&&to_number(l.value)!==x[1]&&set_input_value(l,x[1]),C&1&&g.value!==x[0]&&set_input_value(g,x[0]);const I={};C&64&&(I.$$scope={dirty:C,ctx:x}),S.$set(I)},i(x){T||(transition_in(S.$$.fragment,x),T=!0)},o(x){transition_out(S.$$.fragment,x),T=!1},d(x){x&&detach(t),destroy_component(S),w=!1,run_all(A)}}}function instance$n(i,t,n){let s,o,{tag:r=""}=t;async function l(){await test_mine(r,s,o||null)&&(n(1,s=6),n(0,o=""),btcinfo.set(await get_info$2(r)),walletBalance.set(await get_balance$1(r)))}function a(){s=to_number(this.value),n(1,s)}function c(){o=this.value,n(0,o)}return i.$$set=u=>{"tag"in u&&n(3,r=u.tag)},n(1,s=6),n(0,o=""),[o,s,l,r,a,c]}class BitcoinMine extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$n,create_fragment$o,safe_not_equal,{tag:3})}}const Bitcoin_svelte_svelte_type_style_lang="";function create_if_block_1$9(i){let t,n,s,o,r=i[3].chain+"",l,a,c,u,f,h,p=i[3].blocks+"",g,b,v,y,S,T,w=i[3].headers+"",A,x,C,I,M=i[3].chain==="regtest"&&create_if_block_2$7(i);return{c(){t=element("section"),n=element("h3"),n.textContent="NETWORK",s=space(),o=element("h3"),l=text(r),a=space(),c=element("section"),u=element("h3"),u.textContent="BLOCK HEIGHT",f=space(),h=element("h3"),g=text(p),b=space(),v=element("section"),y=element("h3"),y.textContent="BLOCK HEADERS",S=space(),T=element("h3"),A=text(w),x=space(),M&&M.c(),C=empty$1(),attr(n,"class","title"),attr(o,"class","value"),attr(t,"class","value-wrap"),attr(u,"class","title"),attr(h,"class","value"),attr(c,"class","value-wrap"),attr(y,"class","title"),attr(T,"class","value"),attr(v,"class","value-wrap")},m(E,L){insert(E,t,L),append(t,n),append(t,s),append(t,o),append(o,l),insert(E,a,L),insert(E,c,L),append(c,u),append(c,f),append(c,h),append(h,g),insert(E,b,L),insert(E,v,L),append(v,y),append(v,S),append(v,T),append(T,A),insert(E,x,L),M&&M.m(E,L),insert(E,C,L),I=!0},p(E,L){(!I||L&8)&&r!==(r=E[3].chain+"")&&set_data(l,r),(!I||L&8)&&p!==(p=E[3].blocks+"")&&set_data(g,p),(!I||L&8)&&w!==(w=E[3].headers+"")&&set_data(A,w),E[3].chain==="regtest"?M?(M.p(E,L),L&8&&transition_in(M,1)):(M=create_if_block_2$7(E),M.c(),transition_in(M,1),M.m(C.parentNode,C)):M&&(group_outros(),transition_out(M,1,1,()=>{M=null}),check_outros())},i(E){I||(transition_in(M),I=!0)},o(E){transition_out(M),I=!1},d(E){E&&detach(t),E&&detach(a),E&&detach(c),E&&detach(b),E&&detach(v),E&&detach(x),M&&M.d(E),E&&detach(C)}}}function create_if_block$e(i){let t;return{c(){t=element("div"),t.innerHTML="
Loading Bitcoin Info .....
",attr(t,"class","loading-wrap")},m(n,s){insert(n,t,s)},p:noop$2,i:noop$2,o:noop$2,d(n){n&&detach(t)}}}function create_if_block_2$7(i){let t,n,s,o,r=formatSatsNumbers(convertBtcToSats(i[2]))+"",l,a,c,u,f;return u=new BitcoinMine({props:{tag:i[0]}}),{c(){t=element("section"),n=element("h3"),n.textContent="WALLET BALANCE",s=space(),o=element("h3"),l=text(r),a=text(" Sats"),c=space(),create_component(u.$$.fragment),attr(n,"class","title"),attr(o,"class","value"),attr(t,"class","value-wrap")},m(h,p){insert(h,t,p),append(t,n),append(t,s),append(t,o),append(o,l),append(o,a),insert(h,c,p),mount_component(u,h,p),f=!0},p(h,p){(!f||p&4)&&r!==(r=formatSatsNumbers(convertBtcToSats(h[2]))+"")&&set_data(l,r);const g={};p&1&&(g.tag=h[0]),u.$set(g)},i(h){f||(transition_in(u.$$.fragment,h),f=!0)},o(h){transition_out(u.$$.fragment,h),f=!1},d(h){h&&detach(t),h&&detach(c),destroy_component(u,h)}}}function create_fragment$n(i){let t,n,s,o,r,l,a,c;const u=[create_if_block$e,create_if_block_1$9],f=[];function h(p,g){return p[1]?0:p[3]?1:-1}return~(l=h(i))&&(a=f[l]=u[l](i)),{c(){t=element("div"),n=element("h5"),n.textContent="Bitcoin Info",s=space(),o=element("div"),r=space(),a&&a.c(),attr(n,"class","info svelte-145wwyl"),attr(o,"class","spacer"),attr(t,"class","bitcoin-wrapper svelte-145wwyl")},m(p,g){insert(p,t,g),append(t,n),append(t,s),append(t,o),append(t,r),~l&&f[l].m(t,null),c=!0},p(p,[g]){let b=l;l=h(p),l===b?~l&&f[l].p(p,g):(a&&(group_outros(),transition_out(f[b],1,1,()=>{f[b]=null}),check_outros()),~l?(a=f[l],a?a.p(p,g):(a=f[l]=u[l](p),a.c()),transition_in(a,1),a.m(t,null)):a=null)},i(p){c||(transition_in(a),c=!0)},o(p){transition_out(a),c=!1},d(p){p&&detach(t),~l&&f[l].d()}}}function instance$m(i,t,n){let s,o;component_subscribe(i,walletBalance,u=>n(2,s=u)),component_subscribe(i,btcinfo,u=>n(3,o=u));let{tag:r=""}=t,l=!0;async function a(){if(n(1,l=!0),o&&o.blocks){n(1,l=!1);return}const u=await get_info$2(r);u&&btcinfo.set(u),n(1,l=!1)}async function c(){s||walletBalance.set(await get_balance$1(r))}return onMount(()=>{a(),c()}),i.$$set=u=>{"tag"in u&&n(0,r=u.tag)},[r,l,s,o]}class Bitcoin extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$m,create_fragment$n,safe_not_equal,{tag:0})}}async function proxyCmd(i,t,n){return await send_cmd("Proxy",{cmd:i,content:n},t)}async function get_proxy_balances(i){return await proxyCmd("GetBalance",i)}const Proxy_svelte_svelte_type_style_lang="";function create_if_block$d(i){let t,n,s,o,r=(i[0].user_count??0)+"",l,a,c,u,f,h,p=formatMillisatsToSats(i[0].total)+"",g;return{c(){t=element("section"),n=element("h3"),n.textContent="TOTAL USERS",s=space(),o=element("h3"),l=text(r),a=space(),c=element("section"),u=element("h3"),u.textContent="TOTAL SATS BALANCE",f=space(),h=element("h3"),g=text(p),attr(n,"class","title svelte-d6g9cn"),attr(o,"class","value svelte-d6g9cn"),attr(t,"class","value-wrap svelte-d6g9cn"),attr(u,"class","title svelte-d6g9cn"),attr(h,"class","value svelte-d6g9cn"),attr(c,"class","value-wrap svelte-d6g9cn")},m(b,v){insert(b,t,v),append(t,n),append(t,s),append(t,o),append(o,l),insert(b,a,v),insert(b,c,v),append(c,u),append(c,f),append(c,h),append(h,g)},p(b,v){v&1&&r!==(r=(b[0].user_count??0)+"")&&set_data(l,r),v&1&&p!==(p=formatMillisatsToSats(b[0].total)+"")&&set_data(g,p)},d(b){b&&detach(t),b&&detach(a),b&&detach(c)}}}function create_fragment$m(i){let t,n,s,o,r,l=i[0]&&create_if_block$d(i);return{c(){t=element("div"),n=element("h5"),n.textContent="Proxy Stats",s=space(),o=element("div"),r=space(),l&&l.c(),attr(n,"class","info svelte-d6g9cn"),attr(o,"class","spacer"),attr(t,"class","proxy-wrapper svelte-d6g9cn")},m(a,c){insert(a,t,c),append(t,n),append(t,s),append(t,o),append(t,r),l&&l.m(t,null)},p(a,[c]){a[0]?l?l.p(a,c):(l=create_if_block$d(a),l.c(),l.m(t,null)):l&&(l.d(1),l=null)},i:noop$2,o:noop$2,d(a){a&&detach(t),l&&l.d()}}}function instance$l(i,t,n){let s;component_subscribe(i,proxy,l=>n(0,s=l));let{tag:o=""}=t;async function r(){if(s.total&&s.user_count)return;const l=await get_proxy_balances(o);l&&proxy.set(l)}return onMount(()=>{r()}),i.$$set=l=>{"tag"in l&&n(1,o=l.tag)},[s,o]}let Proxy$1=class extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$l,create_fragment$m,safe_not_equal,{tag:1})}};const NavFiberAdmin_svelte_svelte_type_style_lang="",Endpoint_svelte_svelte_type_style_lang="";function create_fragment$l(i){let t,n,s,o,r,l,a,c,u;function f(p){i[5](p)}let h={size:"default",labelA:"",labelB:"",disabled:i[2]};return i[0]!==void 0&&(h.toggled=i[0]),a=new Toggle$1({props:h}),binding_callbacks.push(()=>bind(a,"toggled",f,i[0])),a.$on("toggle",i[6]),{c(){t=element("div"),n=element("div"),s=element("p"),o=text(i[1]),r=space(),l=element("div"),create_component(a.$$.fragment),attr(s,"class","endpoint-description svelte-19fzps1"),toggle_class(s,"active",i[0]),attr(l,"class","toggle-container svelte-19fzps1"),attr(n,"class","endpoint-container svelte-19fzps1"),attr(t,"class","container")},m(p,g){insert(p,t,g),append(t,n),append(n,s),append(s,o),append(n,r),append(n,l),mount_component(a,l,null),u=!0},p(p,[g]){(!u||g&2)&&set_data(o,p[1]),(!u||g&1)&&toggle_class(s,"active",p[0]);const b={};g&4&&(b.disabled=p[2]),!c&&g&1&&(c=!0,b.toggled=p[0],add_flush_callback(()=>c=!1)),a.$set(b)},i(p){u||(transition_in(a.$$.fragment,p),u=!0)},o(p){transition_out(a.$$.fragment,p),u=!1},d(p){p&&detach(t),destroy_component(a)}}}function instance$k(i,t,n){let s,o,{id:r}=t,{description:l=""}=t,{toggled:a=!1}=t;const c=createEventDispatcher();function u(g){c("customEvent",g)}async function f(g){n(2,s=!0);for(let b=0;b{f(g.detail.toggled)};return i.$$set=g=>{"id"in g&&n(4,r=g.id),"description"in g&&n(1,l=g.description),"toggled"in g&&n(0,a=g.toggled)},n(2,s=!1),o=!1,[a,l,s,f,r,h,p]}class Endpoint extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$k,create_fragment$l,safe_not_equal,{id:4,description:1,toggled:0})}}const EnpointPermission_svelte_svelte_type_style_lang="";function get_each_context$6(i,t,n){const s=i.slice();return s[4]=t[n],s[6]=n,s}function create_if_block$c(i){let t;return{c(){t=element("div"),t.innerHTML=`success

Endpoint Updated

`,attr(t,"class","success_container svelte-ccr49g")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_each_block$6(i,t){let n,s,o;return s=new Endpoint({props:{description:t[4].route_description,toggled:t[4].status,id:t[4].id}}),s.$on("customEvent",t[2]),{key:i,first:null,c(){n=empty$1(),create_component(s.$$.fragment),this.first=n},m(r,l){insert(r,n,l),mount_component(s,r,l),o=!0},p(r,l){t=r;const a={};l&2&&(a.description=t[4].route_description),l&2&&(a.toggled=t[4].status),l&2&&(a.id=t[4].id),s.$set(a)},i(r){o||(transition_in(s.$$.fragment,r),o=!0)},o(r){transition_out(s.$$.fragment,r),o=!1},d(r){r&&detach(n),destroy_component(s,r)}}}function create_fragment$k(i){let t,n,s,o,r,l=[],a=new Map,c,u=i[0]&&create_if_block$c(),f=i[1];const h=p=>p[4].route_description;for(let p=0;p{n(0,o=!1)},5e3)}return onMount(async()=>{await r()}),n(1,s=[]),n(0,o=!1),[o,s,l]}class EnpointPermission extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$j,create_fragment$k,safe_not_equal,{})}}const general_svelte_svelte_type_style_lang="";function get_each_context$5(i,t,n){const s=i.slice();return s[19]=t[n],s}function create_if_block_3$5(i){let t,n,s;return{c(){t=element("button"),t.textContent="Discard",attr(t,"class","discard-button svelte-bzi9wz")},m(o,r){insert(o,t,r),n||(s=listen(t,"click",i[7]),n=!0)},p:noop$2,d(o){o&&detach(t),n=!1,s()}}}function create_if_block_1$8(i){let t,n,s,o;function r(c,u){return c[1]===!0?create_if_block_2$6:create_else_block$b}let l=r(i),a=l(i);return{c(){t=element("button"),a.c(),t.disabled=n=!i[3],attr(t,"class","save-button svelte-bzi9wz")},m(c,u){insert(c,t,u),a.m(t,null),s||(o=listen(t,"click",i[8]),s=!0)},p(c,u){l!==(l=r(c))&&(a.d(1),a=l(c),a&&(a.c(),a.m(t,null))),u&8&&n!==(n=!c[3])&&(t.disabled=n)},d(c){c&&detach(t),a.d(),s=!1,o()}}}function create_else_block$b(i){let t;return{c(){t=text("Save Changes")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_2$6(i){let t;return{c(){t=element("div"),attr(t,"class","loading-spinner svelte-bzi9wz")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block$b(i){let t;return{c(){t=element("div"),t.innerHTML=`success

Changes Saved

`,attr(t,"class","success_container svelte-bzi9wz")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_each_block$5(i){let t,n,s,o,r,l,a=i[19].label+"",c,u,f,h=i[19].description+"",p,g,b,v;function y(...S){return i[11](i[19],...S)}return{c(){t=element("div"),n=element("input"),o=space(),r=element("div"),l=element("h4"),c=text(a),u=space(),f=element("p"),p=text(h),g=space(),attr(n,"type","checkbox"),attr(n,"class","checkbox svelte-bzi9wz"),n.checked=s=i[0][i[19].key].value,attr(l,"class","checkout-label svelte-bzi9wz"),attr(f,"class","checkout-label-description svelte-bzi9wz"),attr(r,"class","checkout-label-container svelte-bzi9wz"),attr(t,"class","checkbox-container svelte-bzi9wz")},m(S,T){insert(S,t,T),append(t,n),append(t,o),append(t,r),append(r,l),append(l,c),append(r,u),append(r,f),append(f,p),append(t,g),b||(v=listen(n,"click",y),b=!0)},p(S,T){i=S,T&1&&s!==(s=i[0][i[19].key].value)&&(n.checked=s)},d(S){S&&detach(t),b=!1,v()}}}function create_fragment$j(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M=i[1]===!1&&i[3]===!0&&i[2]===!1&&create_if_block_3$5(i),E=i[2]===!1&&create_if_block_1$8(i),L=i[2]===!0&&create_if_block$b(),R=i[4],O=[];for(let B=0;BPublic -

Toggle to make the graph public or private.

`,x=space();for(let B=0;B{n(2,a=!1)},5e3)}catch{n(1,o=!1)}}onMount(async()=>{const x=await get_second_brain_about_details(),C=await JSON.parse(x);l={...C};const I=await get_feature_flag(),M=JSON.parse(I),E=await get_graph_accessibility(),L=JSON.parse(E);r={public:{value:L.data.isPublic,method:async R=>g(R)},graph_name:{value:C.title,method:async R=>b(R)},trendingTopics:{value:M.data.trendingTopics.user},addItem:{value:M.data.addItem.user},addContent:{value:M.data.addContent.user},settings:{value:M.data.settings.user},chatInterface:{value:M.data.chatInterface.user}},n(0,c={public:{value:L.data.isPublic,isChange:!1},graph_name:{value:C.title,isChange:!1},trendingTopics:{value:M.data.trendingTopics.user,isChange:!1},addContent:{value:M.data.addContent.user,isChange:!1},addItem:{value:M.data.addItem.user,isChange:!1},settings:{value:M.data.settings.user,isChange:!1},chatInterface:{value:M.data.chatInterface.user,isChange:!1}})});function T(){c.graph_name.value=this.value,n(0,c)}const w=x=>f(x,"public"),A=(x,C)=>f(C,x.key);return n(3,s=!1),n(1,o=!1),r={graph_name:{value:"",method:async x=>b(x)},trendingTopics:{value:!0},public:{value:!0,method:async x=>g(x)},addItem:{value:!0},addContent:{value:!0},settings:{value:!0},chatInterface:{value:!0}},l={},n(2,a=!1),n(0,c={graph_name:{value:"",isChange:!1},trendingTopics:{value:!0,isChange:!1},public:{value:!0,isChange:!1},addItem:{value:!0,isChange:!1},addContent:{value:!0,isChange:!1},settings:{value:!0,isChange:!1},chatInterface:{value:!0,isChange:!1}}),[c,o,a,s,u,f,p,v,S,T,w,A]}class General extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$i,create_fragment$j,safe_not_equal,{})}}const setSuperAdmin_svelte_svelte_type_style_lang="";function create_else_block_1$1(i){let t;return{c(){t=text("Submit")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_2$5(i){let t;return{c(){t=element("div"),attr(t,"class","loading-spinner svelte-nqxly1")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_else_block$a(i){let t;return{c(){t=element("div"),t.innerHTML='Connect With Sphinx',attr(t,"class","sphinx_link svelte-nqxly1")},m(n,s){insert(n,t,s)},p:noop$2,d(n){n&&detach(t)}}}function create_if_block_1$7(i){let t,n,s,o;return{c(){t=element("a"),n=element("img"),o=text("Connect With Sphinx"),src_url_equal(n.src,s="swarm/sphinx_logo.svg")||attr(n,"src",s),attr(n,"alt","sphinx"),attr(n,"class","sphinx_logo svelte-nqxly1"),attr(t,"href",i[5]),attr(t,"class","sphinx_link svelte-nqxly1")},m(r,l){insert(r,t,l),append(t,n),append(t,o)},p(r,l){l&32&&attr(t,"href",r[5])},d(r){r&&detach(t)}}}function create_if_block$a(i){let t;return{c(){t=element("div"),t.innerHTML='
',attr(t,"class","sphinx_loading-spinner_container svelte-nqxly1")},m(n,s){insert(n,t,s)},p:noop$2,d(n){n&&detach(t)}}}function create_fragment$i(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M,E,L,R,O,B,z,F,q,N;function ee(le){i[12](le)}let K={label:"Username",placeholder:"Enter Username ...",onInput:i[9]};i[1]!==void 0&&(K.value=i[1]),h=new Input({props:K}),binding_callbacks.push(()=>bind(h,"value",ee,i[1]));function Q(le){i[13](le)}let J={label:"Pubkey",placeholder:"Enter Admin Pubkey ...",onInput:i[7]};i[0]!==void 0&&(J.value=i[0]),b=new Input({props:J}),binding_callbacks.push(()=>bind(b,"value",Q,i[0]));function Y(le,Le){return le[3]===!0?create_if_block_2$5:create_else_block_1$1}let ce=Y(i),Z=ce(i);function ge(le){i[14](le)}let se={label:"Username",placeholder:"Enter Username ...",onInput:i[8]};i[2]!==void 0&&(se.value=i[2]),M=new Input({props:se}),binding_callbacks.push(()=>bind(M,"value",ge,i[2]));function re(le,Le){return le[6]?create_if_block$a:le[2]?create_if_block_1$7:create_else_block$a}let me=re(i),fe=me(i);return{c(){t=element("div"),n=element("div"),s=element("div"),s.innerHTML='Admin',o=space(),r=element("h2"),r.textContent="Set Admin",l=space(),a=element("p"),a.textContent="Set Admin for the Second Brain",c=space(),u=element("div"),f=element("div"),create_component(h.$$.fragment),g=space(),create_component(b.$$.fragment),y=space(),S=element("div"),T=element("button"),Z.c(),A=space(),x=element("div"),x.innerHTML=`
+

Toggle to make the graph public or private.

`,x=space();for(let B=0;B{n(2,a=!1)},5e3)}catch{n(1,o=!1)}}onMount(async()=>{const x=await get_second_brain_about_details(),C=await JSON.parse(x);l={...C};const I=await get_feature_flag(),M=JSON.parse(I),E=await get_graph_accessibility(),L=JSON.parse(E);r={public:{value:L.data.isPublic,method:async R=>g(R)},graph_name:{value:C.title,method:async R=>b(R)},trendingTopics:{value:M.data.trendingTopics.user},addItem:{value:M.data.addItem.user},addContent:{value:M.data.addContent.user},settings:{value:M.data.settings.user},chatInterface:{value:M.data.chatInterface.user}},n(0,c={public:{value:L.data.isPublic,isChange:!1},graph_name:{value:C.title,isChange:!1},trendingTopics:{value:M.data.trendingTopics.user,isChange:!1},addContent:{value:M.data.addContent.user,isChange:!1},addItem:{value:M.data.addItem.user,isChange:!1},settings:{value:M.data.settings.user,isChange:!1},chatInterface:{value:M.data.chatInterface.user,isChange:!1}})});function T(){c.graph_name.value=this.value,n(0,c)}const w=x=>f(x,"public"),A=(x,C)=>f(C,x.key);return n(3,s=!1),n(1,o=!1),r={graph_name:{value:"",method:async x=>b(x)},trendingTopics:{value:!0},public:{value:!0,method:async x=>g(x)},addItem:{value:!0},addContent:{value:!0},settings:{value:!0},chatInterface:{value:!0}},l={},n(2,a=!1),n(0,c={graph_name:{value:"",isChange:!1},trendingTopics:{value:!0,isChange:!1},public:{value:!0,isChange:!1},addItem:{value:!0,isChange:!1},addContent:{value:!0,isChange:!1},settings:{value:!0,isChange:!1},chatInterface:{value:!0,isChange:!1}}),[c,o,a,s,u,f,p,v,S,T,w,A]}class General extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$i,create_fragment$j,safe_not_equal,{})}}const setSuperAdmin_svelte_svelte_type_style_lang="";function create_else_block_1$1(i){let t;return{c(){t=text("Submit")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_2$5(i){let t;return{c(){t=element("div"),attr(t,"class","loading-spinner svelte-nqxly1")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_else_block$a(i){let t;return{c(){t=element("div"),t.innerHTML='Connect With Sphinx',attr(t,"class","sphinx_link svelte-nqxly1")},m(n,s){insert(n,t,s)},p:noop$2,d(n){n&&detach(t)}}}function create_if_block_1$7(i){let t,n,s,o;return{c(){t=element("a"),n=element("img"),o=text("Connect With Sphinx"),src_url_equal(n.src,s="swarm/sphinx_logo.svg")||attr(n,"src",s),attr(n,"alt","sphinx"),attr(n,"class","sphinx_logo svelte-nqxly1"),attr(t,"href",i[5]),attr(t,"class","sphinx_link svelte-nqxly1")},m(r,l){insert(r,t,l),append(t,n),append(t,o)},p(r,l){l&32&&attr(t,"href",r[5])},d(r){r&&detach(t)}}}function create_if_block$a(i){let t;return{c(){t=element("div"),t.innerHTML='
',attr(t,"class","sphinx_loading-spinner_container svelte-nqxly1")},m(n,s){insert(n,t,s)},p:noop$2,d(n){n&&detach(t)}}}function create_fragment$i(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M,E,L,R,O,B,z,F,q,N;function ee(le){i[12](le)}let K={label:"Username",placeholder:"Enter Username ...",onInput:i[9]};i[1]!==void 0&&(K.value=i[1]),h=new Input({props:K}),binding_callbacks.push(()=>bind(h,"value",ee,i[1]));function Q(le){i[13](le)}let J={label:"Pubkey",placeholder:"Enter Admin Pubkey ...",onInput:i[7],isPubkey:!0};i[0]!==void 0&&(J.value=i[0]),b=new Input({props:J}),binding_callbacks.push(()=>bind(b,"value",Q,i[0]));function Y(le,Le){return le[3]===!0?create_if_block_2$5:create_else_block_1$1}let ce=Y(i),Z=ce(i);function ge(le){i[14](le)}let se={label:"Username",placeholder:"Enter Username ...",onInput:i[8]};i[2]!==void 0&&(se.value=i[2]),M=new Input({props:se}),binding_callbacks.push(()=>bind(M,"value",ge,i[2]));function re(le,Le){return le[6]?create_if_block$a:le[2]?create_if_block_1$7:create_else_block$a}let me=re(i),fe=me(i);return{c(){t=element("div"),n=element("div"),s=element("div"),s.innerHTML='Admin',o=space(),r=element("h2"),r.textContent="Set Admin",l=space(),a=element("p"),a.textContent="Set Admin for the Second Brain",c=space(),u=element("div"),f=element("div"),create_component(h.$$.fragment),g=space(),create_component(b.$$.fragment),y=space(),S=element("div"),T=element("button"),Z.c(),A=space(),x=element("div"),x.innerHTML=`

OR

-
`,C=space(),I=element("div"),create_component(M.$$.fragment),L=space(),R=element("button"),fe.c(),B=space(),z=element("p"),z.textContent="To set Yourself as Superadmin",attr(s,"class","image_container svelte-nqxly1"),attr(r,"class","heading svelte-nqxly1"),attr(a,"class","description svelte-nqxly1"),attr(f,"class","inputs_container svelte-nqxly1"),T.disabled=w=i[3]||!i[0],attr(T,"class","submit_btn svelte-nqxly1"),attr(S,"class","submit_btn_container svelte-nqxly1"),attr(x,"class","alt_info svelte-nqxly1"),R.disabled=O=!i[4]||!i[5]||i[6]||!i[2],attr(R,"class","sphinx_btn svelte-nqxly1"),attr(z,"class","sphinx_text svelte-nqxly1"),attr(I,"class","sphinx_btn_container svelte-nqxly1"),attr(u,"class","form_container svelte-nqxly1"),attr(n,"class","inner_container svelte-nqxly1"),attr(t,"class","container svelte-nqxly1")},m(le,Le){insert(le,t,Le),append(t,n),append(n,s),append(n,o),append(n,r),append(n,l),append(n,a),append(n,c),append(n,u),append(u,f),mount_component(h,f,null),append(f,g),mount_component(b,f,null),append(u,y),append(u,S),append(S,T),Z.m(T,null),append(u,A),append(u,x),append(u,C),append(u,I),mount_component(M,I,null),append(I,L),append(I,R),fe.m(R,null),append(I,B),append(I,z),F=!0,q||(N=[listen(T,"click",i[10]),listen(R,"click",i[11])],q=!0)},p(le,[Le]){const V={};!p&&Le&2&&(p=!0,V.value=le[1],add_flush_callback(()=>p=!1)),h.$set(V);const W={};!v&&Le&1&&(v=!0,W.value=le[0],add_flush_callback(()=>v=!1)),b.$set(W),ce!==(ce=Y(le))&&(Z.d(1),Z=ce(le),Z&&(Z.c(),Z.m(T,null))),(!F||Le&9&&w!==(w=le[3]||!le[0]))&&(T.disabled=w);const j={};!E&&Le&4&&(E=!0,j.value=le[2],add_flush_callback(()=>E=!1)),M.$set(j),me===(me=re(le))&&fe?fe.p(le,Le):(fe.d(1),fe=me(le),fe&&(fe.c(),fe.m(R,null))),(!F||Le&116&&O!==(O=!le[4]||!le[5]||le[6]||!le[2]))&&(R.disabled=O)},i(le){F||(transition_in(h.$$.fragment,le),transition_in(b.$$.fragment,le),transition_in(M.$$.fragment,le),F=!0)},o(le){transition_out(h.$$.fragment,le),transition_out(b.$$.fragment,le),transition_out(M.$$.fragment,le),F=!1},d(le){le&&detach(t),destroy_component(h),destroy_component(b),Z.d(),destroy_component(M),fe.d(),q=!1,run_all(N)}}}function instance$h(i,t,n){let s,o,r,l;component_subscribe(i,activeUser,C=>n(16,l=C));let a="",c="",u="",f=!1,h;function p(C){n(0,a=C)}function g(C){n(2,u=C)}function b(C){n(1,c=C)}async function v(){try{n(3,f=!0);const C=await add_boltwall_admin_pubkey(a,c),I=await update_admin_pubkey(a,l);boltwallSuperAdminPubkey.set(a),n(0,a=""),n(1,c=""),n(3,f=!1)}catch(C){n(3,f=!1),console.log(`ERROR SETTING BOLTWALL SUPER ADMIN: ${JSON.stringify(C)}`)}}async function y(){let C=0;h=setInterval(async()=>{try{const I=await get_signup_challenge_status(s,u,l);I.success?(n(4,s=""),boltwallSuperAdminPubkey.set(I.pubkey),n(6,r=!1),h&&clearInterval(h)):I.message!=="not yet verified"&&(console.log(I.message),n(6,r=!1),h&&clearInterval(h)),C++,C>100&&(n(6,r=!1),h&&clearInterval(h))}catch(I){n(6,r=!1),console.log("Auth interval error",I)}},3e3)}async function S(C){try{n(6,r=!0),y()}catch{n(6,r=!1)}}async function T(){const C=await get_signup_challenge(l);n(4,s=C.challenge),n(5,o=contructQrString(s))}onMount(async()=>{try{await T()}catch(C){console.log("Error setting up sign up challenge: ",JSON.stringify(C))}}),onDestroy(()=>{h&&clearInterval(h)});function w(C){c=C,n(1,c)}function A(C){a=C,n(0,a)}function x(C){u=C,n(2,u)}return n(4,s=""),n(5,o=""),n(6,r=!1),[a,c,u,f,s,o,r,p,g,b,v,S,w,A,x]}class SetSuperAdmin extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$h,create_fragment$i,safe_not_equal,{})}}const modal_svelte_svelte_type_style_lang="";function create_fragment$h(i){let t,n,s,o,r,l;const a=i[4].default,c=create_slot(a,i,i[3],null);return{c(){t=element("div"),n=element("div"),c&&c.c(),attr(n,"class","modal-content svelte-cdyc7e"),attr(t,"class","modal svelte-cdyc7e"),attr(t,"style",s=i[0]?"display: flex;":"display: none;")},m(u,f){insert(u,t,f),append(t,n),c&&c.m(n,null),o=!0,r||(l=[listen(n,"click",preventPropagation),listen(t,"click",i[1])],r=!0)},p(u,[f]){c&&c.p&&(!o||f&8)&&update_slot_base(c,a,u,u[3],o?get_slot_changes(a,u[3],f,null):get_all_dirty_from_scope(u[3]),null),(!o||f&1&&s!==(s=u[0]?"display: flex;":"display: none;"))&&attr(t,"style",s)},i(u){o||(transition_in(c,u),o=!0)},o(u){transition_out(c,u),o=!1},d(u){u&&detach(t),c&&c.d(u),r=!1,run_all(l)}}}function preventPropagation(i){i.stopPropagation()}function instance$g(i,t,n){let{$$slots:s={},$$scope:o}=t,{isOpen:r}=t,{onClose:l}=t;function a(c){l()}return i.$$set=c=>{"isOpen"in c&&n(0,r=c.isOpen),"onClose"in c&&n(2,l=c.onClose),"$$scope"in c&&n(3,o=c.$$scope)},[r,a,l,o,s]}class Modal extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$g,create_fragment$h,safe_not_equal,{isOpen:0,onClose:2})}}const select_svelte_svelte_type_style_lang="";function get_each_context$4(i,t,n){const s=i.slice();return s[6]=t[n],s}function create_each_block$4(i){let t,n=i[6].label+"",s,o;return{c(){t=element("option"),s=text(n),t.__value=o=i[6].value,t.value=t.__value,attr(t,"class","svelte-1hg8ukd")},m(r,l){insert(r,t,l),append(t,s)},p(r,l){l&2&&n!==(n=r[6].label+"")&&set_data(s,n),l&2&&o!==(o=r[6].value)&&(t.__value=o,t.value=t.__value)},d(r){r&&detach(t)}}}function create_fragment$g(i){let t,n,s,o,r,l,a,c,u,f,h,p=i[1],g=[];for(let b=0;bi[5].call(l)),src_url_equal(c.src,u="swarm/caret_down.svg")||attr(c,"src",u),attr(c,"alt","caret down"),attr(c,"class","caret_down svelte-1hg8ukd"),attr(r,"class","select_container svelte-1hg8ukd"),attr(t,"class","container svelte-1hg8ukd")},m(b,v){insert(b,t,v),append(t,n),append(n,s),append(t,o),append(t,r),append(r,l);for(let y=0;y{"options"in u&&n(1,s=u.options),"value"in u&&n(0,o=u.value),"label"in u&&n(2,r=u.label),"valueChange"in u&&n(4,l=u.valueChange)},[o,s,r,a,l,c]}class Select extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$f,create_fragment$g,safe_not_equal,{options:1,value:0,label:2,valueChange:4})}}const userRecord_svelte_svelte_type_style_lang="";function get_each_context$3(i,t,n){const s=i.slice();return s[58]=t[n],s}function create_else_block_3(i){let t,n,s;return{c(){t=element("button"),t.textContent="Add User",attr(t,"class","add_user_btn svelte-1yo6xx5")},m(o,r){insert(o,t,r),n||(s=listen(t,"click",i[24]),n=!0)},p:noop$2,d(o){o&&detach(t),n=!1,s()}}}function create_if_block_5$2(i){let t,n,s,o,r,l;return{c(){t=element("div"),n=element("img"),o=space(),r=element("p"),l=text(i[11]),src_url_equal(n.src,s="swarm/check_circle.svg")||attr(n,"src",s),attr(n,"alt","success"),attr(r,"class","svelte-1yo6xx5"),attr(t,"class","add_user_success_info svelte-1yo6xx5")},m(a,c){insert(a,t,c),append(t,n),append(t,o),append(t,r),append(r,l)},p(a,c){c[0]&2048&&set_data(l,a[11])},d(a){a&&detach(t)}}}function create_else_block_2(i){let t,n,s,o;function r(){return i[45](i[58])}return{c(){t=element("img"),src_url_equal(t.src,n="swarm/edit.svg")||attr(t,"src",n),attr(t,"alt","edit"),attr(t,"class","action_icon svelte-1yo6xx5")},m(l,a){insert(l,t,a),s||(o=listen(t,"click",r),s=!0)},p(l,a){i=l},d(l){l&&detach(t),s=!1,o()}}}function create_if_block_4$2(i){let t,n,s,o;function r(){return i[44](i[58])}return{c(){t=element("img"),src_url_equal(t.src,n="swarm/edit.svg")||attr(t,"src",n),attr(t,"alt","edit"),attr(t,"class","action_icon svelte-1yo6xx5")},m(l,a){insert(l,t,a),s||(o=listen(t,"click",r),s=!0)},p(l,a){i=l},d(l){l&&detach(t),s=!1,o()}}}function create_each_block$3(i){let t,n,s=i[58].name+"",o,r,l,a=i[58].pubkey+"",c,u,f,h=i[58].id+"",p,g,b,v=i[58].role+"",y,S,T;function w(C,I){return C[58].role==="Super Admin"?create_if_block_4$2:create_else_block_2}let A=w(i),x=A(i);return{c(){t=element("tr"),n=element("td"),o=text(s),r=space(),l=element("td"),c=text(a),u=space(),f=element("div"),p=text(h),g=space(),b=element("td"),y=text(v),S=space(),T=element("td"),x.c(),attr(n,"class","column_name table_column svelte-1yo6xx5"),attr(f,"class","tool_tip_container svelte-1yo6xx5"),attr(l,"class","column_pubkey table_column svelte-1yo6xx5"),attr(b,"class","column_role table_column svelte-1yo6xx5"),attr(T,"class","column_action table_column svelte-1yo6xx5"),attr(t,"class","table_row svelte-1yo6xx5")},m(C,I){insert(C,t,I),append(t,n),append(n,o),append(t,r),append(t,l),append(l,c),append(l,u),append(l,f),append(f,p),append(t,g),append(t,b),append(b,y),append(t,S),append(t,T),x.m(T,null)},p(C,I){I[0]&1&&s!==(s=C[58].name+"")&&set_data(o,s),I[0]&1&&a!==(a=C[58].pubkey+"")&&set_data(c,a),I[0]&1&&h!==(h=C[58].id+"")&&set_data(p,h),I[0]&1&&v!==(v=C[58].role+"")&&set_data(y,v),A===(A=w(C))&&x?x.p(C,I):(x.d(1),x=A(C),x&&(x.c(),x.m(T,null)))},d(C){C&&detach(t),x.d()}}}function create_if_block_3$4(i){let t,n,s;return n=new ToastNotification$1({props:{kind:i[14]?"success":"error",title:i[14]?"Success:":"Error:",subtitle:i[11],timeout:3e3,fullWidth:!0}}),n.$on("close",i[46]),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","toast_container svelte-1yo6xx5")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p(o,r){const l={};r[0]&16384&&(l.kind=o[14]?"success":"error"),r[0]&16384&&(l.title=o[14]?"Success:":"Error:"),r[0]&2048&&(l.subtitle=o[11]),n.$set(l)},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_default_slot_3(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M,E,L=i[13]&&create_if_block_3$4(i);return p=new Input({props:{label:"Name",placeholder:"Enter Name ...",onInput:i[30],value:i[4]}}),b=new Input({props:{label:"Pubkey",placeholder:"Paste Pubkey ...",onInput:i[29],value:i[2]}}),y=new Select({props:{value:i[9],options:i[22],label:"Select Role",valueChange:i[33]}}),{c(){t=element("div"),n=element("div"),s=element("img"),r=space(),l=element("div"),L&&L.c(),a=space(),c=element("h3"),c.textContent="Add User",u=space(),f=element("div"),h=element("div"),create_component(p.$$.fragment),g=space(),create_component(b.$$.fragment),v=space(),create_component(y.$$.fragment),S=space(),T=element("button"),w=element("img"),x=text("Add User"),src_url_equal(s.src,o="swarm/close.svg")||attr(s,"src",o),attr(s,"alt","close"),attr(s,"class","close_icon svelte-1yo6xx5"),attr(n,"class","close_container svelte-1yo6xx5"),attr(c,"class","add_user_heading svelte-1yo6xx5"),attr(h,"class","input_container svelte-1yo6xx5"),src_url_equal(w.src,A="swarm/plus.svg")||attr(w,"src",A),attr(w,"alt","plus"),attr(w,"class","plus_sign svelte-1yo6xx5"),T.disabled=C=i[9]==="1"||!i[4]||!i[2],attr(T,"class","add_user_action_btn svelte-1yo6xx5"),attr(f,"class","form_container svelte-1yo6xx5"),attr(l,"class","add_user_body svelte-1yo6xx5"),attr(t,"class","add_user_container svelte-1yo6xx5")},m(R,O){insert(R,t,O),append(t,n),append(n,s),append(t,r),append(t,l),L&&L.m(l,null),append(l,a),append(l,c),append(l,u),append(l,f),append(f,h),mount_component(p,h,null),append(h,g),mount_component(b,h,null),append(h,v),mount_component(y,h,null),append(f,S),append(f,T),append(T,w),append(T,x),I=!0,M||(E=[listen(s,"click",i[23]),listen(T,"click",i[37])],M=!0)},p(R,O){R[13]?L?(L.p(R,O),O[0]&8192&&transition_in(L,1)):(L=create_if_block_3$4(R),L.c(),transition_in(L,1),L.m(l,a)):L&&(group_outros(),transition_out(L,1,1,()=>{L=null}),check_outros());const B={};O[0]&16&&(B.value=R[4]),p.$set(B);const z={};O[0]&4&&(z.value=R[2]),b.$set(z);const F={};O[0]&512&&(F.value=R[9]),y.$set(F),(!I||O[0]&532&&C!==(C=R[9]==="1"||!R[4]||!R[2]))&&(T.disabled=C)},i(R){I||(transition_in(L),transition_in(p.$$.fragment,R),transition_in(b.$$.fragment,R),transition_in(y.$$.fragment,R),I=!0)},o(R){transition_out(L),transition_out(p.$$.fragment,R),transition_out(b.$$.fragment,R),transition_out(y.$$.fragment,R),I=!1},d(R){R&&detach(t),L&&L.d(),destroy_component(p),destroy_component(b),destroy_component(y),M=!1,run_all(E)}}}function create_else_block_1(i){let t;return{c(){t=text("Save Changes")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_2$4(i){let t;return{c(){t=element("div"),attr(t,"class","loading-spinner svelte-1yo6xx5")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_default_slot_2(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T;a=new Input({props:{label:"Username",placeholder:"Type Username Here",onInput:i[36],value:i[8]}}),u=new Input({props:{label:"Pubkey",placeholder:"Type Pubkey Here",onInput:i[35],value:i[3]}});function w(C,I){return C[16]===!0?create_if_block_2$4:create_else_block_1}let A=w(i),x=A(i);return{c(){t=element("div"),n=element("div"),n.innerHTML='admin',s=space(),o=element("h3"),o.textContent="Edit Admin",r=space(),l=element("div"),create_component(a.$$.fragment),c=space(),create_component(u.$$.fragment),f=space(),h=element("div"),p=element("button"),p.textContent="Cancel",g=space(),b=element("button"),x.c(),attr(n,"class","admin_image_container svelte-1yo6xx5"),attr(o,"class","edit_admin_text svelte-1yo6xx5"),attr(p,"class","edit_admin_cancel_btn svelte-1yo6xx5"),b.disabled=v=i[16]||!i[3],attr(b,"class","edit_admin_save_btn svelte-1yo6xx5"),attr(h,"class","edit_admin_btn_container svelte-1yo6xx5"),attr(l,"class","edit_admin_form_container svelte-1yo6xx5"),attr(t,"class","edit_admin_container svelte-1yo6xx5")},m(C,I){insert(C,t,I),append(t,n),append(t,s),append(t,o),append(t,r),append(t,l),mount_component(a,l,null),append(l,c),mount_component(u,l,null),append(l,f),append(l,h),append(h,p),append(h,g),append(h,b),x.m(b,null),y=!0,S||(T=[listen(p,"click",i[25]),listen(b,"click",i[38])],S=!0)},p(C,I){const M={};I[0]&256&&(M.value=C[8]),a.$set(M);const E={};I[0]&8&&(E.value=C[3]),u.$set(E),A!==(A=w(C))&&(x.d(1),x=A(C),x&&(x.c(),x.m(b,null))),(!y||I[0]&65544&&v!==(v=C[16]||!C[3]))&&(b.disabled=v)},i(C){y||(transition_in(a.$$.fragment,C),transition_in(u.$$.fragment,C),y=!0)},o(C){transition_out(a.$$.fragment,C),transition_out(u.$$.fragment,C),y=!1},d(C){C&&detach(t),destroy_component(a),destroy_component(u),x.d(),S=!1,run_all(T)}}}function create_else_block$9(i){let t;return{c(){t=text("Delete")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_1$6(i){let t;return{c(){t=element("div"),attr(t,"class","delete_loading-spinner svelte-1yo6xx5")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_default_slot_1$1(i){let t,n,s,o,r,l=i[1].name+"",a,c,u,f,h,p,g,b,v,y;function S(A,x){return A[10]===!0?create_if_block_1$6:create_else_block$9}let T=S(i),w=T(i);return{c(){t=element("div"),n=element("div"),s=element("div"),s.innerHTML='user',o=space(),r=element("p"),a=text(l),c=space(),u=element("p"),u.innerHTML='Are you sure you want to Delete this user?',f=space(),h=element("div"),p=element("button"),p.textContent="Cancel",g=space(),b=element("button"),w.c(),attr(s,"class","user_image_container"),attr(r,"class","svelte-1yo6xx5"),attr(n,"class","user_details_container svelte-1yo6xx5"),attr(u,"class","delete_warning_text svelte-1yo6xx5"),attr(p,"class","delete_user_cancel_btn svelte-1yo6xx5"),attr(b,"class","delete_user_btn svelte-1yo6xx5"),b.disabled=i[10],attr(h,"class","delete_button_container svelte-1yo6xx5"),attr(t,"class","delete_user_container svelte-1yo6xx5")},m(A,x){insert(A,t,x),append(t,n),append(n,s),append(n,o),append(n,r),append(r,a),append(t,c),append(t,u),append(t,f),append(t,h),append(h,p),append(h,g),append(h,b),w.m(b,null),v||(y=[listen(p,"click",i[26]),listen(b,"click",i[43])],v=!0)},p(A,x){x[0]&2&&l!==(l=A[1].name+"")&&set_data(a,l),T!==(T=S(A))&&(w.d(1),w=T(A),w&&(w.c(),w.m(b,null))),x[0]&1024&&(b.disabled=A[10])},d(A){A&&detach(t),w.d(),v=!1,run_all(y)}}}function create_if_block$9(i){let t,n,s;return n=new ToastNotification$1({props:{kind:i[14]?"success":"error",title:i[14]?"Success:":"Error:",subtitle:i[11],timeout:3e3,fullWidth:!0}}),n.$on("close",i[47]),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","toast_container svelte-1yo6xx5")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p(o,r){const l={};r[0]&16384&&(l.kind=o[14]?"success":"error"),r[0]&16384&&(l.title=o[14]?"Success:":"Error:"),r[0]&2048&&(l.subtitle=o[11]),n.$set(l)},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_default_slot$4(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M,E,L=i[13]&&create_if_block$9(i);return h=new Input({props:{label:"Name",placeholder:"Enter Name ...",onInput:i[31],value:i[5]}}),g=new Input({props:{label:"Pubkey",placeholder:"Paste Pubkey ...",onInput:i[32],value:i[6]}}),v=new Select({props:{value:i[7],options:i[22],label:"Select Role",valueChange:i[34]}}),{c(){t=element("div"),n=element("div"),s=element("img"),r=space(),L&&L.c(),l=space(),a=element("div"),c=element("h3"),c.textContent="Edit User",u=space(),f=element("div"),create_component(h.$$.fragment),p=space(),create_component(g.$$.fragment),b=space(),create_component(v.$$.fragment),y=space(),S=element("div"),T=element("button"),T.textContent="Delete",w=space(),A=element("button"),x=text("Save Changes"),src_url_equal(s.src,o="swarm/close.svg")||attr(s,"src",o),attr(s,"alt","close"),attr(s,"class","close_icon svelte-1yo6xx5"),attr(n,"class","close_container svelte-1yo6xx5"),attr(c,"class","add_user_heading svelte-1yo6xx5"),attr(f,"class","input_container svelte-1yo6xx5"),attr(T,"class","delete_btn svelte-1yo6xx5"),attr(A,"class","save_changes_btn svelte-1yo6xx5"),A.disabled=C=!i[18]||i[12],attr(S,"class","edit_user_btn_container svelte-1yo6xx5"),attr(a,"class","add_user_body svelte-1yo6xx5"),attr(t,"class","edit_user_container svelte-1yo6xx5")},m(R,O){insert(R,t,O),append(t,n),append(n,s),append(t,r),L&&L.m(t,null),append(t,l),append(t,a),append(a,c),append(a,u),append(a,f),mount_component(h,f,null),append(f,p),mount_component(g,f,null),append(f,b),mount_component(v,f,null),append(a,y),append(a,S),append(S,T),append(S,w),append(S,A),append(A,x),I=!0,M||(E=[listen(s,"click",i[28]),listen(T,"click",i[48]),listen(A,"click",i[42])],M=!0)},p(R,O){R[13]?L?(L.p(R,O),O[0]&8192&&transition_in(L,1)):(L=create_if_block$9(R),L.c(),transition_in(L,1),L.m(t,l)):L&&(group_outros(),transition_out(L,1,1,()=>{L=null}),check_outros());const B={};O[0]&32&&(B.value=R[5]),h.$set(B);const z={};O[0]&64&&(z.value=R[6]),g.$set(z);const F={};O[0]&128&&(F.value=R[7]),v.$set(F),(!I||O[0]&266240&&C!==(C=!R[18]||R[12]))&&(A.disabled=C)},i(R){I||(transition_in(L),transition_in(h.$$.fragment,R),transition_in(g.$$.fragment,R),transition_in(v.$$.fragment,R),I=!0)},o(R){transition_out(L),transition_out(h.$$.fragment,R),transition_out(g.$$.fragment,R),transition_out(v.$$.fragment,R),I=!1},d(R){R&&detach(t),L&&L.d(),destroy_component(h),destroy_component(g),destroy_component(v),M=!1,run_all(E)}}}function create_fragment$f(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x;function C(R,O){return R[17]?create_if_block_5$2:create_else_block_3}let I=C(i),M=I(i),E=i[0],L=[];for(let R=0;RName +
`,C=space(),I=element("div"),create_component(M.$$.fragment),L=space(),R=element("button"),fe.c(),B=space(),z=element("p"),z.textContent="To set Yourself as Superadmin",attr(s,"class","image_container svelte-nqxly1"),attr(r,"class","heading svelte-nqxly1"),attr(a,"class","description svelte-nqxly1"),attr(f,"class","inputs_container svelte-nqxly1"),T.disabled=w=i[3]||!i[0],attr(T,"class","submit_btn svelte-nqxly1"),attr(S,"class","submit_btn_container svelte-nqxly1"),attr(x,"class","alt_info svelte-nqxly1"),R.disabled=O=!i[4]||!i[5]||i[6]||!i[2],attr(R,"class","sphinx_btn svelte-nqxly1"),attr(z,"class","sphinx_text svelte-nqxly1"),attr(I,"class","sphinx_btn_container svelte-nqxly1"),attr(u,"class","form_container svelte-nqxly1"),attr(n,"class","inner_container svelte-nqxly1"),attr(t,"class","container svelte-nqxly1")},m(le,Le){insert(le,t,Le),append(t,n),append(n,s),append(n,o),append(n,r),append(n,l),append(n,a),append(n,c),append(n,u),append(u,f),mount_component(h,f,null),append(f,g),mount_component(b,f,null),append(u,y),append(u,S),append(S,T),Z.m(T,null),append(u,A),append(u,x),append(u,C),append(u,I),mount_component(M,I,null),append(I,L),append(I,R),fe.m(R,null),append(I,B),append(I,z),F=!0,q||(N=[listen(T,"click",i[10]),listen(R,"click",i[11])],q=!0)},p(le,[Le]){const V={};!p&&Le&2&&(p=!0,V.value=le[1],add_flush_callback(()=>p=!1)),h.$set(V);const W={};!v&&Le&1&&(v=!0,W.value=le[0],add_flush_callback(()=>v=!1)),b.$set(W),ce!==(ce=Y(le))&&(Z.d(1),Z=ce(le),Z&&(Z.c(),Z.m(T,null))),(!F||Le&9&&w!==(w=le[3]||!le[0]))&&(T.disabled=w);const j={};!E&&Le&4&&(E=!0,j.value=le[2],add_flush_callback(()=>E=!1)),M.$set(j),me===(me=re(le))&&fe?fe.p(le,Le):(fe.d(1),fe=me(le),fe&&(fe.c(),fe.m(R,null))),(!F||Le&116&&O!==(O=!le[4]||!le[5]||le[6]||!le[2]))&&(R.disabled=O)},i(le){F||(transition_in(h.$$.fragment,le),transition_in(b.$$.fragment,le),transition_in(M.$$.fragment,le),F=!0)},o(le){transition_out(h.$$.fragment,le),transition_out(b.$$.fragment,le),transition_out(M.$$.fragment,le),F=!1},d(le){le&&detach(t),destroy_component(h),destroy_component(b),Z.d(),destroy_component(M),fe.d(),q=!1,run_all(N)}}}function instance$h(i,t,n){let s,o,r,l;component_subscribe(i,activeUser,C=>n(16,l=C));let a="",c="",u="",f=!1,h;function p(C){n(0,a=C)}function g(C){n(2,u=C)}function b(C){n(1,c=C)}async function v(){try{n(3,f=!0);const C=await add_boltwall_admin_pubkey(a,c),I=await update_admin_pubkey(a,l);boltwallSuperAdminPubkey.set(a),n(0,a=""),n(1,c=""),n(3,f=!1)}catch(C){n(3,f=!1),console.log(`ERROR SETTING BOLTWALL SUPER ADMIN: ${JSON.stringify(C)}`)}}async function y(){let C=0;h=setInterval(async()=>{try{const I=await get_signup_challenge_status(s,u,l);I.success?(n(4,s=""),boltwallSuperAdminPubkey.set(I.pubkey),n(6,r=!1),h&&clearInterval(h)):I.message!=="not yet verified"&&(console.log(I.message),n(6,r=!1),h&&clearInterval(h)),C++,C>100&&(n(6,r=!1),h&&clearInterval(h))}catch(I){n(6,r=!1),console.log("Auth interval error",I)}},3e3)}async function S(C){try{n(6,r=!0),y()}catch{n(6,r=!1)}}async function T(){const C=await get_signup_challenge(l);n(4,s=C.challenge),n(5,o=contructQrString(s))}onMount(async()=>{try{await T()}catch(C){console.log("Error setting up sign up challenge: ",JSON.stringify(C))}}),onDestroy(()=>{h&&clearInterval(h)});function w(C){c=C,n(1,c)}function A(C){a=C,n(0,a)}function x(C){u=C,n(2,u)}return n(4,s=""),n(5,o=""),n(6,r=!1),[a,c,u,f,s,o,r,p,g,b,v,S,w,A,x]}class SetSuperAdmin extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$h,create_fragment$i,safe_not_equal,{})}}const modal_svelte_svelte_type_style_lang="";function create_fragment$h(i){let t,n,s,o,r,l;const a=i[4].default,c=create_slot(a,i,i[3],null);return{c(){t=element("div"),n=element("div"),c&&c.c(),attr(n,"class","modal-content svelte-cdyc7e"),attr(t,"class","modal svelte-cdyc7e"),attr(t,"style",s=i[0]?"display: flex;":"display: none;")},m(u,f){insert(u,t,f),append(t,n),c&&c.m(n,null),o=!0,r||(l=[listen(n,"click",preventPropagation),listen(t,"click",i[1])],r=!0)},p(u,[f]){c&&c.p&&(!o||f&8)&&update_slot_base(c,a,u,u[3],o?get_slot_changes(a,u[3],f,null):get_all_dirty_from_scope(u[3]),null),(!o||f&1&&s!==(s=u[0]?"display: flex;":"display: none;"))&&attr(t,"style",s)},i(u){o||(transition_in(c,u),o=!0)},o(u){transition_out(c,u),o=!1},d(u){u&&detach(t),c&&c.d(u),r=!1,run_all(l)}}}function preventPropagation(i){i.stopPropagation()}function instance$g(i,t,n){let{$$slots:s={},$$scope:o}=t,{isOpen:r}=t,{onClose:l}=t;function a(c){l()}return i.$$set=c=>{"isOpen"in c&&n(0,r=c.isOpen),"onClose"in c&&n(2,l=c.onClose),"$$scope"in c&&n(3,o=c.$$scope)},[r,a,l,o,s]}class Modal extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$g,create_fragment$h,safe_not_equal,{isOpen:0,onClose:2})}}const select_svelte_svelte_type_style_lang="";function get_each_context$4(i,t,n){const s=i.slice();return s[6]=t[n],s}function create_each_block$4(i){let t,n=i[6].label+"",s,o;return{c(){t=element("option"),s=text(n),t.__value=o=i[6].value,t.value=t.__value,attr(t,"class","svelte-1hg8ukd")},m(r,l){insert(r,t,l),append(t,s)},p(r,l){l&2&&n!==(n=r[6].label+"")&&set_data(s,n),l&2&&o!==(o=r[6].value)&&(t.__value=o,t.value=t.__value)},d(r){r&&detach(t)}}}function create_fragment$g(i){let t,n,s,o,r,l,a,c,u,f,h,p=i[1],g=[];for(let b=0;bi[5].call(l)),src_url_equal(c.src,u="swarm/caret_down.svg")||attr(c,"src",u),attr(c,"alt","caret down"),attr(c,"class","caret_down svelte-1hg8ukd"),attr(r,"class","select_container svelte-1hg8ukd"),attr(t,"class","container svelte-1hg8ukd")},m(b,v){insert(b,t,v),append(t,n),append(n,s),append(t,o),append(t,r),append(r,l);for(let y=0;y{"options"in u&&n(1,s=u.options),"value"in u&&n(0,o=u.value),"label"in u&&n(2,r=u.label),"valueChange"in u&&n(4,l=u.valueChange)},[o,s,r,a,l,c]}class Select extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$f,create_fragment$g,safe_not_equal,{options:1,value:0,label:2,valueChange:4})}}const userRecord_svelte_svelte_type_style_lang="";function get_each_context$3(i,t,n){const s=i.slice();return s[58]=t[n],s}function create_else_block_3(i){let t,n,s;return{c(){t=element("button"),t.textContent="Add User",attr(t,"class","add_user_btn svelte-1yo6xx5")},m(o,r){insert(o,t,r),n||(s=listen(t,"click",i[24]),n=!0)},p:noop$2,d(o){o&&detach(t),n=!1,s()}}}function create_if_block_5$2(i){let t,n,s,o,r,l;return{c(){t=element("div"),n=element("img"),o=space(),r=element("p"),l=text(i[11]),src_url_equal(n.src,s="swarm/check_circle.svg")||attr(n,"src",s),attr(n,"alt","success"),attr(r,"class","svelte-1yo6xx5"),attr(t,"class","add_user_success_info svelte-1yo6xx5")},m(a,c){insert(a,t,c),append(t,n),append(t,o),append(t,r),append(r,l)},p(a,c){c[0]&2048&&set_data(l,a[11])},d(a){a&&detach(t)}}}function create_else_block_2(i){let t,n,s,o;function r(){return i[45](i[58])}return{c(){t=element("img"),src_url_equal(t.src,n="swarm/edit.svg")||attr(t,"src",n),attr(t,"alt","edit"),attr(t,"class","action_icon svelte-1yo6xx5")},m(l,a){insert(l,t,a),s||(o=listen(t,"click",r),s=!0)},p(l,a){i=l},d(l){l&&detach(t),s=!1,o()}}}function create_if_block_4$2(i){let t,n,s,o;function r(){return i[44](i[58])}return{c(){t=element("img"),src_url_equal(t.src,n="swarm/edit.svg")||attr(t,"src",n),attr(t,"alt","edit"),attr(t,"class","action_icon svelte-1yo6xx5")},m(l,a){insert(l,t,a),s||(o=listen(t,"click",r),s=!0)},p(l,a){i=l},d(l){l&&detach(t),s=!1,o()}}}function create_each_block$3(i){let t,n,s=i[58].name+"",o,r,l,a=i[58].pubkey+"",c,u,f,h=i[58].id+"",p,g,b,v=i[58].role+"",y,S,T;function w(C,I){return C[58].role==="Super Admin"?create_if_block_4$2:create_else_block_2}let A=w(i),x=A(i);return{c(){t=element("tr"),n=element("td"),o=text(s),r=space(),l=element("td"),c=text(a),u=space(),f=element("div"),p=text(h),g=space(),b=element("td"),y=text(v),S=space(),T=element("td"),x.c(),attr(n,"class","column_name table_column svelte-1yo6xx5"),attr(f,"class","tool_tip_container svelte-1yo6xx5"),attr(l,"class","column_pubkey table_column svelte-1yo6xx5"),attr(b,"class","column_role table_column svelte-1yo6xx5"),attr(T,"class","column_action table_column svelte-1yo6xx5"),attr(t,"class","table_row svelte-1yo6xx5")},m(C,I){insert(C,t,I),append(t,n),append(n,o),append(t,r),append(t,l),append(l,c),append(l,u),append(l,f),append(f,p),append(t,g),append(t,b),append(b,y),append(t,S),append(t,T),x.m(T,null)},p(C,I){I[0]&1&&s!==(s=C[58].name+"")&&set_data(o,s),I[0]&1&&a!==(a=C[58].pubkey+"")&&set_data(c,a),I[0]&1&&h!==(h=C[58].id+"")&&set_data(p,h),I[0]&1&&v!==(v=C[58].role+"")&&set_data(y,v),A===(A=w(C))&&x?x.p(C,I):(x.d(1),x=A(C),x&&(x.c(),x.m(T,null)))},d(C){C&&detach(t),x.d()}}}function create_if_block_3$4(i){let t,n,s;return n=new ToastNotification$1({props:{kind:i[14]?"success":"error",title:i[14]?"Success:":"Error:",subtitle:i[11],timeout:3e3,fullWidth:!0}}),n.$on("close",i[46]),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","toast_container svelte-1yo6xx5")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p(o,r){const l={};r[0]&16384&&(l.kind=o[14]?"success":"error"),r[0]&16384&&(l.title=o[14]?"Success:":"Error:"),r[0]&2048&&(l.subtitle=o[11]),n.$set(l)},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_default_slot_3(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M,E,L=i[13]&&create_if_block_3$4(i);return p=new Input({props:{label:"Name",placeholder:"Enter Name ...",onInput:i[30],value:i[4]}}),b=new Input({props:{label:"Pubkey",placeholder:"Paste Pubkey ...",onInput:i[29],value:i[2],isPubkey:!0}}),y=new Select({props:{value:i[9],options:i[22],label:"Select Role",valueChange:i[33]}}),{c(){t=element("div"),n=element("div"),s=element("img"),r=space(),l=element("div"),L&&L.c(),a=space(),c=element("h3"),c.textContent="Add User",u=space(),f=element("div"),h=element("div"),create_component(p.$$.fragment),g=space(),create_component(b.$$.fragment),v=space(),create_component(y.$$.fragment),S=space(),T=element("button"),w=element("img"),x=text("Add User"),src_url_equal(s.src,o="swarm/close.svg")||attr(s,"src",o),attr(s,"alt","close"),attr(s,"class","close_icon svelte-1yo6xx5"),attr(n,"class","close_container svelte-1yo6xx5"),attr(c,"class","add_user_heading svelte-1yo6xx5"),attr(h,"class","input_container svelte-1yo6xx5"),src_url_equal(w.src,A="swarm/plus.svg")||attr(w,"src",A),attr(w,"alt","plus"),attr(w,"class","plus_sign svelte-1yo6xx5"),T.disabled=C=i[9]==="1"||!i[4]||!i[2],attr(T,"class","add_user_action_btn svelte-1yo6xx5"),attr(f,"class","form_container svelte-1yo6xx5"),attr(l,"class","add_user_body svelte-1yo6xx5"),attr(t,"class","add_user_container svelte-1yo6xx5")},m(R,O){insert(R,t,O),append(t,n),append(n,s),append(t,r),append(t,l),L&&L.m(l,null),append(l,a),append(l,c),append(l,u),append(l,f),append(f,h),mount_component(p,h,null),append(h,g),mount_component(b,h,null),append(h,v),mount_component(y,h,null),append(f,S),append(f,T),append(T,w),append(T,x),I=!0,M||(E=[listen(s,"click",i[23]),listen(T,"click",i[37])],M=!0)},p(R,O){R[13]?L?(L.p(R,O),O[0]&8192&&transition_in(L,1)):(L=create_if_block_3$4(R),L.c(),transition_in(L,1),L.m(l,a)):L&&(group_outros(),transition_out(L,1,1,()=>{L=null}),check_outros());const B={};O[0]&16&&(B.value=R[4]),p.$set(B);const z={};O[0]&4&&(z.value=R[2]),b.$set(z);const F={};O[0]&512&&(F.value=R[9]),y.$set(F),(!I||O[0]&532&&C!==(C=R[9]==="1"||!R[4]||!R[2]))&&(T.disabled=C)},i(R){I||(transition_in(L),transition_in(p.$$.fragment,R),transition_in(b.$$.fragment,R),transition_in(y.$$.fragment,R),I=!0)},o(R){transition_out(L),transition_out(p.$$.fragment,R),transition_out(b.$$.fragment,R),transition_out(y.$$.fragment,R),I=!1},d(R){R&&detach(t),L&&L.d(),destroy_component(p),destroy_component(b),destroy_component(y),M=!1,run_all(E)}}}function create_else_block_1(i){let t;return{c(){t=text("Save Changes")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_2$4(i){let t;return{c(){t=element("div"),attr(t,"class","loading-spinner svelte-1yo6xx5")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_default_slot_2(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T;a=new Input({props:{label:"Username",placeholder:"Type Username Here",onInput:i[36],value:i[8]}}),u=new Input({props:{label:"Pubkey",placeholder:"Type Pubkey Here",onInput:i[35],value:i[3],isPubkey:!0}});function w(C,I){return C[16]===!0?create_if_block_2$4:create_else_block_1}let A=w(i),x=A(i);return{c(){t=element("div"),n=element("div"),n.innerHTML='admin',s=space(),o=element("h3"),o.textContent="Edit Admin",r=space(),l=element("div"),create_component(a.$$.fragment),c=space(),create_component(u.$$.fragment),f=space(),h=element("div"),p=element("button"),p.textContent="Cancel",g=space(),b=element("button"),x.c(),attr(n,"class","admin_image_container svelte-1yo6xx5"),attr(o,"class","edit_admin_text svelte-1yo6xx5"),attr(p,"class","edit_admin_cancel_btn svelte-1yo6xx5"),b.disabled=v=i[16]||!i[3],attr(b,"class","edit_admin_save_btn svelte-1yo6xx5"),attr(h,"class","edit_admin_btn_container svelte-1yo6xx5"),attr(l,"class","edit_admin_form_container svelte-1yo6xx5"),attr(t,"class","edit_admin_container svelte-1yo6xx5")},m(C,I){insert(C,t,I),append(t,n),append(t,s),append(t,o),append(t,r),append(t,l),mount_component(a,l,null),append(l,c),mount_component(u,l,null),append(l,f),append(l,h),append(h,p),append(h,g),append(h,b),x.m(b,null),y=!0,S||(T=[listen(p,"click",i[25]),listen(b,"click",i[38])],S=!0)},p(C,I){const M={};I[0]&256&&(M.value=C[8]),a.$set(M);const E={};I[0]&8&&(E.value=C[3]),u.$set(E),A!==(A=w(C))&&(x.d(1),x=A(C),x&&(x.c(),x.m(b,null))),(!y||I[0]&65544&&v!==(v=C[16]||!C[3]))&&(b.disabled=v)},i(C){y||(transition_in(a.$$.fragment,C),transition_in(u.$$.fragment,C),y=!0)},o(C){transition_out(a.$$.fragment,C),transition_out(u.$$.fragment,C),y=!1},d(C){C&&detach(t),destroy_component(a),destroy_component(u),x.d(),S=!1,run_all(T)}}}function create_else_block$9(i){let t;return{c(){t=text("Delete")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_if_block_1$6(i){let t;return{c(){t=element("div"),attr(t,"class","delete_loading-spinner svelte-1yo6xx5")},m(n,s){insert(n,t,s)},d(n){n&&detach(t)}}}function create_default_slot_1$1(i){let t,n,s,o,r,l=i[1].name+"",a,c,u,f,h,p,g,b,v,y;function S(A,x){return A[10]===!0?create_if_block_1$6:create_else_block$9}let T=S(i),w=T(i);return{c(){t=element("div"),n=element("div"),s=element("div"),s.innerHTML='user',o=space(),r=element("p"),a=text(l),c=space(),u=element("p"),u.innerHTML='Are you sure you want to Delete this user?',f=space(),h=element("div"),p=element("button"),p.textContent="Cancel",g=space(),b=element("button"),w.c(),attr(s,"class","user_image_container"),attr(r,"class","svelte-1yo6xx5"),attr(n,"class","user_details_container svelte-1yo6xx5"),attr(u,"class","delete_warning_text svelte-1yo6xx5"),attr(p,"class","delete_user_cancel_btn svelte-1yo6xx5"),attr(b,"class","delete_user_btn svelte-1yo6xx5"),b.disabled=i[10],attr(h,"class","delete_button_container svelte-1yo6xx5"),attr(t,"class","delete_user_container svelte-1yo6xx5")},m(A,x){insert(A,t,x),append(t,n),append(n,s),append(n,o),append(n,r),append(r,a),append(t,c),append(t,u),append(t,f),append(t,h),append(h,p),append(h,g),append(h,b),w.m(b,null),v||(y=[listen(p,"click",i[26]),listen(b,"click",i[43])],v=!0)},p(A,x){x[0]&2&&l!==(l=A[1].name+"")&&set_data(a,l),T!==(T=S(A))&&(w.d(1),w=T(A),w&&(w.c(),w.m(b,null))),x[0]&1024&&(b.disabled=A[10])},d(A){A&&detach(t),w.d(),v=!1,run_all(y)}}}function create_if_block$9(i){let t,n,s;return n=new ToastNotification$1({props:{kind:i[14]?"success":"error",title:i[14]?"Success:":"Error:",subtitle:i[11],timeout:3e3,fullWidth:!0}}),n.$on("close",i[47]),{c(){t=element("div"),create_component(n.$$.fragment),attr(t,"class","toast_container svelte-1yo6xx5")},m(o,r){insert(o,t,r),mount_component(n,t,null),s=!0},p(o,r){const l={};r[0]&16384&&(l.kind=o[14]?"success":"error"),r[0]&16384&&(l.title=o[14]?"Success:":"Error:"),r[0]&2048&&(l.subtitle=o[11]),n.$set(l)},i(o){s||(transition_in(n.$$.fragment,o),s=!0)},o(o){transition_out(n.$$.fragment,o),s=!1},d(o){o&&detach(t),destroy_component(n)}}}function create_default_slot$4(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x,C,I,M,E,L=i[13]&&create_if_block$9(i);return h=new Input({props:{label:"Name",placeholder:"Enter Name ...",onInput:i[31],value:i[5]}}),g=new Input({props:{label:"Pubkey",placeholder:"Paste Pubkey ...",onInput:i[32],value:i[6],isPubkey:!0}}),v=new Select({props:{value:i[7],options:i[22],label:"Select Role",valueChange:i[34]}}),{c(){t=element("div"),n=element("div"),s=element("img"),r=space(),L&&L.c(),l=space(),a=element("div"),c=element("h3"),c.textContent="Edit User",u=space(),f=element("div"),create_component(h.$$.fragment),p=space(),create_component(g.$$.fragment),b=space(),create_component(v.$$.fragment),y=space(),S=element("div"),T=element("button"),T.textContent="Delete",w=space(),A=element("button"),x=text("Save Changes"),src_url_equal(s.src,o="swarm/close.svg")||attr(s,"src",o),attr(s,"alt","close"),attr(s,"class","close_icon svelte-1yo6xx5"),attr(n,"class","close_container svelte-1yo6xx5"),attr(c,"class","add_user_heading svelte-1yo6xx5"),attr(f,"class","input_container svelte-1yo6xx5"),attr(T,"class","delete_btn svelte-1yo6xx5"),attr(A,"class","save_changes_btn svelte-1yo6xx5"),A.disabled=C=!i[18]||i[12],attr(S,"class","edit_user_btn_container svelte-1yo6xx5"),attr(a,"class","add_user_body svelte-1yo6xx5"),attr(t,"class","edit_user_container svelte-1yo6xx5")},m(R,O){insert(R,t,O),append(t,n),append(n,s),append(t,r),L&&L.m(t,null),append(t,l),append(t,a),append(a,c),append(a,u),append(a,f),mount_component(h,f,null),append(f,p),mount_component(g,f,null),append(f,b),mount_component(v,f,null),append(a,y),append(a,S),append(S,T),append(S,w),append(S,A),append(A,x),I=!0,M||(E=[listen(s,"click",i[28]),listen(T,"click",i[48]),listen(A,"click",i[42])],M=!0)},p(R,O){R[13]?L?(L.p(R,O),O[0]&8192&&transition_in(L,1)):(L=create_if_block$9(R),L.c(),transition_in(L,1),L.m(t,l)):L&&(group_outros(),transition_out(L,1,1,()=>{L=null}),check_outros());const B={};O[0]&32&&(B.value=R[5]),h.$set(B);const z={};O[0]&64&&(z.value=R[6]),g.$set(z);const F={};O[0]&128&&(F.value=R[7]),v.$set(F),(!I||O[0]&266240&&C!==(C=!R[18]||R[12]))&&(A.disabled=C)},i(R){I||(transition_in(L),transition_in(h.$$.fragment,R),transition_in(g.$$.fragment,R),transition_in(v.$$.fragment,R),I=!0)},o(R){transition_out(L),transition_out(h.$$.fragment,R),transition_out(g.$$.fragment,R),transition_out(v.$$.fragment,R),I=!1},d(R){R&&detach(t),L&&L.d(),destroy_component(h),destroy_component(g),destroy_component(v),M=!1,run_all(E)}}}function create_fragment$f(i){let t,n,s,o,r,l,a,c,u,f,h,p,g,b,v,y,S,T,w,A,x;function C(R,O){return R[17]?create_if_block_5$2:create_else_block_3}let I=C(i),M=I(i),E=i[0],L=[];for(let R=0;RName Public Key Role `,u=space(),f=element("tbody");for(let R=0;Rn(49,v=ye));let y=[],S={id:"",pubkey:"",name:"",role:"",identifier:0},T="",w="",A="",x="",C="",I="",M="",E="1";const L=[{value:"1",label:"Select Role"},{value:"2",label:"Admin"},{value:"3",label:"Member"}];async function R(){const ye=await list_admins(),He=JSON.parse(ye);if(console.log(He),He.success){const ft=[];for(let St=0;St{await R()});function Q(ye){n(2,T=ye)}function J(ye){n(4,A=ye)}function Y(ye){n(5,x=ye),re()}function ce(ye){n(6,C=ye),re()}function Z(ye){n(9,E=ye)}function ge(ye){n(7,I=ye),re()}function se(){n(6,C=""),n(5,x=""),n(7,I=""),n(18,g=!1)}function re(){const ye=j(S.role);I==="1"?n(18,g=!1):S.id!==C||S.name!==x||ye.value!==I?n(18,g=!0):n(18,g=!1)}function me(ye){n(3,w=ye)}function fe(ye){n(8,M=ye)}function le(){n(17,f=!0),setTimeout(()=>{n(17,f=!1)},3e3)}async function Le(){const ye=await add_user$1(T,Number(E),A),He=JSON.parse(ye);n(14,a=He.success||!1),n(11,c=He.message==="user added successfully"?"User Added":He.message),a?(await R(),O(),n(2,T=""),n(9,E="1"),n(4,A=""),le()):n(13,u=!0)}function V(ye){for(let He=0;HeX(ye.id),Ye=ye=>te(ye.id),wt=ye=>{ye.preventDefault(),n(13,u=!1)},ut=ye=>{ye.preventDefault(),n(13,u=!1)},Ln=()=>oe(S.id);return n(21,s=!1),n(20,o=!1),n(19,r=!1),n(15,l=!1),n(14,a=!1),n(11,c=""),n(13,u=!1),n(17,f=!1),n(16,h=!1),n(10,p=!1),n(18,g=!1),n(12,b=!1),[y,S,T,w,A,x,C,I,M,E,p,c,b,u,a,l,h,f,g,r,o,s,L,O,B,F,N,ee,K,Q,J,Y,ce,Z,ge,me,fe,Le,W,X,oe,te,be,Se,Me,Ye,wt,ut,Ln]}class UserRecord extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$e,create_fragment$f,safe_not_equal,{},null,[-1,-1])}}function create_else_block$8(i){let t,n;return t=new UserRecord({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$8(i){let t,n;return t=new SetSuperAdmin({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$e(i){let t,n,s,o;const r=[create_if_block$8,create_else_block$8],l=[];function a(c,u){return c[0]?1:0}return n=a(i),s=l[n]=r[n](i),{c(){t=element("div"),s.c(),attr(t,"class","container")},m(c,u){insert(c,t,u),l[n].m(t,null),o=!0},p(c,[u]){let f=n;n=a(c),n!==f&&(group_outros(),transition_out(l[f],1,1,()=>{l[f]=null}),check_outros(),s=l[n],s||(s=l[n]=r[n](c),s.c()),transition_in(s,1),s.m(t,null))},i(c){o||(transition_in(s),o=!0)},o(c){transition_out(s),o=!1},d(c){c&&detach(t),l[n].d()}}}function instance$d(i,t,n){let s;component_subscribe(i,boltwallSuperAdminPubkey,r=>n(0,s=r));async function o(){const r=await get_super_admin(),l=JSON.parse(r);l!=null&&l.success&&l.message==="super admin record"&&boltwallSuperAdminPubkey.set(l.data.pubkey)}return onMount(async()=>{await o()}),[s]}class Roles extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$d,create_fragment$e,safe_not_equal,{})}}const apikeys_svelte_svelte_type_style_lang="";function create_fragment$d(i){let t,n,s,o,r,l,a,c,u,f;return u=new Password$1({props:{value:i[0],onInput:func,label:"",readonly:!0}}),{c(){t=element("div"),n=element("div"),n.innerHTML='

Api Keys

',s=space(),o=element("div"),r=element("div"),l=element("p"),l.textContent="API TOKEN",a=space(),c=element("div"),create_component(u.$$.fragment),attr(n,"class","header svelte-yi01l4"),attr(l,"class","api-title svelte-yi01l4"),attr(c,"class","password_container svelte-yi01l4"),attr(r,"class","api-container svelte-yi01l4"),attr(o,"class","content svelte-yi01l4"),attr(t,"class","container svelte-yi01l4")},m(h,p){insert(h,t,p),append(t,n),append(t,s),append(t,o),append(o,r),append(r,l),append(r,a),append(r,c),mount_component(u,c,null),f=!0},p(h,[p]){const g={};p&1&&(g.value=h[0]),u.$set(g)},i(h){f||(transition_in(u.$$.fragment,h),f=!0)},o(h){transition_out(u.$$.fragment,h),f=!1},d(h){h&&detach(t),destroy_component(u)}}}const func=()=>{};function instance$c(i,t,n){let s;return onMount(async()=>{const o=await get_api_token();n(0,s=o.x_api_token)}),n(0,s=""),[s]}class Apikeys extends SvelteComponent{constructor(t){super(),init$1(this,t,instance$c,create_fragment$d,safe_not_equal,{})}}const NavFiber_svelte_svelte_type_style_lang="";function get_each_context$2(i,t,n){const s=i.slice();return s[15]=t[n],s}function create_if_block_3$3(i){let t,n;return t=new InlineNotification$1({props:{lowContrast:!0,kind:i[2]?"success":"error",title:i[2]?"Success:":"Error:",subtitle:i[3],timeout:3e3}}),t.$on("close",i[9]),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},p(s,o){const r={};o&4&&(r.kind=s[2]?"success":"error"),o&4&&(r.title=s[2]?"Success:":"Error:"),o&8&&(r.subtitle=s[3]),t.$set(r)},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_each_block$2(i,t){let n,s=t[15]+"",o,r,l,a,c;function u(){return t[10](t[15])}return{key:i,first:null,c(){n=element("button"),o=text(s),r=space(),attr(n,"class","tab_button svelte-18sli5f"),attr(n,"style",l=`${t[15]===t[1]?"color: white; border-bottom: 0.125rem solid #618AFF;":"color: #909BAA;"}`),this.first=n},m(f,h){insert(f,n,h),append(n,o),append(n,r),a||(c=listen(n,"click",u),a=!0)},p(f,h){t=f,h&2&&l!==(l=`${t[15]===t[1]?"color: white; border-bottom: 0.125rem solid #618AFF;":"color: #909BAA;"}`)&&attr(n,"style",l)},d(f){f&&detach(n),a=!1,c()}}}function create_else_block$7(i){let t,n;return t=new EnpointPermission({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_2$3(i){let t,n;return t=new Apikeys({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block_1$5(i){let t,n;return t=new Roles({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_if_block$7(i){let t,n;return t=new General({}),{c(){create_component(t.$$.fragment)},m(s,o){mount_component(t,s,o),n=!0},i(s){n||(transition_in(t.$$.fragment,s),n=!0)},o(s){transition_out(t.$$.fragment,s),n=!1},d(s){destroy_component(t,s)}}}function create_fragment$c(i){let t,n,s,o,r,l,a,c,u,f,h,p=i[5].version+"",g,b,v,y,S,T,w,A=[],x=new Map,C,I,M,E,L,R=i[4]&&create_if_block_3$3(i),O=i[6];const B=N=>N[15];for(let N=0;N diff --git a/app/dist/index.html b/app/dist/index.html index 9aeb2cdb..41b6b00a 100644 --- a/app/dist/index.html +++ b/app/dist/index.html @@ -6,7 +6,7 @@ Sphinx Stack - + From d28d460d6174c714d7434c07efdfc32007407608 Mon Sep 17 00:00:00 2001 From: kevkevinpal Date: Thu, 3 Oct 2024 16:42:24 -0400 Subject: [PATCH 14/14] fix: removed these env vars because they already use SECOND_BRAIN_BASE_URL in jarvis so no need to define here cause it causes multiple areas we need to define correctly --- src/images/jarvis.rs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/images/jarvis.rs b/src/images/jarvis.rs index 22c68465..2c928fb5 100644 --- a/src/images/jarvis.rs +++ b/src/images/jarvis.rs @@ -99,22 +99,6 @@ fn jarvis( env.push(format!("RADAR_YOUTUBE_WEBHOOK=https://{}/v2/addnode", h)); env.push(format!("RADAR_RSS_WEBHOOK=https://{}/v2/addnode", h)); env.push(format!("TLDR_WEBHOOK=https://{}/v1/tldr", h)); - env.push(format!( - "ASK_QUESTION_WEBHOOK=https://{}/hook/ask-question", - h - )); - env.push(format!( - "RELEVANT_QUESTIONS_WEBHOOK=https://{}/hook/relevant-question", - h - )); - env.push(format!( - "EXTRACTED_ENTITIES_WEBHOOK=https://{}/hook/extracted-entities", - h - )); - env.push(format!( - "ANSWER_SOURCES_WEBHOOK=https://{}/hook/answer-sources", - h - )); env.push(format!( "SECOND_BRAIN_GRAPH_URL=https://{}/get_elasticsearch_entities", h