diff --git a/Cargo.lock b/Cargo.lock index 8a03987..fe97c71 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "actix" @@ -485,11 +485,13 @@ dependencies = [ "bsnext_client", "bsnext_dto", "bsnext_fs", + "bsnext_fs_helpers", "bsnext_guards", "bsnext_input", "bsnext_resp", "bsnext_utils", "bytes", + "clap", "futures", "futures-util", "http", @@ -501,6 +503,7 @@ dependencies = [ "serde", "serde_json", "serde_yaml", + "thiserror", "tokio", "tokio-stream", "tower 0.4.13", @@ -550,6 +553,14 @@ dependencies = [ "tracing", ] +[[package]] +name = "bsnext_fs_helpers" +version = "0.1.0" +dependencies = [ + "thiserror", + "tracing", +] + [[package]] name = "bsnext_guards" version = "0.3.1" @@ -570,6 +581,7 @@ dependencies = [ "indent", "insta", "scraper", + "tracing", "unindent", ] @@ -578,6 +590,7 @@ name = "bsnext_input" version = "0.3.1" dependencies = [ "anyhow", + "bsnext_fs_helpers", "bsnext_guards", "bsnext_resp", "bsnext_tracing", @@ -617,6 +630,7 @@ version = "0.3.1" dependencies = [ "ansi_term", "anyhow", + "bsnext_core", "bsnext_dto", "bsnext_input", "chrono", @@ -659,6 +673,7 @@ dependencies = [ "bsnext_dto", "bsnext_example", "bsnext_fs", + "bsnext_fs_helpers", "bsnext_html", "bsnext_input", "bsnext_md", @@ -666,6 +681,8 @@ dependencies = [ "bsnext_tracing", "bsnext_yaml", "clap", + "futures-util", + "http", "insta", "rand", "tempfile", diff --git a/crates/bsnext_core/Cargo.toml b/crates/bsnext_core/Cargo.toml index 5def44b..ef31f23 100644 --- a/crates/bsnext_core/Cargo.toml +++ b/crates/bsnext_core/Cargo.toml @@ -10,6 +10,7 @@ bsnext_utils = { path = "../bsnext_utils" } [dependencies] bsnext_input = { path = "../bsnext_input" } +bsnext_fs_helpers = { path = "../bsnext_fs_helpers" } bsnext_fs = { path = "../bsnext_fs" } bsnext_resp = { path = "../bsnext_resp" } bsnext_client = { path = "../bsnext_client" } @@ -23,6 +24,7 @@ hyper-util = { version = "0.1.1", features = ["client-legacy"] } mime_guess = { workspace = true } insta = { workspace = true } +clap = { workspace = true } axum = { workspace = true } http-body-util = { workspace = true } tokio = { workspace = true } @@ -33,6 +35,7 @@ tracing = { workspace = true } actix = { workspace = true } actix-rt = { workspace = true } anyhow = { workspace = true } +thiserror = { workspace = true } futures = { workspace = true } futures-util = { workspace = true } serde = { workspace = true } diff --git a/crates/bsnext_core/src/export.rs b/crates/bsnext_core/src/export.rs new file mode 100644 index 0000000..5db68ae --- /dev/null +++ b/crates/bsnext_core/src/export.rs @@ -0,0 +1,184 @@ +use crate::runtime_ctx::RuntimeCtx; +use crate::server::router::common::{into_state, uri_to_res_parts}; +use bsnext_fs_helpers::{FsWriteError, WriteMode}; +use bsnext_input::route::{Route, RouteKind}; +use bsnext_input::server_config::ServerConfig; +use futures_util::future::join_all; +use http::response::Parts; +use std::clone::Clone; +use std::fs; +use std::path::{Path, PathBuf}; +use std::time::Duration; + +#[derive(Debug)] +pub enum ExportEvent { + DryRunDirCreate(PathBuf), + DryRunFileCreate(PathBuf), + DidCreateFile(PathBuf), + DidCreateDir(PathBuf), + Failed { error: ExportError }, +} + +#[derive(Debug, thiserror::Error)] +pub enum ExportError { + #[error("{0}")] + Fs(FsWriteError), +} + +#[derive(Debug, clap::Parser)] +pub struct ExportCommand { + /// The folder to export the files to. For current, provide '.' + #[arg(long = "dir")] + pub out_dir: PathBuf, + /// When provided, just prints what might happen instead of actually causing side effects + #[arg(long)] + pub dry_run: bool, + /// when providing, will overwrite existing files + #[arg(long)] + pub force: bool, +} + +#[derive(Debug)] +enum ExportType { + Write { + export_result: ExportResult, + filepath: PathBuf, + }, + Excluded { + reason: ExcludeReason, + }, +} + +#[derive(Debug)] +enum ExcludeReason { + BadRequest, +} + +#[derive(Debug)] +struct ExportRequest<'a> { + pub url_path: &'a str, + pub filepath: PathBuf, +} + +type ExportResult = (Parts, String, Duration); + +pub async fn export_one_server( + cwd: &PathBuf, + server: ServerConfig, + cmd: &ExportCommand, + write_mode: WriteMode, +) -> Result, ExportError> { + let routes = server.combined_routes(); + let state = into_state(server); + + let raw_entries = routes.iter().filter_map(only_raw_entries); + let raw_entry_paths = raw_entries.clone().map(|r| r.filepath); + let async_requests = raw_entries.map(|req| uri_to_res_parts(state.clone(), req.url_path)); + + let ctx = RuntimeCtx::new(cwd); + // let job_count = raw_entry_paths.len(); + + let results = join_all(async_requests) + .await + .into_iter() + .zip(raw_entry_paths) + .map(to_export_type) + .try_fold(vec![], move |mut acc, ref ex_type| match cmd.dry_run { + true => match print_sink(ex_type, &cmd.out_dir, &ctx) { + Ok(evts) => { + acc.extend(evts); + Ok(acc) + } + Err(e) => Err(e), + }, + false => match fs_sink(ex_type, &cmd.out_dir, &ctx, &write_mode) { + Ok(evts) => { + acc.extend(evts); + Ok(acc) + } + Err(e) => Err(e), + }, + }); + + match results { + Ok(events) => Ok(events), + Err(e) => Ok(vec![ExportEvent::Failed { error: e }]), + } +} + +fn fs_sink( + ex_type: &ExportType, + out_dir: &PathBuf, + ctx: &RuntimeCtx, + write_mode: &WriteMode, +) -> Result, ExportError> { + match ex_type { + ExportType::Write { + export_result, + filepath, + } => { + let filepath = ctx.cwd().join(out_dir).join(filepath); + write_one(export_result, &filepath, ctx, write_mode).map_err(ExportError::Fs) + } + ExportType::Excluded { reason: _ } => Ok(vec![]), + } +} + +fn print_sink( + ex_type: &ExportType, + out_dir: &PathBuf, + ctx: &RuntimeCtx, +) -> Result, ExportError> { + let mut events = vec![]; + match ex_type { + ExportType::Write { filepath, .. } => { + let path = ctx.cwd().join(out_dir).join(filepath); + events.push(ExportEvent::DryRunFileCreate(path)); + } + ExportType::Excluded { reason } => { + todo!("Ignoring {:?}", reason) + } + } + Ok(events) +} + +fn to_export_type((export_result, filepath): (ExportResult, PathBuf)) -> ExportType { + let (parts, _, _) = &export_result; + if parts.status.as_u16() == 200 { + ExportType::Write { + export_result, + filepath, + } + } else { + ExportType::Excluded { + reason: ExcludeReason::BadRequest, + } + } +} + +fn only_raw_entries(route: &Route) -> Option { + match &route.kind { + RouteKind::Raw(..) => Some(ExportRequest { + filepath: route.as_filepath(), + url_path: route.url_path(), + }), + _ => None, + } +} + +fn write_one( + export_result: &ExportResult, + filepath: &Path, + ctx: &RuntimeCtx, + write_mode: &WriteMode, +) -> Result, FsWriteError> { + let dir = filepath.parent(); + let mut events = vec![]; + if let Some(dir) = dir { + fs::create_dir_all(dir).map_err(FsWriteError::FailedDir)?; + } + let (_, ref body, _) = export_result; + let pb = bsnext_fs_helpers::fs_write_str(ctx.cwd(), filepath, body, write_mode)?; + events.push(ExportEvent::DidCreateFile(pb.clone())); + Ok(events) +} diff --git a/crates/bsnext_core/src/lib.rs b/crates/bsnext_core/src/lib.rs index 751d4de..73048fc 100644 --- a/crates/bsnext_core/src/lib.rs +++ b/crates/bsnext_core/src/lib.rs @@ -2,7 +2,8 @@ pub mod server; pub mod servers_supervisor; pub mod dir_loader; -mod handler_stack; +pub mod export; +pub mod handler_stack; pub mod handlers; pub mod meta; pub mod not_found; diff --git a/crates/bsnext_dto/src/server_stuff.rs b/crates/bsnext_dto/src/server_stuff.rs deleted file mode 100644 index 8b13789..0000000 --- a/crates/bsnext_dto/src/server_stuff.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/crates/bsnext_fs/src/watcher.rs b/crates/bsnext_fs/src/watcher.rs index e1844fb..ee2c692 100644 --- a/crates/bsnext_fs/src/watcher.rs +++ b/crates/bsnext_fs/src/watcher.rs @@ -128,16 +128,15 @@ fn is_auto_excluded>(cwd: &P, subject: &P) -> bool { .map(OsStr::new) .collect(); let rel = subject.as_ref().strip_prefix(cwd.as_ref()); - return rel - .map(|p| match p.components().next() { - None => false, - Some(Component::Normal(str)) => excluded.contains(str), - Some(Component::Prefix(_)) => unreachable!("here? Prefix"), - Some(Component::RootDir) => unreachable!("here? RootDir"), - Some(Component::CurDir) => unreachable!("here? CurDir"), - Some(Component::ParentDir) => unreachable!("here? ParentDir"), - }) - .unwrap_or(false); + rel.map(|p| match p.components().next() { + None => false, + Some(Component::Normal(str)) => excluded.contains(str), + Some(Component::Prefix(_)) => unreachable!("here? Prefix"), + Some(Component::RootDir) => unreachable!("here? RootDir"), + Some(Component::CurDir) => unreachable!("here? CurDir"), + Some(Component::ParentDir) => unreachable!("here? ParentDir"), + }) + .unwrap_or(false) } #[test] diff --git a/crates/bsnext_fs_helpers/Cargo.toml b/crates/bsnext_fs_helpers/Cargo.toml new file mode 100644 index 0000000..f0b3be9 --- /dev/null +++ b/crates/bsnext_fs_helpers/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "bsnext_fs_helpers" +version = "0.1.0" +edition = "2021" + +[dependencies] +tracing = { workspace = true } +thiserror = { workspace = true } diff --git a/crates/bsnext_fs_helpers/src/lib.rs b/crates/bsnext_fs_helpers/src/lib.rs new file mode 100644 index 0000000..01ec79f --- /dev/null +++ b/crates/bsnext_fs_helpers/src/lib.rs @@ -0,0 +1,84 @@ +use std::fs; +use std::path::{Path, PathBuf}; + +#[derive(Debug, thiserror::Error)] +pub enum FsWriteError { + #[error("couldn't write file to {path}")] + FailedWrite { path: PathBuf }, + #[error("couldn't create dir {0}")] + FailedDir(#[from] std::io::Error), + #[error("couldn't read the status of {path}")] + CannotQueryStatus { path: PathBuf }, + #[error("file already exists, override with --force (dangerous) {path}")] + Exists { path: PathBuf }, +} + +#[derive(Debug, thiserror::Error)] +#[error(transparent)] +pub enum DirError { + #[error("could not create that dir: {path}")] + CannotCreate { path: PathBuf }, + #[error("could not change the process CWD to: {path}")] + CannotMove { path: PathBuf }, + #[error("could not query the status")] + CannotQueryStatus { path: PathBuf }, + #[error("directory already exists, override with --force (dangerous) {path}")] + Exists { path: PathBuf }, +} + +#[derive(Default, Debug, PartialEq)] +pub enum WriteMode { + #[default] + Safe, + Override, +} + +pub fn fs_write_str( + cwd: &Path, + path: &Path, + string: &str, + write_mode: &WriteMode, +) -> Result { + let next_path = cwd.join(path); + tracing::info!( + "✏️ writing {} bytes to {}", + string.len(), + next_path.display() + ); + + let exists = fs::exists(&next_path).map_err(|_e| FsWriteError::CannotQueryStatus { + path: next_path.clone(), + })?; + + if exists && *write_mode == WriteMode::Safe { + return Err(FsWriteError::Exists { path: next_path }); + } + + fs::write(&next_path, string) + .map(|()| next_path.clone()) + .map_err(|_e| FsWriteError::FailedWrite { path: next_path }) +} + +/// Create a directory and move the current process's CWD there +pub fn create_dir_and_cd(dir: &Path, write_mode: &WriteMode) -> Result { + let exists = fs::exists(dir).map_err(|_e| DirError::CannotQueryStatus { + path: dir.to_path_buf(), + })?; + + if exists && *write_mode == WriteMode::Safe { + return Err(DirError::Exists { + path: dir.to_path_buf(), + }); + } + + fs::create_dir_all(dir) + .map_err(|_e| DirError::CannotCreate { + path: dir.to_path_buf(), + }) + .and_then(|_pb| { + std::env::set_current_dir(dir).map_err(|_e| DirError::CannotMove { + path: dir.to_path_buf(), + }) + }) + .map(|_| dir.to_path_buf()) +} diff --git a/crates/bsnext_html/Cargo.toml b/crates/bsnext_html/Cargo.toml index 822acf4..8c4ca3b 100644 --- a/crates/bsnext_html/Cargo.toml +++ b/crates/bsnext_html/Cargo.toml @@ -8,6 +8,7 @@ bsnext_input = { path = "../bsnext_input" } unindent = "0.2.3" indent = "0.1.1" scraper = { git = "https://github.com/shakyShane/scraper.git", branch = "master" } +tracing = { workspace = true } [dev-dependencies] anyhow = { workspace = true } diff --git a/crates/bsnext_html/src/lib.rs b/crates/bsnext_html/src/lib.rs index 387f669..2bbff9b 100644 --- a/crates/bsnext_html/src/lib.rs +++ b/crates/bsnext_html/src/lib.rs @@ -32,11 +32,11 @@ fn playground_html_str_to_input(html: &str, ctx: &InputCtx) -> Result Result { - let joined = format!("{} {}", name, content); - let r = Route::from_cli_str(joined); - if let Ok(route) = r { - routes.push(route); - node_ids_to_remove.push(x.id()); - } + for meta_elem in meta_elems { + let name = meta_elem.attr("name"); + let content = meta_elem.attr("content"); + + if !name.unwrap().starts_with("bslive ") { + continue; + } + + let joined = match (name, content) { + (Some(name), Some(content)) => Some(format!("{} {}", name, content)), + (Some(name), None) => Some(format!("{}", name)), + _ => None, + }; + + if let Some(joined) = joined { + if let Ok(route) = Route::from_cli_str(joined) { + routes.push(route); + node_ids_to_remove.push(meta_elem.id()); + } else { + tracing::error!("cannot parse CLI args"); } - _ => todo!("not supported!"), } } diff --git a/crates/bsnext_html/tests/html_playground.rs b/crates/bsnext_html/tests/html_playground.rs index 88f905d..d23700c 100644 --- a/crates/bsnext_html/tests/html_playground.rs +++ b/crates/bsnext_html/tests/html_playground.rs @@ -108,3 +108,31 @@ fn test_html_playground_with_meta() -> anyhow::Result<()> { assert_debug_snapshot!(found.kind); Ok(()) } + +const INPUT_WITH_META_DEFAULT: &str = r#" + +
+

Test!

+ +
"#; + +/// In this test, I am making sure `bslive serve-dir` works the same as the long-hand version above +#[test] +fn test_html_playground_with_meta_default() -> anyhow::Result<()> { + let ident = ServerIdentity::Address { + bind_address: String::from("0.0.0.0:8080"), + }; + let input_args = InputArgs { port: Some(8080) }; + let ctx = InputCtx::new(&[], Some(input_args)); + let as_input = HtmlFs::from_input_str(INPUT_WITH_META_DEFAULT, &ctx)?; + let first = as_input.servers.get(0).unwrap(); + assert_eq!(first.identity, ident); + let routes = first.combined_routes(); + let found2 = routes + .iter() + .find(|x| matches!(x.kind, RouteKind::Dir(..))) + .expect("must find dir"); + assert_debug_snapshot!(found2.path); + assert_debug_snapshot!(found2.kind); + Ok(()) +} diff --git a/crates/bsnext_html/tests/snapshots/html_playground__html_playground_with_meta_default-2.snap b/crates/bsnext_html/tests/snapshots/html_playground__html_playground_with_meta_default-2.snap new file mode 100644 index 0000000..6f81030 --- /dev/null +++ b/crates/bsnext_html/tests/snapshots/html_playground__html_playground_with_meta_default-2.snap @@ -0,0 +1,10 @@ +--- +source: crates/bsnext_html/tests/html_playground.rs +expression: found2.kind +--- +Dir( + DirRoute { + dir: ".", + base: None, + }, +) diff --git a/crates/bsnext_html/tests/snapshots/html_playground__html_playground_with_meta_default.snap b/crates/bsnext_html/tests/snapshots/html_playground__html_playground_with_meta_default.snap new file mode 100644 index 0000000..7e4d9e8 --- /dev/null +++ b/crates/bsnext_html/tests/snapshots/html_playground__html_playground_with_meta_default.snap @@ -0,0 +1,7 @@ +--- +source: crates/bsnext_html/tests/html_playground.rs +expression: found2.path +--- +PathDef { + inner: "/", +} diff --git a/crates/bsnext_input/Cargo.toml b/crates/bsnext_input/Cargo.toml index 1cb1f49..93d7bba 100644 --- a/crates/bsnext_input/Cargo.toml +++ b/crates/bsnext_input/Cargo.toml @@ -7,6 +7,7 @@ edition = "2021" [dependencies] bsnext_resp = { path = "../bsnext_resp" } +bsnext_fs_helpers = { path = "../bsnext_fs_helpers" } bsnext_tracing = { path = "../bsnext_tracing" } bsnext_guards = { path = "../bsnext_guards" } shell-words = { version = "1.1.0" } diff --git a/crates/bsnext_input/src/lib.rs b/crates/bsnext_input/src/lib.rs index 49e0cc0..496b429 100644 --- a/crates/bsnext_input/src/lib.rs +++ b/crates/bsnext_input/src/lib.rs @@ -1,5 +1,6 @@ use crate::server_config::ServerIdentity; use crate::yml::YamlError; +use bsnext_fs_helpers::{DirError, FsWriteError}; use miette::JSONReportHandler; use std::fmt::{Display, Formatter}; use std::net::AddrParseError; @@ -165,7 +166,7 @@ pub enum InputError { #[error("Unsupported extension: {0}")] UnsupportedExtension(String), #[error("{0}")] - InputWriteError(#[from] InputWriteError), + InputWriteError(#[from] FsWriteError), #[error("{0}")] PathError(#[from] PathError), #[error("{0}")] @@ -191,16 +192,6 @@ pub enum WatchError { EmptyExtensionFilter, } -#[derive(Debug, thiserror::Error)] -pub enum InputWriteError { - #[error("couldn't write input to {path}")] - FailedWrite { path: PathBuf }, - #[error("couldn't read the status of {path}")] - CannotQueryStatus { path: PathBuf }, - #[error("input already exists, override with --force (dangerous) {path}")] - Exists { path: PathBuf }, -} - #[derive(Debug, thiserror::Error, serde::Serialize, serde::Deserialize)] pub enum PathError { #[error("path(s) not found \n{paths}")] @@ -214,19 +205,6 @@ pub enum PortError { InvalidPort { port: u16, err: AddrParseError }, } -#[derive(Debug, thiserror::Error)] -#[error(transparent)] -pub enum DirError { - #[error("could not create that dir: {path}")] - CannotCreate { path: PathBuf }, - #[error("could not change the process CWD to: {path}")] - CannotMove { path: PathBuf }, - #[error("could not query the status")] - CannotQueryStatus { path: PathBuf }, - #[error("directory already exists, override with --force (dangerous) {path}")] - Exists { path: PathBuf }, -} - impl From for Box { fn from(value: DirError) -> Self { Box::new(InputError::DirError(value)) diff --git a/crates/bsnext_input/src/playground.rs b/crates/bsnext_input/src/playground.rs index 8b64d71..18bac1b 100644 --- a/crates/bsnext_input/src/playground.rs +++ b/crates/bsnext_input/src/playground.rs @@ -80,12 +80,12 @@ fn playground_wrap() -> InjectOpts { Browsersync Live - Playground - + "#; let append = r#" - + "#; diff --git a/crates/bsnext_input/src/route.rs b/crates/bsnext_input/src/route.rs index d9bffa9..2062b47 100644 --- a/crates/bsnext_input/src/route.rs +++ b/crates/bsnext_input/src/route.rs @@ -76,9 +76,27 @@ impl AsRef for Route { } impl Route { - pub fn path(&self) -> &str { + pub fn url_path(&self) -> &str { self.path.as_str() } + pub fn path_buf(&self) -> PathBuf { + PathBuf::from(self.path.as_str()) + } + pub fn as_filepath(&self) -> PathBuf { + let next = PathBuf::from(self.path.as_str()); + + let next = if next == PathBuf::from("/") { + next.join("index.html") + } else { + next + }; + + if next.starts_with("/") { + next.strip_prefix("/").unwrap().to_path_buf() + } else { + next + } + } pub fn from_cli_str>(a: A) -> Result { let cli = RouteCli::try_from_cli_str(a)?; cli.try_into() diff --git a/crates/bsnext_input/src/route_cli.rs b/crates/bsnext_input/src/route_cli.rs index 8931ae0..462c3f1 100644 --- a/crates/bsnext_input/src/route_cli.rs +++ b/crates/bsnext_input/src/route_cli.rs @@ -22,12 +22,11 @@ impl TryInto for RouteCli { fn try_into(self) -> Result { Ok(match self.command { - SubCommands::ServeDir { dir, path } => { - let mut route = Route::default(); - route.path = PathDef::try_new(path)?; - route.kind = RouteKind::Dir(DirRoute { dir, base: None }); - route - } + SubCommands::ServeDir { dir, path } => Route { + path: PathDef::try_new(path)?, + kind: RouteKind::Dir(DirRoute { dir, base: None }), + ..std::default::Default::default() + }, }) } } @@ -36,10 +35,11 @@ impl TryInto for RouteCli { pub enum SubCommands { /// does testing things ServeDir { - /// lists test values - #[arg(short, long)] + /// Which path should this directory be served from + #[arg(short, long, default_value = "/")] path: String, - #[arg(short, long)] + /// Which directory should be served + #[arg(short, long, default_value = ".")] dir: String, }, } diff --git a/crates/bsnext_md/tests/snapshots/md_playground__md_playground.snap b/crates/bsnext_md/tests/snapshots/md_playground__md_playground.snap index adf8ecd..2abb8d1 100644 --- a/crates/bsnext_md/tests/snapshots/md_playground__md_playground.snap +++ b/crates/bsnext_md/tests/snapshots/md_playground__md_playground.snap @@ -24,7 +24,7 @@ expression: routes inner: Addition( InjectAddition { addition_position: Prepend( - "\n\n \n \n \n \n Browsersync Live - Playground\n \n \n \n", + "\n\n \n \n \n \n Browsersync Live - Playground\n \n \n \n", ), }, ), @@ -40,7 +40,7 @@ expression: routes inner: Addition( InjectAddition { addition_position: Append( - "\n \n \n\n", + "\n \n \n\n", ), }, ), diff --git a/crates/bsnext_output/Cargo.toml b/crates/bsnext_output/Cargo.toml index c080ec8..d74226f 100644 --- a/crates/bsnext_output/Cargo.toml +++ b/crates/bsnext_output/Cargo.toml @@ -8,6 +8,7 @@ edition = "2021" [dependencies] bsnext_dto = { path = "../bsnext_dto" } bsnext_input = { path = "../bsnext_input" } +bsnext_core = { path = "../bsnext_core" } anyhow = { workspace = true } serde_json = { workspace = true } diff --git a/crates/bsnext_output/src/json.rs b/crates/bsnext_output/src/json.rs index 588a05f..436ae74 100644 --- a/crates/bsnext_output/src/json.rs +++ b/crates/bsnext_output/src/json.rs @@ -1,4 +1,5 @@ use crate::OutputWriter; +use bsnext_core::export::ExportEvent; use bsnext_dto::internal::{InternalEvents, InternalEventsDTO, StartupEvent}; use bsnext_dto::{ExternalEventsDTO, StartupEventDTO}; use std::io::Write; @@ -41,4 +42,12 @@ impl OutputWriter for JsonPrint { writeln!(sink, "{}", serde_json::to_string(&as_dto)?) .map_err(|e| anyhow::anyhow!(e.to_string())) } + + fn handle_export_event( + &self, + _sink: &mut W, + _evt: &ExportEvent, + ) -> anyhow::Result<()> { + todo!() + } } diff --git a/crates/bsnext_output/src/lib.rs b/crates/bsnext_output/src/lib.rs index 2862d55..a04df83 100644 --- a/crates/bsnext_output/src/lib.rs +++ b/crates/bsnext_output/src/lib.rs @@ -1,8 +1,10 @@ use crate::json::JsonPrint; use crate::pretty::PrettyPrint; use crate::ratatui::RatatuiSender; +use bsnext_core::export::ExportEvent; use bsnext_dto::internal::{InternalEvents, StartupEvent}; use bsnext_dto::ExternalEventsDTO; +use std::fmt::{Display, Formatter}; use std::io::Write; pub mod json; @@ -33,6 +35,11 @@ pub trait OutputWriter { ) -> anyhow::Result<()> { Ok(()) } + fn handle_export_event( + &self, + _sink: &mut W, + _evt: &ExportEvent, + ) -> anyhow::Result<()>; } pub enum Writers { @@ -41,6 +48,16 @@ pub enum Writers { Ratatui(RatatuiSender), } +impl Display for Writers { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + match self { + Writers::Pretty => write!(f, "Pretty"), + Writers::Json => write!(f, "Json"), + Writers::Ratatui(_) => write!(f, "Ratatui"), + } + } +} + impl OutputWriter for Writers { fn handle_external_event( &self, @@ -76,4 +93,12 @@ impl OutputWriter for Writers { Writers::Ratatui(r) => r.handle_startup_event(sink, evt), } } + + fn handle_export_event(&self, sink: &mut W, evt: &ExportEvent) -> anyhow::Result<()> { + match self { + Writers::Pretty => PrettyPrint.handle_export_event(sink, evt), + Writers::Json => JsonPrint.handle_export_event(sink, evt), + Writers::Ratatui(r) => r.handle_export_event(sink, evt), + } + } } diff --git a/crates/bsnext_output/src/pretty.rs b/crates/bsnext_output/src/pretty.rs index 6ed4d12..86a8414 100644 --- a/crates/bsnext_output/src/pretty.rs +++ b/crates/bsnext_output/src/pretty.rs @@ -1,4 +1,5 @@ use crate::OutputWriter; +use bsnext_core::export::{ExportError, ExportEvent}; use bsnext_dto::internal::{ChildResult, InternalEvents, StartupEvent}; use bsnext_dto::{ ExternalEventsDTO, FileChangedDTO, FilesChangedDTO, InputAcceptedDTO, ServerIdentityDTO, @@ -101,6 +102,31 @@ impl OutputWriter for PrettyPrint { } Ok(()) } + + fn handle_export_event(&self, sink: &mut W, evt: &ExportEvent) -> anyhow::Result<()> { + match evt { + ExportEvent::DryRunDirCreate(dir) => { + writeln!(sink, "[export:dry-run]: would create dir {}", dir.display())?; + } + ExportEvent::DryRunFileCreate(file) => writeln!( + sink, + "[export:dry-run]: would create file {}", + file.display() + )?, + ExportEvent::DidCreateFile(dir) => { + writeln!(sink, "[export]: did create file {}", dir.display())?; + } + ExportEvent::DidCreateDir(file) => { + writeln!(sink, "[export]: did create dir {}", file.display())?; + } + ExportEvent::Failed { + error: ExportError::Fs(fs_write_error), + } => { + writeln!(sink, "[export]: Error! {}", fs_write_error)?; + } + } + Ok(()) + } } // const prefix: ANSIGenericString = ansi_term::Color::Red.paint("[bslive]"); diff --git a/crates/bsnext_output/src/ratatui.rs b/crates/bsnext_output/src/ratatui.rs index 1a0400a..f8f4080 100644 --- a/crates/bsnext_output/src/ratatui.rs +++ b/crates/bsnext_output/src/ratatui.rs @@ -52,6 +52,14 @@ impl OutputWriter for RatatuiSender { } Ok(()) } + + fn handle_export_event( + &self, + _sink: &mut W, + _evt: &ExportEvent, + ) -> anyhow::Result<()> { + todo!() + } } impl OutputWriter for Ratatui { fn handle_startup_event( @@ -61,6 +69,14 @@ impl OutputWriter for Ratatui { ) -> anyhow::Result<()> { PrettyPrint.handle_startup_event(sink, evt) } + + fn handle_export_event( + &self, + _sink: &mut W, + _evt: &ExportEvent, + ) -> anyhow::Result<()> { + todo!() + } } impl Ratatui { @@ -389,6 +405,7 @@ mod common { } } +use bsnext_core::export::ExportEvent; use std::collections::VecDeque; #[derive(Debug)] diff --git a/crates/bsnext_system/Cargo.toml b/crates/bsnext_system/Cargo.toml index 52e7091..3f04201 100644 --- a/crates/bsnext_system/Cargo.toml +++ b/crates/bsnext_system/Cargo.toml @@ -13,6 +13,7 @@ bsnext_yaml = { path = "../bsnext_yaml" } bsnext_tracing = { path = "../bsnext_tracing" } bsnext_core = { path = "../bsnext_core" } bsnext_fs = { path = "../bsnext_fs" } +bsnext_fs_helpers = { path = "../bsnext_fs_helpers" } bsnext_dto = { path = "../bsnext_dto" } bsnext_example = { path = "../bsnext_example" } bsnext_output = { path = "../bsnext_output" } @@ -25,6 +26,8 @@ actix = { workspace = true } actix-rt = { workspace = true } tracing = { workspace = true } tempfile = { workspace = true } +futures-util = { workspace = true } +http = { workspace = true } [dev-dependencies] insta = { workspace = true } diff --git a/crates/bsnext_system/src/args.rs b/crates/bsnext_system/src/args.rs index 07ce89e..35a74e9 100644 --- a/crates/bsnext_system/src/args.rs +++ b/crates/bsnext_system/src/args.rs @@ -1,7 +1,7 @@ use crate::Example; +use bsnext_core::export::ExportCommand; use bsnext_input::target::TargetKind; use bsnext_tracing::{LogLevel, OutputFormat}; - // bslive route --path=/ --dir= #[derive(clap::Parser, Debug)] @@ -51,10 +51,19 @@ pub struct Args { #[arg(long, requires = "example", conflicts_with = "dir")] pub name: Option, - /// Only works with `--example` - specify a port instead of a random one + /// Only works with `--example` - specify a port instead of a random one #[arg(short, long)] pub port: Option, + #[command(subcommand)] + pub command: Option, + /// Paths to serve + possibly watch, incompatible with `-i` option pub paths: Vec, } + +#[derive(Debug, clap::Subcommand)] +pub enum SubCommands { + /// Export raw entries to files + Export(ExportCommand), +} diff --git a/crates/bsnext_system/src/cli.rs b/crates/bsnext_system/src/cli.rs index 84c8804..0d5669f 100644 --- a/crates/bsnext_system/src/cli.rs +++ b/crates/bsnext_system/src/cli.rs @@ -1,20 +1,11 @@ -use crate::args::Args; -use crate::start_kind::StartKind; -use crate::{AnyEvent, BsSystem, Start}; -use actix::Actor; +use crate::args::{Args, SubCommands}; -use bsnext_dto::internal::StartupEvent; -use bsnext_input::startup::DidStart; -use bsnext_output::ratatui::Ratatui; -use bsnext_output::{OutputWriter, Writers}; -use bsnext_tracing::{init_tracing, OutputFormat, WriteOption}; +use crate::commands::{export_cmd, start_command}; +use bsnext_tracing::{init_tracing, WriteOption}; use clap::Parser; use std::env::current_dir; use std::ffi::OsString; -use std::io::Write; use std::path::PathBuf; -use tokio::sync::{mpsc, oneshot}; -use tracing::debug_span; /// The typical lifecycle when ran from a CLI environment pub async fn from_args(itr: I) -> Result<(), anyhow::Error> @@ -25,7 +16,6 @@ where std::env::set_var("RUST_LIB_BACKTRACE", "0"); let cwd = PathBuf::from(current_dir().unwrap().to_string_lossy().to_string()); let args = Args::parse_from(itr); - let format_clone = args.format; let write_opt = if args.write_log { WriteOption::File } else { @@ -36,133 +26,10 @@ where tracing::debug!("{:#?}", args); - let (tx, rx) = oneshot::channel(); - let (events_sender, mut events_receiver) = mpsc::channel::(1); - - let system = BsSystem::new(); - let sys_addr = system.start(); - - let start_kind = StartKind::from_args(args); - - tracing::debug!(?start_kind); - - let start = Start { - kind: start_kind, - cwd: Some(cwd), - ack: tx, - events_sender, - }; - - // for the startup message, don't allow a TUI yet - let start_printer = match format_clone { - OutputFormat::Tui => Writers::Pretty, - OutputFormat::Json => Writers::Json, - OutputFormat::Normal => Writers::Pretty, - }; - - let stdout = &mut std::io::stdout(); - - match sys_addr.send(start).await? { - Ok(DidStart::Started) => { - let evt = StartupEvent::Started; - match start_printer.handle_startup_event(stdout, &evt) { - Ok(_) => {} - Err(e) => tracing::error!(?e), - }; - match stdout.flush() { - Ok(_) => {} - Err(e) => tracing::error!("could not flush {e}"), - }; - } - Err(e) => { - let evt = StartupEvent::FailedStartup(e); - match start_printer.handle_startup_event(stdout, &evt) { - Ok(_) => {} - Err(e) => tracing::error!(?e), - }; - match stdout.flush() { - Ok(_) => {} - Err(e) => tracing::error!("could not flush {e}"), - }; - return Err(anyhow::anyhow!("could not flush")); - } - }; - - // at this point, we started, so we can choose a TUI - let printer = match format_clone { - OutputFormat::Tui => { - let rr = Ratatui::try_new().expect("test"); - let (sender, _ui_handle, _other) = rr.install().expect("thread install"); - Writers::Ratatui(sender) - } - OutputFormat::Json => Writers::Json, - OutputFormat::Normal => Writers::Pretty, - }; - - let events_handler = tokio::spawn(async move { - // let events = vec![]; - let stdout = &mut std::io::stdout(); - - while let Some(evt) = events_receiver.recv().await { - let span = debug_span!("External Event processor"); - let _g2 = span.enter(); - tracing::debug!(external_event=?evt); - let r = match evt { - AnyEvent::Internal(int) => printer.handle_internal_event(stdout, int), - AnyEvent::External(ext) => printer.handle_external_event(stdout, &ext), - }; - match stdout.flush() { - Ok(_) => {} - Err(e) => tracing::error!("could not flush {e}"), - }; - match r { - Ok(_) => {} - Err(_) => tracing::error!("could not handle event"), - } - } - }); - - match rx.await { - Ok(_) => { - tracing::info!("servers ended"); - } - Err(e) => { - // dropped? this is ok - tracing::trace!(?e, ""); - } - }; - - match events_handler.await { - Ok(_) => { - tracing::info!("events ended"); - } - Err(e) => { - // dropped? this is ok - tracing::trace!(?e, ""); - } + match &args.command { + None => start_command::start_cmd(cwd, args).await, + Some(command) => match command { + SubCommands::Export(cmd) => export_cmd::export_cmd(&cwd, cmd, &args).await, + }, } - - // match ui_handle.join() { - // Ok(_) => {} - // Err(e) => tracing::error!(?e), - // }; - - // match events_handler.await { - // Ok(v) => { - // tracing::info!(?v, "events seen"); - // let errors = v - // .iter() - // .filter(|e| matches!(e, ExternalEvents::InputError(..))) - // .collect::>(); - // if !errors.is_empty() { - // tracing::info!("stopped for the following reasons"); - // for msg in errors { - // tracing::error!(?msg); - // } - // return Err(anyhow::anyhow!("exited...")); - // } - // } - // Err(e) => tracing::error!(?e), - // } - Ok(()) } diff --git a/crates/bsnext_system/src/commands.rs b/crates/bsnext_system/src/commands.rs new file mode 100644 index 0000000..86d22c3 --- /dev/null +++ b/crates/bsnext_system/src/commands.rs @@ -0,0 +1,2 @@ +pub mod export_cmd; +pub mod start_command; diff --git a/crates/bsnext_system/src/commands/export_cmd.rs b/crates/bsnext_system/src/commands/export_cmd.rs new file mode 100644 index 0000000..7d0468d --- /dev/null +++ b/crates/bsnext_system/src/commands/export_cmd.rs @@ -0,0 +1,84 @@ +use crate::args::Args; +use crate::start_kind::StartKind; +use bsnext_core::export::{export_one_server, ExportCommand, ExportEvent}; +use bsnext_fs_helpers::WriteMode; +use bsnext_input::startup::{StartupContext, SystemStart, SystemStartArgs}; +use bsnext_output::{OutputWriter, Writers}; +use bsnext_tracing::OutputFormat; +use std::io::Write; +use std::path::PathBuf; + +pub async fn export_cmd( + cwd: &PathBuf, + cmd: &ExportCommand, + args: &Args, +) -> Result<(), anyhow::Error> { + let format_clone = args.format; + + let printer = match format_clone { + OutputFormat::Tui => Writers::Pretty, + OutputFormat::Json => Writers::Json, + OutputFormat::Normal => Writers::Pretty, + }; + tracing::debug!("printer: {}", printer); + + let ctx = StartupContext::from_cwd(Some(cwd)); + tracing::debug!("StartupContext: {:?}", ctx); + + let start_kind = StartKind::from_args(args).input(&ctx); + + match start_kind { + Err(e) => eprintln!("an error occured here?, {}", e), + Ok(SystemStartArgs::InputOnly { input: _ }) => todo!("handle InputOnly?"), + Ok(SystemStartArgs::PathWithInput { path: _, input }) if input.servers.len() == 1 => { + let first = &input.servers[0]; + + let write_mode = if cmd.force { + WriteMode::Override + } else { + WriteMode::Safe + }; + + let events = export_one_server(cwd, first.clone(), cmd, write_mode).await?; + + let has_error = events + .iter() + .any(|e| matches!(e, ExportEvent::Failed { .. })); + + let stdout = &mut std::io::stdout(); + let stderr = &mut std::io::stderr(); + + for export_event in &events { + match &export_event { + ExportEvent::Failed { .. } => { + match printer.handle_export_event(stderr, export_event) { + Ok(_) => {} + Err(e) => tracing::error!(?e), + }; + } + _ => { + match printer.handle_export_event(stdout, export_event) { + Ok(_) => {} + Err(e) => tracing::error!(?e), + }; + } + } + } + + match (stderr.flush(), stdout.flush()) { + (Ok(_), Ok(_)) => {} + _ => tracing::error!("could not flush"), + }; + if has_error { + return Err(anyhow::anyhow!("export failed")); + } + } + Ok(SystemStartArgs::PathWithInput { path: _, input: _ }) => { + // let first = + // let _result = export_one_server(cwd, cmd).await; + todo!("handle more than 1 server for export?") + } + Ok(SystemStartArgs::PathWithInvalidInput { .. }) => todo!("handle PathWithInvalidInput?"), + } + Ok(()) +} diff --git a/crates/bsnext_system/src/commands/start_command.rs b/crates/bsnext_system/src/commands/start_command.rs new file mode 100644 index 0000000..39fe176 --- /dev/null +++ b/crates/bsnext_system/src/commands/start_command.rs @@ -0,0 +1,124 @@ +use crate::args::Args; +use crate::start_kind::StartKind; +use crate::{BsSystem, Start}; +use actix::Actor; +use bsnext_dto::internal::{AnyEvent, StartupEvent}; +use bsnext_input::startup::DidStart; +use bsnext_output::ratatui::Ratatui; +use bsnext_output::{OutputWriter, Writers}; +use bsnext_tracing::OutputFormat; +use std::io::Write; +use std::path::PathBuf; +use tokio::sync::{mpsc, oneshot}; +use tracing::debug_span; + +pub async fn start_cmd(cwd: PathBuf, args: Args) -> Result<(), anyhow::Error> { + let (tx, rx) = oneshot::channel(); + let (events_sender, mut events_receiver) = mpsc::channel::(1); + + let system = BsSystem::new(); + let sys_addr = system.start(); + let format_clone = args.format; + + // for the startup message, don't allow a TUI yet + let start_printer = match format_clone { + OutputFormat::Tui => Writers::Pretty, + OutputFormat::Json => Writers::Json, + OutputFormat::Normal => Writers::Pretty, + }; + + let start_kind = StartKind::from_args(&args); + + tracing::debug!(?start_kind); + + let start = Start { + kind: start_kind, + cwd: Some(cwd), + ack: tx, + events_sender, + }; + + let stdout = &mut std::io::stdout(); + + match sys_addr.send(start).await? { + Ok(DidStart::Started) => { + let evt = StartupEvent::Started; + match start_printer.handle_startup_event(stdout, &evt) { + Ok(_) => {} + Err(e) => tracing::error!(?e), + }; + match stdout.flush() { + Ok(_) => {} + Err(e) => tracing::error!("could not flush {e}"), + }; + } + Err(e) => { + let evt = StartupEvent::FailedStartup(e); + match start_printer.handle_startup_event(stdout, &evt) { + Ok(_) => {} + Err(e) => tracing::error!(?e), + }; + match stdout.flush() { + Ok(_) => {} + Err(e) => tracing::error!("could not flush {e}"), + }; + return Err(anyhow::anyhow!("could not flush")); + } + }; + + // at this point, we started, so we can choose a TUI + let printer = match format_clone { + OutputFormat::Tui => { + let rr = Ratatui::try_new().expect("test"); + let (sender, _ui_handle, _other) = rr.install().expect("thread install"); + Writers::Ratatui(sender) + } + OutputFormat::Json => Writers::Json, + OutputFormat::Normal => Writers::Pretty, + }; + + let events_handler = tokio::spawn(async move { + // let events = vec![]; + let stdout = &mut std::io::stdout(); + + while let Some(evt) = events_receiver.recv().await { + let span = debug_span!("External Event processor"); + let _g2 = span.enter(); + tracing::debug!(external_event=?evt); + let r = match evt { + AnyEvent::Internal(int) => printer.handle_internal_event(stdout, int), + AnyEvent::External(ext) => printer.handle_external_event(stdout, &ext), + }; + match stdout.flush() { + Ok(_) => {} + Err(e) => tracing::error!("could not flush {e}"), + }; + match r { + Ok(_) => {} + Err(_) => tracing::error!("could not handle event"), + } + } + }); + + match rx.await { + Ok(_) => { + tracing::info!("servers ended"); + } + Err(e) => { + // dropped? this is ok + tracing::trace!(?e, ""); + } + }; + + match events_handler.await { + Ok(_) => { + tracing::info!("events ended"); + } + Err(e) => { + // dropped? this is ok + tracing::trace!(?e, ""); + } + } + + Ok(()) +} diff --git a/crates/bsnext_system/src/lib.rs b/crates/bsnext_system/src/lib.rs index e74db75..f9a498d 100644 --- a/crates/bsnext_system/src/lib.rs +++ b/crates/bsnext_system/src/lib.rs @@ -34,6 +34,7 @@ use tracing::{debug_span, Instrument}; pub mod args; pub mod cli; +pub mod commands; pub mod input_fs; pub mod monitor; mod monitor_any_watchables; diff --git a/crates/bsnext_system/src/start_kind.rs b/crates/bsnext_system/src/start_kind.rs index bcd0565..fac4dcb 100644 --- a/crates/bsnext_system/src/start_kind.rs +++ b/crates/bsnext_system/src/start_kind.rs @@ -2,8 +2,12 @@ use crate::args::Args; use crate::start_kind::start_from_example::StartFromExample; use crate::start_kind::start_from_inputs::{StartFromInput, StartFromInputPaths}; use crate::start_kind::start_from_paths::StartFromDirPaths; +use bsnext_fs_helpers::{fs_write_str, FsWriteError, WriteMode}; use bsnext_input::startup::{StartupContext, SystemStart, SystemStartArgs}; +use bsnext_input::target::TargetKind; +use bsnext_input::InputWriter; use bsnext_input::{Input, InputError}; +use std::path::{Path, PathBuf}; pub mod start_from_example; pub mod start_from_inputs; @@ -18,15 +22,19 @@ pub enum StartKind { } impl StartKind { - pub fn from_args(args: Args) -> Self { + pub fn from_args(args: &Args) -> Self { if let Some(example) = args.example { return StartKind::FromExample(StartFromExample { example, write_input: args.write, port: args.port, temp: args.temp, - name: args.name, - target_kind: args.target.unwrap_or_default(), + name: args.name.clone(), + target_kind: args + .target + .as_ref() + .map(ToOwned::to_owned) + .unwrap_or_default(), dir: args.dir.clone(), force: args.force, }); @@ -34,7 +42,7 @@ impl StartKind { if !args.paths.is_empty() { StartKind::FromDirPaths(StartFromDirPaths { - paths: args.paths, + paths: args.paths.clone(), write_input: args.write, port: args.port, force: args.force, @@ -62,97 +70,24 @@ impl SystemStart for StartKind { } } -pub mod start_fs { - - use std::fs; - use std::path::{Path, PathBuf}; - - use bsnext_input::target::TargetKind; - use bsnext_input::{DirError, Input, InputWriteError, InputWriter}; - - #[derive(Default, Debug, PartialEq)] - pub enum WriteMode { - #[default] - Safe, - Override, - } - pub fn fs_write_input( - cwd: &Path, - input: &Input, - target_kind: TargetKind, - write_mode: &WriteMode, - ) -> Result { - let string = match target_kind { - TargetKind::Yaml => bsnext_yaml::yaml_writer::YamlWriter.input_to_str(input), - TargetKind::Toml => todo!("toml missing"), - TargetKind::Md => bsnext_md::md_writer::MdWriter.input_to_str(input), - TargetKind::Html => bsnext_html::html_writer::HtmlWriter.input_to_str(input), - }; - let name = match target_kind { - TargetKind::Yaml => "bslive.yml", - TargetKind::Toml => todo!("toml missing"), - TargetKind::Md => "bslive.md", - TargetKind::Html => "bslive.html", - }; - let next_path = cwd.join(name); - tracing::info!( - "✏️ writing {} bytes to {}", - string.len(), - next_path.display() - ); - - let exists = fs::exists(&next_path).map_err(|_e| InputWriteError::CannotQueryStatus { - path: next_path.clone(), - })?; - - if exists && *write_mode == WriteMode::Safe { - return Err(InputWriteError::Exists { path: next_path }); - } - - fs::write(&next_path, string) - .map(|()| next_path.clone()) - .map_err(|_e| InputWriteError::FailedWrite { path: next_path }) - } - pub fn fs_write_input_src( - cwd: &Path, - path: &Path, - string: &str, - write_mode: &WriteMode, - ) -> Result { - let next_path = cwd.join(path); - tracing::info!( - "✏️ writing {} bytes to {}", - string.len(), - next_path.display() - ); - - let exists = fs::exists(&next_path).map_err(|_e| InputWriteError::CannotQueryStatus { - path: next_path.clone(), - })?; - - if exists && *write_mode == WriteMode::Safe { - return Err(InputWriteError::Exists { path: next_path }); - } - - fs::write(&next_path, string) - .map(|()| next_path.clone()) - .map_err(|_e| InputWriteError::FailedWrite { path: next_path }) - } - - pub fn create_dir(dir: &PathBuf, write_mode: &WriteMode) -> Result { - let exists = - fs::exists(dir).map_err(|_e| DirError::CannotQueryStatus { path: dir.clone() })?; - - if exists && *write_mode == WriteMode::Safe { - return Err(DirError::Exists { path: dir.clone() }); - } - - fs::create_dir_all(dir) - .map_err(|_e| DirError::CannotCreate { path: dir.clone() }) - .and_then(|_pb| { - std::env::set_current_dir(dir) - .map_err(|_e| DirError::CannotMove { path: dir.clone() }) - }) - .map(|_| dir.clone()) - } +pub fn fs_write_input( + cwd: &Path, + input: &Input, + target_kind: TargetKind, + write_mode: &WriteMode, +) -> Result { + let string = match target_kind { + TargetKind::Yaml => bsnext_yaml::yaml_writer::YamlWriter.input_to_str(input), + TargetKind::Toml => todo!("toml missing"), + TargetKind::Md => bsnext_md::md_writer::MdWriter.input_to_str(input), + TargetKind::Html => bsnext_html::html_writer::HtmlWriter.input_to_str(input), + }; + let name = match target_kind { + TargetKind::Yaml => "bslive.yml", + TargetKind::Toml => todo!("toml missing"), + TargetKind::Md => "bslive.md", + TargetKind::Html => "bslive.html", + }; + + fs_write_str(cwd, &PathBuf::from(name), &string, write_mode) } diff --git a/crates/bsnext_system/src/start_kind/start_from_example.rs b/crates/bsnext_system/src/start_kind/start_from_example.rs index ef2945f..6d475aa 100644 --- a/crates/bsnext_system/src/start_kind/start_from_example.rs +++ b/crates/bsnext_system/src/start_kind/start_from_example.rs @@ -1,5 +1,6 @@ -use crate::start_kind::start_fs; +use crate::start_kind::fs_write_input; use bsnext_example::Example; +use bsnext_fs_helpers::WriteMode; use bsnext_input::server_config::ServerIdentity; use bsnext_input::startup::{StartupContext, SystemStart, SystemStartArgs}; use bsnext_input::target::TargetKind; @@ -25,9 +26,9 @@ impl SystemStart for StartFromExample { let input_source_kind = self.example.into_input(Some(identity)); let write_mode = if self.force { - start_fs::WriteMode::Override + WriteMode::Override } else { - start_fs::WriteMode::Safe + WriteMode::Safe }; let target_dir = if self.temp { @@ -36,10 +37,10 @@ impl SystemStart for StartFromExample { let word = name.unwrap_or_else(rand_word); let num = rand::random::(); let next_dir = temp_dir.join(format!("bslive-{word}-{num}")); - start_fs::create_dir(&next_dir, &write_mode)? + bsnext_fs_helpers::create_dir_and_cd(&next_dir, &write_mode)? } else if let Some(dir) = &self.dir { let next_dir = ctx.cwd.join(dir); - start_fs::create_dir(&next_dir, &write_mode)? + bsnext_fs_helpers::create_dir_and_cd(&next_dir, &write_mode)? } else { ctx.cwd.to_path_buf() }; @@ -59,17 +60,13 @@ impl SystemStart for StartFromExample { let (path, input) = match input_source_kind { InputSourceKind::Type(input) => { - let path = start_fs::fs_write_input( - &target_dir, - &input, - self.target_kind.clone(), - &write_mode, - ) - .map_err(|e| Box::new(e.into()))?; + let path = + fs_write_input(&target_dir, &input, self.target_kind.clone(), &write_mode) + .map_err(|e| Box::new(e.into()))?; (path, input) } InputSourceKind::File { src_file, input } => { - let path = start_fs::fs_write_input_src( + let path = bsnext_fs_helpers::fs_write_str( &target_dir, src_file.path(), src_file.content(), diff --git a/crates/bsnext_system/src/start_kind/start_from_paths.rs b/crates/bsnext_system/src/start_kind/start_from_paths.rs index 32a40c8..46f7c34 100644 --- a/crates/bsnext_system/src/start_kind/start_from_paths.rs +++ b/crates/bsnext_system/src/start_kind/start_from_paths.rs @@ -1,5 +1,5 @@ -use crate::start_kind::start_fs; -use crate::start_kind::start_fs::WriteMode; +use crate::start_kind::fs_write_input; +use bsnext_fs_helpers::WriteMode; use bsnext_input::route::{DirRoute, Route, RouteKind}; use bsnext_input::server_config::{ServerConfig, ServerIdentity}; use bsnext_input::startup::{StartupContext, SystemStart, SystemStartArgs}; @@ -27,7 +27,7 @@ impl SystemStart for StartFromDirPaths { WriteMode::Safe }; if self.write_input { - let path = start_fs::fs_write_input(&ctx.cwd, &input, TargetKind::Yaml, &write_mode) + let path = fs_write_input(&ctx.cwd, &input, TargetKind::Yaml, &write_mode) .map_err(|e| Box::new(e.into()))?; Ok(SystemStartArgs::PathWithInput { input, path }) } else { @@ -46,17 +46,17 @@ fn from_dir_paths>( .map(|p| { let pb = PathBuf::from(p.as_ref()); if pb.is_absolute() { - return PathDefinition { + PathDefinition { input: p.as_ref().to_string(), cwd: cwd.to_path_buf(), absolute: pb, - }; + } } else { - return PathDefinition { + PathDefinition { input: p.as_ref().to_string(), cwd: cwd.to_path_buf(), absolute: cwd.join(pb), - }; + } } }) .map(|path_def| { diff --git a/generated/dto.ts b/generated/dto.ts index 9900352..7f919c4 100644 --- a/generated/dto.ts +++ b/generated/dto.ts @@ -1,36 +1,29 @@ /* - Generated by typeshare 1.9.2 + Generated by typeshare 1.13.2 */ -export type RouteKindDTO = - | { kind: "Html", payload: { - html: string; -}} - | { kind: "Json", payload: { - json_str: string; -}} - | { kind: "Raw", payload: { - raw: string; -}} - | { kind: "Sse", payload: { - sse: string; -}} - | { kind: "Proxy", payload: { - proxy: string; -}} - | { kind: "Dir", payload: { - dir: string; - base?: string; -}}; +export enum LogLevelDTO { + Info = "info", + Debug = "debug", + Trace = "trace", + Error = "error", +} -export interface RouteDTO { +export interface ClientConfigDTO { + log_level: LogLevelDTO; +} + +export interface DebounceDTO { + kind: string; + ms: string; +} + +export interface FileChangedDTO { path: string; - kind: RouteKindDTO; } -export interface ServerDesc { - routes: RouteDTO[]; - id: string; +export interface FilesChangedDTO { + paths: string[]; } export type ServerIdentityDTO = @@ -55,34 +48,34 @@ export interface GetServersMessageResponseDTO { servers: ServerDTO[]; } -export interface ServersChangedDTO { - servers_resp: GetServersMessageResponseDTO; -} - export interface InputAcceptedDTO { path: string; } -export interface FileChangedDTO { - path: string; -} - -export interface FilesChangedDTO { - paths: string[]; -} - -export interface DebounceDTO { - kind: string; - ms: string; -} - -export interface WatchingDTO { - paths: string[]; - debounce: DebounceDTO; -} +export type RouteKindDTO = + | { kind: "Html", payload: { + html: string; +}} + | { kind: "Json", payload: { + json_str: string; +}} + | { kind: "Raw", payload: { + raw: string; +}} + | { kind: "Sse", payload: { + sse: string; +}} + | { kind: "Proxy", payload: { + proxy: string; +}} + | { kind: "Dir", payload: { + dir: string; + base?: string; +}}; -export interface StoppedWatchingDTO { - paths: string[]; +export interface RouteDTO { + path: string; + kind: RouteKindDTO; } export type ServerChange = @@ -104,23 +97,41 @@ export interface ServerChangeSet { items: ServerChangeSetItem[]; } -export enum LogLevelDTO { - Info = "info", - Debug = "debug", - Trace = "trace", - Error = "error", +export interface ServerDesc { + routes: RouteDTO[]; + id: string; } -export interface ClientConfigDTO { - log_level: LogLevelDTO; +export interface ServersChangedDTO { + servers_resp: GetServersMessageResponseDTO; } -/** - * public version of internal events - * todo(alpha): clean this up - */ -export type InternalEventsDTO = - | { kind: "ServersChanged", payload: GetServersMessageResponseDTO }; +export interface StoppedWatchingDTO { + paths: string[]; +} + +export interface WatchingDTO { + paths: string[]; + debounce: DebounceDTO; +} + +export type ChangeDTO = + | { kind: "Fs", payload: { + path: string; + change_kind: ChangeKind; +}} + | { kind: "FsMany", payload: ChangeDTO[] }; + +export enum ChangeKind { + Changed = "Changed", + Added = "Added", + Removed = "Removed", +} + +export type ClientEvent = + | { kind: "Change", payload: ChangeDTO } + | { kind: "WsConnection", payload: ClientConfigDTO } + | { kind: "Config", payload: ClientConfigDTO }; export enum EventLevel { External = "BSLIVE_EXTERNAL", @@ -135,10 +146,6 @@ export type ExternalEventsDTO = | { kind: "InputFileChanged", payload: FileChangedDTO } | { kind: "InputAccepted", payload: InputAcceptedDTO }; -export type StartupEventDTO = - | { kind: "Started", payload?: undefined } - | { kind: "FailedStartup", payload: string }; - export type InputErrorDTO = | { kind: "MissingInputs", payload: string } | { kind: "InvalidInput", payload: string } @@ -156,21 +163,14 @@ export type InputErrorDTO = | { kind: "EmptyInput", payload: string } | { kind: "BsLiveRules", payload: string }; -export type ClientEvent = - | { kind: "Change", payload: ChangeDTO } - | { kind: "WsConnection", payload: ClientConfigDTO } - | { kind: "Config", payload: ClientConfigDTO }; - -export type ChangeDTO = - | { kind: "Fs", payload: { - path: string; - change_kind: ChangeKind; -}} - | { kind: "FsMany", payload: ChangeDTO[] }; +/** + * public version of internal events + * todo(alpha): clean this up + */ +export type InternalEventsDTO = + | { kind: "ServersChanged", payload: GetServersMessageResponseDTO }; -export enum ChangeKind { - Changed = "Changed", - Added = "Added", - Removed = "Removed", -} +export type StartupEventDTO = + | { kind: "Started", payload?: undefined } + | { kind: "FailedStartup", payload: string }; diff --git a/generated/schema.js b/generated/schema.js index a516bfa..5dbde13 100644 --- a/generated/schema.js +++ b/generated/schema.js @@ -9,18 +9,64 @@ var LogLevelDTO = /* @__PURE__ */ ((LogLevelDTO2) => { LogLevelDTO2["Error"] = "error"; return LogLevelDTO2; })(LogLevelDTO || {}); -var EventLevel = /* @__PURE__ */ ((EventLevel2) => { - EventLevel2["External"] = "BSLIVE_EXTERNAL"; - return EventLevel2; -})(EventLevel || {}); var ChangeKind = /* @__PURE__ */ ((ChangeKind2) => { ChangeKind2["Changed"] = "Changed"; ChangeKind2["Added"] = "Added"; ChangeKind2["Removed"] = "Removed"; return ChangeKind2; })(ChangeKind || {}); +var EventLevel = /* @__PURE__ */ ((EventLevel2) => { + EventLevel2["External"] = "BSLIVE_EXTERNAL"; + return EventLevel2; +})(EventLevel || {}); // schema.ts +var logLevelDTOSchema = z.nativeEnum(LogLevelDTO); +var clientConfigDTOSchema = z.object({ + log_level: logLevelDTOSchema +}); +var debounceDTOSchema = z.object({ + kind: z.string(), + ms: z.string() +}); +var fileChangedDTOSchema = z.object({ + path: z.string() +}); +var filesChangedDTOSchema = z.object({ + paths: z.array(z.string()) +}); +var serverIdentityDTOSchema = z.union([ + z.object({ + kind: z.literal("Both"), + payload: z.object({ + name: z.string(), + bind_address: z.string() + }) + }), + z.object({ + kind: z.literal("Address"), + payload: z.object({ + bind_address: z.string() + }) + }), + z.object({ + kind: z.literal("Named"), + payload: z.object({ + name: z.string() + }) + }) +]); +var serverDTOSchema = z.object({ + id: z.string(), + identity: serverIdentityDTOSchema, + socket_addr: z.string() +}); +var getServersMessageResponseDTOSchema = z.object({ + servers: z.array(serverDTOSchema) +}); +var inputAcceptedDTOSchema = z.object({ + path: z.string() +}); var routeKindDTOSchema = z.union([ z.object({ kind: z.literal("Html"), @@ -64,99 +110,79 @@ var routeDTOSchema = z.object({ path: z.string(), kind: routeKindDTOSchema }); -var serverDescSchema = z.object({ - routes: z.array(routeDTOSchema), - id: z.string() -}); -var serverIdentityDTOSchema = z.union([ +var serverChangeSchema = z.union([ z.object({ - kind: z.literal("Both"), + kind: z.literal("Stopped"), payload: z.object({ - name: z.string(), bind_address: z.string() }) }), z.object({ - kind: z.literal("Address"), - payload: z.object({ - bind_address: z.string() - }) + kind: z.literal("Started"), + payload: z.undefined().optional() }), z.object({ - kind: z.literal("Named"), + kind: z.literal("Patched"), + payload: z.undefined().optional() + }), + z.object({ + kind: z.literal("Errored"), payload: z.object({ - name: z.string() + error: z.string() }) }) ]); -var serverDTOSchema = z.object({ - id: z.string(), +var serverChangeSetItemSchema = z.object({ identity: serverIdentityDTOSchema, - socket_addr: z.string() + change: serverChangeSchema }); -var getServersMessageResponseDTOSchema = z.object({ - servers: z.array(serverDTOSchema) +var serverChangeSetSchema = z.object({ + items: z.array(serverChangeSetItemSchema) +}); +var serverDescSchema = z.object({ + routes: z.array(routeDTOSchema), + id: z.string() }); var serversChangedDTOSchema = z.object({ servers_resp: getServersMessageResponseDTOSchema }); -var inputAcceptedDTOSchema = z.object({ - path: z.string() -}); -var fileChangedDTOSchema = z.object({ - path: z.string() -}); -var filesChangedDTOSchema = z.object({ +var stoppedWatchingDTOSchema = z.object({ paths: z.array(z.string()) }); -var debounceDTOSchema = z.object({ - kind: z.string(), - ms: z.string() -}); var watchingDTOSchema = z.object({ paths: z.array(z.string()), debounce: debounceDTOSchema }); -var stoppedWatchingDTOSchema = z.object({ - paths: z.array(z.string()) -}); -var serverChangeSchema = z.union([ - z.object({ - kind: z.literal("Stopped"), - payload: z.object({ - bind_address: z.string() +var changeKindSchema = z.nativeEnum(ChangeKind); +var changeDTOSchema = z.lazy( + () => z.union([ + z.object({ + kind: z.literal("Fs"), + payload: z.object({ + path: z.string(), + change_kind: changeKindSchema + }) + }), + z.object({ + kind: z.literal("FsMany"), + payload: z.array(changeDTOSchema) }) - }), + ]) +); +var clientEventSchema = z.union([ z.object({ - kind: z.literal("Started"), - payload: z.undefined().optional() + kind: z.literal("Change"), + payload: changeDTOSchema }), z.object({ - kind: z.literal("Patched"), - payload: z.undefined().optional() + kind: z.literal("WsConnection"), + payload: clientConfigDTOSchema }), z.object({ - kind: z.literal("Errored"), - payload: z.object({ - error: z.string() - }) + kind: z.literal("Config"), + payload: clientConfigDTOSchema }) ]); -var serverChangeSetItemSchema = z.object({ - identity: serverIdentityDTOSchema, - change: serverChangeSchema -}); -var serverChangeSetSchema = z.object({ - items: z.array(serverChangeSetItemSchema) -}); -var logLevelDTOSchema = z.nativeEnum(LogLevelDTO); -var clientConfigDTOSchema = z.object({ - log_level: logLevelDTOSchema -}); -var internalEventsDTOSchema = z.object({ - kind: z.literal("ServersChanged"), - payload: getServersMessageResponseDTOSchema -}); var eventLevelSchema = z.nativeEnum(EventLevel); var externalEventsDTOSchema = z.union([ z.object({ @@ -188,16 +214,6 @@ var externalEventsDTOSchema = z.union([ payload: inputAcceptedDTOSchema }) ]); -var startupEventDTOSchema = z.union([ - z.object({ - kind: z.literal("Started"), - payload: z.undefined().optional() - }), - z.object({ - kind: z.literal("FailedStartup"), - payload: z.string() - }) -]); var inputErrorDTOSchema = z.union([ z.object({ kind: z.literal("MissingInputs"), @@ -260,34 +276,18 @@ var inputErrorDTOSchema = z.union([ payload: z.string() }) ]); -var changeKindSchema = z.nativeEnum(ChangeKind); -var changeDTOSchema = z.lazy( - () => z.union([ - z.object({ - kind: z.literal("Fs"), - payload: z.object({ - path: z.string(), - change_kind: changeKindSchema - }) - }), - z.object({ - kind: z.literal("FsMany"), - payload: z.array(changeDTOSchema) - }) - ]) -); -var clientEventSchema = z.union([ - z.object({ - kind: z.literal("Change"), - payload: changeDTOSchema - }), +var internalEventsDTOSchema = z.object({ + kind: z.literal("ServersChanged"), + payload: getServersMessageResponseDTOSchema +}); +var startupEventDTOSchema = z.union([ z.object({ - kind: z.literal("WsConnection"), - payload: clientConfigDTOSchema + kind: z.literal("Started"), + payload: z.undefined().optional() }), z.object({ - kind: z.literal("Config"), - payload: clientConfigDTOSchema + kind: z.literal("FailedStartup"), + payload: z.string() }) ]); export { diff --git a/generated/schema.ts b/generated/schema.ts index 6f79d60..413dd48 100644 --- a/generated/schema.ts +++ b/generated/schema.ts @@ -1,6 +1,61 @@ // Generated by ts-to-zod import { z } from "zod"; -import { LogLevelDTO, EventLevel, ChangeKind, ChangeDTO } from "./dto"; +import { LogLevelDTO, ChangeKind, ChangeDTO, EventLevel } from "./dto"; + +export const logLevelDTOSchema = z.nativeEnum(LogLevelDTO); + +export const clientConfigDTOSchema = z.object({ + log_level: logLevelDTOSchema, +}); + +export const debounceDTOSchema = z.object({ + kind: z.string(), + ms: z.string(), +}); + +export const fileChangedDTOSchema = z.object({ + path: z.string(), +}); + +export const filesChangedDTOSchema = z.object({ + paths: z.array(z.string()), +}); + +export const serverIdentityDTOSchema = z.union([ + z.object({ + kind: z.literal("Both"), + payload: z.object({ + name: z.string(), + bind_address: z.string(), + }), + }), + z.object({ + kind: z.literal("Address"), + payload: z.object({ + bind_address: z.string(), + }), + }), + z.object({ + kind: z.literal("Named"), + payload: z.object({ + name: z.string(), + }), + }), +]); + +export const serverDTOSchema = z.object({ + id: z.string(), + identity: serverIdentityDTOSchema, + socket_addr: z.string(), +}); + +export const getServersMessageResponseDTOSchema = z.object({ + servers: z.array(serverDTOSchema), +}); + +export const inputAcceptedDTOSchema = z.object({ + path: z.string(), +}); export const routeKindDTOSchema = z.union([ z.object({ @@ -47,116 +102,89 @@ export const routeDTOSchema = z.object({ kind: routeKindDTOSchema, }); -export const serverDescSchema = z.object({ - routes: z.array(routeDTOSchema), - id: z.string(), -}); - -export const serverIdentityDTOSchema = z.union([ +export const serverChangeSchema = z.union([ z.object({ - kind: z.literal("Both"), + kind: z.literal("Stopped"), payload: z.object({ - name: z.string(), bind_address: z.string(), }), }), z.object({ - kind: z.literal("Address"), - payload: z.object({ - bind_address: z.string(), - }), + kind: z.literal("Started"), + payload: z.undefined().optional(), }), z.object({ - kind: z.literal("Named"), + kind: z.literal("Patched"), + payload: z.undefined().optional(), + }), + z.object({ + kind: z.literal("Errored"), payload: z.object({ - name: z.string(), + error: z.string(), }), }), ]); -export const serverDTOSchema = z.object({ - id: z.string(), +export const serverChangeSetItemSchema = z.object({ identity: serverIdentityDTOSchema, - socket_addr: z.string(), -}); - -export const getServersMessageResponseDTOSchema = z.object({ - servers: z.array(serverDTOSchema), + change: serverChangeSchema, }); -export const serversChangedDTOSchema = z.object({ - servers_resp: getServersMessageResponseDTOSchema, +export const serverChangeSetSchema = z.object({ + items: z.array(serverChangeSetItemSchema), }); -export const inputAcceptedDTOSchema = z.object({ - path: z.string(), +export const serverDescSchema = z.object({ + routes: z.array(routeDTOSchema), + id: z.string(), }); -export const fileChangedDTOSchema = z.object({ - path: z.string(), +export const serversChangedDTOSchema = z.object({ + servers_resp: getServersMessageResponseDTOSchema, }); -export const filesChangedDTOSchema = z.object({ +export const stoppedWatchingDTOSchema = z.object({ paths: z.array(z.string()), }); -export const debounceDTOSchema = z.object({ - kind: z.string(), - ms: z.string(), -}); - export const watchingDTOSchema = z.object({ paths: z.array(z.string()), debounce: debounceDTOSchema, }); -export const stoppedWatchingDTOSchema = z.object({ - paths: z.array(z.string()), -}); +export const changeKindSchema = z.nativeEnum(ChangeKind); -export const serverChangeSchema = z.union([ - z.object({ - kind: z.literal("Stopped"), - payload: z.object({ - bind_address: z.string(), +export const changeDTOSchema: z.ZodSchema = z.lazy(() => + z.union([ + z.object({ + kind: z.literal("Fs"), + payload: z.object({ + path: z.string(), + change_kind: changeKindSchema, + }), }), - }), + z.object({ + kind: z.literal("FsMany"), + payload: z.array(changeDTOSchema), + }), + ]), +); + +export const clientEventSchema = z.union([ z.object({ - kind: z.literal("Started"), - payload: z.undefined().optional(), + kind: z.literal("Change"), + payload: changeDTOSchema, }), z.object({ - kind: z.literal("Patched"), - payload: z.undefined().optional(), + kind: z.literal("WsConnection"), + payload: clientConfigDTOSchema, }), z.object({ - kind: z.literal("Errored"), - payload: z.object({ - error: z.string(), - }), + kind: z.literal("Config"), + payload: clientConfigDTOSchema, }), ]); -export const serverChangeSetItemSchema = z.object({ - identity: serverIdentityDTOSchema, - change: serverChangeSchema, -}); - -export const serverChangeSetSchema = z.object({ - items: z.array(serverChangeSetItemSchema), -}); - -export const logLevelDTOSchema = z.nativeEnum(LogLevelDTO); - -export const clientConfigDTOSchema = z.object({ - log_level: logLevelDTOSchema, -}); - -export const internalEventsDTOSchema = z.object({ - kind: z.literal("ServersChanged"), - payload: getServersMessageResponseDTOSchema, -}); - export const eventLevelSchema = z.nativeEnum(EventLevel); export const externalEventsDTOSchema = z.union([ @@ -190,17 +218,6 @@ export const externalEventsDTOSchema = z.union([ }), ]); -export const startupEventDTOSchema = z.union([ - z.object({ - kind: z.literal("Started"), - payload: z.undefined().optional(), - }), - z.object({ - kind: z.literal("FailedStartup"), - payload: z.string(), - }), -]); - export const inputErrorDTOSchema = z.union([ z.object({ kind: z.literal("MissingInputs"), @@ -264,35 +281,18 @@ export const inputErrorDTOSchema = z.union([ }), ]); -export const changeKindSchema = z.nativeEnum(ChangeKind); - -export const changeDTOSchema: z.ZodSchema = z.lazy(() => - z.union([ - z.object({ - kind: z.literal("Fs"), - payload: z.object({ - path: z.string(), - change_kind: changeKindSchema, - }), - }), - z.object({ - kind: z.literal("FsMany"), - payload: z.array(changeDTOSchema), - }), - ]), -); +export const internalEventsDTOSchema = z.object({ + kind: z.literal("ServersChanged"), + payload: getServersMessageResponseDTOSchema, +}); -export const clientEventSchema = z.union([ - z.object({ - kind: z.literal("Change"), - payload: changeDTOSchema, - }), +export const startupEventDTOSchema = z.union([ z.object({ - kind: z.literal("WsConnection"), - payload: clientConfigDTOSchema, + kind: z.literal("Started"), + payload: z.undefined().optional(), }), z.object({ - kind: z.literal("Config"), - payload: clientConfigDTOSchema, + kind: z.literal("FailedStartup"), + payload: z.string(), }), ]); diff --git a/inject/dist/index.js b/inject/dist/index.js index 24b29ea..88eae92 100644 --- a/inject/dist/index.js +++ b/inject/dist/index.js @@ -1,3 +1,3 @@ var dn=Object.create;var rr=Object.defineProperty;var fn=Object.getOwnPropertyDescriptor;var pn=Object.getOwnPropertyNames;var hn=Object.getPrototypeOf,mn=Object.prototype.hasOwnProperty;var vn=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var yn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of pn(e))!mn.call(r,o)&&o!==t&&rr(r,o,{get:()=>e[o],enumerable:!(n=fn(e,o))||n.enumerable});return r};var gn=(r,e,t)=>(t=r!=null?dn(hn(r)):{},yn(e||!r||!r.__esModule?rr(t,"default",{value:r,enumerable:!0}):t,r));var cn=vn(sn=>{"use strict";var At=class{constructor(e){this.func=e,this.running=!1,this.id=null,this._handler=()=>(this.running=!1,this.id=null,this.func())}start(e){this.running&&clearTimeout(this.id),this.id=setTimeout(this._handler,e),this.running=!0}stop(){this.running&&(clearTimeout(this.id),this.running=!1,this.id=null)}};At.start=(r,e)=>setTimeout(e,r);sn.Timer=At});var Pt=function(r,e){return Pt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},Pt(r,e)};function R(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Pt(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var et=function(){return et=Object.assign||function(e){for(var t,n=1,o=arguments.length;n0&&i[i.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function V(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,i=[],a;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(s){a={error:s}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(a)throw a.error}}return i}function F(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,i;n1||c(g,w)})},E&&(o[g]=E(o[g])))}function c(g,E){try{l(n[g](E))}catch(w){T(i[0][3],w)}}function l(g){g.value instanceof ae?Promise.resolve(g.value.v).then(d,v):T(i[0][2],g)}function d(g){c("next",g)}function v(g){c("throw",g)}function T(g,E){g(E),i.shift(),i.length&&c(i[0][0],i[0][1])}}function ir(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof J=="function"?J(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=r[i]&&function(a){return new Promise(function(s,c){a=r[i](a),o(s,c,a.done,a.value)})}}function o(i,a,s,c){Promise.resolve(c).then(function(l){i({value:l,done:s})},a)}}function S(r){return typeof r=="function"}function rt(r){var e=function(n){Error.call(n),n.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var nt=rt(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription: `+t.map(function(n,o){return o+1+") "+n.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=t}});function se(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var H=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=J(a),c=s.next();!c.done;c=s.next()){var l=c.value;l.remove(this)}}catch(w){e={error:w}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else a.remove(this);var d=this.initialTeardown;if(S(d))try{d()}catch(w){i=w instanceof nt?w.errors:[w]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var T=J(v),g=T.next();!g.done;g=T.next()){var E=g.value;try{ar(E)}catch(w){i=i??[],w instanceof nt?i=F(F([],V(i)),V(w.errors)):i.push(w)}}}catch(w){n={error:w}}finally{try{g&&!g.done&&(o=T.return)&&o.call(T)}finally{if(n)throw n.error}}}if(i)throw new nt(i)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)ar(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&se(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&se(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}();var Nt=H.EMPTY;function ot(r){return r instanceof H||r&&"closed"in r&&S(r.remove)&&S(r.add)&&S(r.unsubscribe)}function ar(r){S(r)?r():r.unsubscribe()}var B={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Ce={setTimeout:function(r,e){for(var t=[],n=2;n0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?Nt:(this.currentObservers=null,s.push(t),new H(function(){n.currentObservers=null,se(s,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?t.error(i):a&&t.complete()},e.prototype.asObservable=function(){var t=new O;return t.source=this,t},e.create=function(t,n){return new st(t,n)},e}(O);var st=function(r){R(e,r);function e(t,n){var o=r.call(this)||this;return o.destination=t,o.source=n,o}return e.prototype.next=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,t)},e.prototype.error=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&o!==void 0?o:Nt},e}(z);var We={now:function(){return(We.delegate||Date).now()},delegate:void 0};var ct=function(r){R(e,r);function e(t,n,o){t===void 0&&(t=1/0),n===void 0&&(n=1/0),o===void 0&&(o=We);var i=r.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return e.prototype.next=function(t){var n=this,o=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,s=n._timestampProvider,c=n._windowTime;o||(i.push(t),!a&&i.push(s.now()+c)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),o=this,i=o._infiniteTimeWindow,a=o._buffer,s=a.slice(),c=0;c0&&(d=new le({next:function(Qe){return Xe.next(Qe)},error:function(Qe){w=!0,A(),v=Wt(M,o,Qe),Xe.error(Qe)},complete:function(){E=!0,A(),v=Wt(M,a),Xe.complete()}}),I($e).subscribe(d))})(l)}}function Wt(r,e){for(var t=[],n=2;n{let r=new URL(window.location.href);return r.protocol=r.protocol==="http:"?"ws":"wss",r.pathname="/__bs_ws",Bt(r.origin+r.pathname).pipe(Ut({delay:5e3}))}}}var Mr={debug(...r){},error(...r){},info(...r){},trace(...r){}},zt={name:"console",globalSetup:r=>{let e=new z;return[e,{debug:function(...n){e.next({level:"debug",args:n})},info:function(...n){e.next({level:"info",args:n})},trace:function(...n){e.next({level:"trace",args:n})},error:function(...n){e.next({level:"error",args:n})}}]},resetSink:(r,e,t)=>r.pipe(Be(n=>{let o=["trace","debug","info","error"],i=o.indexOf(n.level),a=o.indexOf(t.log_level);i>=a&&console.log(`[${n.level}]`,...n.args)}),Fe())};var k;(function(r){r.assertEqual=o=>o;function e(o){}r.assertIs=e;function t(o){throw new Error}r.assertNever=t,r.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},r.getValidEnumValues=o=>{let i=r.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return r.objectValues(a)},r.objectValues=o=>r.objectKeys(o).map(function(i){return o[i]}),r.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},r.find=(o,i)=>{for(let a of o)if(i(a))return a},r.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}r.joinValues=n,r.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(k||(k={}));var Ht;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ht||(Ht={}));var h=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),re=r=>{switch(typeof r){case"undefined":return h.undefined;case"string":return h.string;case"number":return isNaN(r)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(r)?h.array:r===null?h.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?h.promise:typeof Map<"u"&&r instanceof Map?h.map:typeof Set<"u"&&r instanceof Set?h.set:typeof Date<"u"&&r instanceof Date?h.date:h.object;default:return h.unknown}},f=k.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ln=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),L=class r extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let s=n,c=0;for(;ct.message){let t={},n=[];for(let o of this.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};L.create=r=>new L(r);var Pe=(r,e)=>{let t;switch(r.code){case f.invalid_type:r.received===h.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,k.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${k.joinValues(r.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${k.joinValues(r.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${k.joinValues(r.options)}, received '${r.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:k.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case f.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case f.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,k.assertNever(r)}return{message:t}},$r=Pe;function Zn(r){$r=r}function St(){return $r}var kt=r=>{let{data:e,path:t,errorMaps:n,issueData:o}=r,i=[...t,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}},$n=[];function p(r,e){let t=St(),n=kt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Pe?void 0:Pe].filter(o=>!!o)});r.common.issues.push(n)}var P=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let o of t){if(o.status==="aborted")return _;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let o of t){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let o of t){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return _;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},_=Object.freeze({status:"aborted"}),Ae=r=>({status:"dirty",value:r}),N=r=>({status:"valid",value:r}),Yt=r=>r.status==="aborted",Gt=r=>r.status==="dirty",He=r=>r.status==="valid",Ye=r=>typeof Promise<"u"&&r instanceof Promise;function Tt(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}function Ur(r,e,t,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(r,t):o?o.value=t:e.set(r,t),t}var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));var ze,qe,W=class{constructor(e,t,n,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Lr=(r,e)=>{if(He(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new L(r.common.issues);return this._error=t,this._error}}};function b(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:o}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{var c,l;let{message:d}=r;return a.code==="invalid_enum_value"?{message:d??s.defaultError}:typeof s.data>"u"?{message:(c=d??n)!==null&&c!==void 0?c:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=d??t)!==null&&l!==void 0?l:s.defaultError}},description:o}}var x=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return re(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:re(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P,ctx:{common:e.parent.common,data:e.data,parsedType:re(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ye(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let o={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:re(e)},i=this._parseSync({data:e,path:o.path,parent:o});return Lr(o,i)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:re(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Ye(o)?o:Promise.resolve(o));return Lr(n,i)}refine(e,t){let n=o=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(o):t;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:f.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,t){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof t=="function"?t(n,o):t),!1))}_refinement(e){return new Z({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return U.create(this,this._def)}nullable(){return G.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ee.create(this,this._def)}promise(){return ie.create(this,this._def)}or(e){return ge.create([this,e],this._def)}and(e){return _e.create(this,e,this._def)}transform(e){return new Z({...b(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ke({...b(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new Ge({typeName:y.ZodBranded,type:this,...b(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Te({...b(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Je.create(this,e)}readonly(){return Ee.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Un=/^c[^\s-]{8,}$/i,Wn=/^[0-9a-z]+$/,Vn=/^[0-9A-HJKMNP-TV-Z]{26}$/,Fn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Bn=/^[a-z0-9_-]{21}$/i,zn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,qn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qt,Yn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gn=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Jn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Kn=new RegExp(`^${Wr}$`);function Vr(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Xn(r){return new RegExp(`^${Vr(r)}$`)}function Fr(r){let e=`${Wr}T${Vr(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Qn(r,e){return!!((e==="v4"||!e)&&Yn.test(r)||(e==="v6"||!e)&&Gn.test(r))}var ne=class r extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){let i=this._getOrReturnCtx(e);return p(i,{code:f.invalid_type,expected:h.string,received:i.parsedType}),_}let n=new P,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),p(o,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.lengthe.test(o),{validation:t,code:f.invalid_string,...m.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new ne({checks:[],typeName:y.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...b(r)})};function eo(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=t>n?t:n,i=parseInt(r.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}var fe=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){let i=this._getOrReturnCtx(e);return p(i,{code:f.invalid_type,expected:h.number,received:i.parsedType}),_}let n,o=new P;for(let i of this._def.checks)i.kind==="int"?k.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:f.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:f.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?eo(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:f.not_finite,message:i.message}),o.dirty()):k.assertNever(i);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,o){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(o)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&k.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.valuenew fe({checks:[],typeName:y.ZodNumber,coerce:r?.coerce||!1,...b(r)});var pe=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==h.bigint){let i=this._getOrReturnCtx(e);return p(i,{code:f.invalid_type,expected:h.bigint,received:i.parsedType}),_}let n,o=new P;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:f.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):k.assertNever(i);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,o){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(o)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new pe({checks:[],typeName:y.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...b(r)})};var he=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.boolean,received:n.parsedType}),_}return N(e.data)}};he.create=r=>new he({typeName:y.ZodBoolean,coerce:r?.coerce||!1,...b(r)});var me=class r extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){let i=this._getOrReturnCtx(e);return p(i,{code:f.invalid_type,expected:h.date,received:i.parsedType}),_}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return p(i,{code:f.invalid_date}),_}let n=new P,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),p(o,{code:f.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):k.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew me({checks:[],coerce:r?.coerce||!1,typeName:y.ZodDate,...b(r)});var Ne=class extends x{_parse(e){if(this._getType(e)!==h.symbol){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.symbol,received:n.parsedType}),_}return N(e.data)}};Ne.create=r=>new Ne({typeName:y.ZodSymbol,...b(r)});var ve=class extends x{_parse(e){if(this._getType(e)!==h.undefined){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.undefined,received:n.parsedType}),_}return N(e.data)}};ve.create=r=>new ve({typeName:y.ZodUndefined,...b(r)});var ye=class extends x{_parse(e){if(this._getType(e)!==h.null){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.null,received:n.parsedType}),_}return N(e.data)}};ye.create=r=>new ye({typeName:y.ZodNull,...b(r)});var oe=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return N(e.data)}};oe.create=r=>new oe({typeName:y.ZodAny,...b(r)});var Q=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return N(e.data)}};Q.create=r=>new Q({typeName:y.ZodUnknown,...b(r)});var q=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return p(t,{code:f.invalid_type,expected:h.never,received:t.parsedType}),_}};q.create=r=>new q({typeName:y.ZodNever,...b(r)});var De=class extends x{_parse(e){if(this._getType(e)!==h.undefined){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.void,received:n.parsedType}),_}return N(e.data)}};De.create=r=>new De({typeName:y.ZodVoid,...b(r)});var ee=class r extends x{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),o=this._def;if(t.parsedType!==h.array)return p(t,{code:f.invalid_type,expected:h.array,received:t.parsedType}),_;if(o.exactLength!==null){let a=t.data.length>o.exactLength.value,s=t.data.lengtho.maxLength.value&&(p(t,{code:f.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((a,s)=>o.type._parseAsync(new W(t,a,t.path,s)))).then(a=>P.mergeArray(n,a));let i=[...t.data].map((a,s)=>o.type._parseSync(new W(t,a,t.path,s)));return P.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}};ee.create=(r,e)=>new ee({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...b(e)});function Re(r){if(r instanceof D){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=U.create(Re(n))}return new D({...r._def,shape:()=>e})}else return r instanceof ee?new ee({...r._def,type:Re(r.element)}):r instanceof U?U.create(Re(r.unwrap())):r instanceof G?G.create(Re(r.unwrap())):r instanceof Y?Y.create(r.items.map(e=>Re(e))):r}var D=class r extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=k.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==h.object){let l=this._getOrReturnCtx(e);return p(l,{code:f.invalid_type,expected:h.object,received:l.parsedType}),_}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof q&&this._def.unknownKeys==="strip"))for(let l in o.data)a.includes(l)||s.push(l);let c=[];for(let l of a){let d=i[l],v=o.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new W(o,v,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof q){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of s)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(l==="strict")s.length>0&&(p(o,{code:f.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of s){let v=o.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new W(o,v,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of c){let v=await d.key,T=await d.value;l.push({key:v,value:T,alwaysSet:d.alwaysSet})}return l}).then(l=>P.mergeObjectSync(n,l)):P.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var o,i,a,s;let c=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,t,n).message)!==null&&a!==void 0?a:n.defaultError;return t.code==="unrecognized_keys"?{message:(s=m.errToObj(e).message)!==null&&s!==void 0?s:c}:{message:c}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return k.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return k.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return Re(this)}partial(e){let t={};return k.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?t[n]=o:t[n]=o.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return k.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof U;)i=i._def.innerType;t[n]=i}}),new r({...this._def,shape:()=>t})}keyof(){return Br(k.objectKeys(this.shape))}};D.create=(r,e)=>new D({shape:()=>r,unknownKeys:"strip",catchall:q.create(),typeName:y.ZodObject,...b(e)});D.strictCreate=(r,e)=>new D({shape:()=>r,unknownKeys:"strict",catchall:q.create(),typeName:y.ZodObject,...b(e)});D.lazycreate=(r,e)=>new D({shape:r,unknownKeys:"strip",catchall:q.create(),typeName:y.ZodObject,...b(e)});var ge=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new L(s.ctx.common.issues));return p(t,{code:f.invalid_union,unionErrors:a}),_}if(t.common.async)return Promise.all(n.map(async i=>{let a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let l={...t,common:{...t.common,issues:[]},parent:null},d=c._parseSync({data:t.data,path:t.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new L(c));return p(t,{code:f.invalid_union,unionErrors:s}),_}}get options(){return this._def.options}};ge.create=(r,e)=>new ge({options:r,typeName:y.ZodUnion,...b(e)});var X=r=>r instanceof be?X(r.schema):r instanceof Z?X(r.innerType()):r instanceof xe?[r.value]:r instanceof we?r.options:r instanceof Se?k.objectValues(r.enum):r instanceof ke?X(r._def.innerType):r instanceof ve?[void 0]:r instanceof ye?[null]:r instanceof U?[void 0,...X(r.unwrap())]:r instanceof G?[null,...X(r.unwrap())]:r instanceof Ge||r instanceof Ee?X(r.unwrap()):r instanceof Te?X(r._def.innerType):[],Et=class r extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return p(t,{code:f.invalid_type,expected:h.object,received:t.parsedType}),_;let n=this.discriminator,o=t.data[n],i=this.optionsMap.get(o);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(p(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let o=new Map;for(let i of t){let a=X(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new r({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...b(n)})}};function Jt(r,e){let t=re(r),n=re(e);if(r===e)return{valid:!0,data:r};if(t===h.object&&n===h.object){let o=k.objectKeys(e),i=k.objectKeys(r).filter(s=>o.indexOf(s)!==-1),a={...r,...e};for(let s of i){let c=Jt(r[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(t===h.array&&n===h.array){if(r.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{if(Yt(i)||Yt(a))return _;let s=Jt(i.value,a.value);return s.valid?((Gt(i)||Gt(a))&&t.dirty(),{status:t.value,value:s.data}):(p(n,{code:f.invalid_intersection_types}),_)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};_e.create=(r,e,t)=>new _e({left:r,right:e,typeName:y.ZodIntersection,...b(t)});var Y=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.array)return p(n,{code:f.invalid_type,expected:h.array,received:n.parsedType}),_;if(n.data.lengththis._def.items.length&&(p(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new W(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>P.mergeArray(t,a)):P.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Y.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Y({items:r,typeName:y.ZodTuple,rest:null,...b(e)})};var Ot=class r extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.object)return p(n,{code:f.invalid_type,expected:h.object,received:n.parsedType}),_;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new W(n,s,n.path,s)),value:a._parse(new W(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?P.mergeObjectAsync(t,o):P.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new r({keyType:e,valueType:t,typeName:y.ZodRecord,...b(n)}):new r({keyType:ne.create(),valueType:e,typeName:y.ZodRecord,...b(t)})}},Me=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.map)return p(n,{code:f.invalid_type,expected:h.map,received:n.parsedType}),_;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],l)=>({key:o._parse(new W(n,s,n.path,[l,"key"])),value:i._parse(new W(n,c,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let l=await c.key,d=await c.value;if(l.status==="aborted"||d.status==="aborted")return _;(l.status==="dirty"||d.status==="dirty")&&t.dirty(),s.set(l.value,d.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let c of a){let l=c.key,d=c.value;if(l.status==="aborted"||d.status==="aborted")return _;(l.status==="dirty"||d.status==="dirty")&&t.dirty(),s.set(l.value,d.value)}return{status:t.value,value:s}}}};Me.create=(r,e,t)=>new Me({valueType:e,keyType:r,typeName:y.ZodMap,...b(t)});var Le=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.set)return p(n,{code:f.invalid_type,expected:h.set,received:n.parsedType}),_;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(p(n,{code:f.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty());let i=this._def.valueType;function a(c){let l=new Set;for(let d of c){if(d.status==="aborted")return _;d.status==="dirty"&&t.dirty(),l.add(d.value)}return{status:t.value,value:l}}let s=[...n.data.values()].map((c,l)=>i._parse(new W(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,t){return new r({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Le.create=(r,e)=>new Le({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,...b(e)});var Ct=class r extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return p(t,{code:f.invalid_type,expected:h.function,received:t.parsedType}),_;function n(s,c){return kt({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,St(),Pe].filter(l=>!!l),issueData:{code:f.invalid_arguments,argumentsError:c}})}function o(s,c){return kt({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,St(),Pe].filter(l=>!!l),issueData:{code:f.invalid_return_type,returnTypeError:c}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ie){let s=this;return N(async function(...c){let l=new L([]),d=await s._def.args.parseAsync(c,i).catch(g=>{throw l.addIssue(n(c,g)),l}),v=await Reflect.apply(a,this,d);return await s._def.returns._def.type.parseAsync(v,i).catch(g=>{throw l.addIssue(o(v,g)),l})})}else{let s=this;return N(function(...c){let l=s._def.args.safeParse(c,i);if(!l.success)throw new L([n(c,l.error)]);let d=Reflect.apply(a,this,l.data),v=s._def.returns.safeParse(d,i);if(!v.success)throw new L([o(d,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Y.create(e).rest(Q.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||Y.create([]).rest(Q.create()),returns:t||Q.create(),typeName:y.ZodFunction,...b(n)})}},be=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};be.create=(r,e)=>new be({getter:r,typeName:y.ZodLazy,...b(e)});var xe=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}};xe.create=(r,e)=>new xe({value:r,typeName:y.ZodLiteral,...b(e)});function Br(r,e){return new we({values:r,typeName:y.ZodEnum,...b(e)})}var we=class r extends x{constructor(){super(...arguments),ze.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{expected:k.joinValues(n),received:t.parsedType,code:f.invalid_type}),_}if(Tt(this,ze,"f")||Ur(this,ze,new Set(this._def.values),"f"),!Tt(this,ze,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{received:t.data,code:f.invalid_enum_value,options:n}),_}return N(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};ze=new WeakMap;we.create=Br;var Se=class extends x{constructor(){super(...arguments),qe.set(this,void 0)}_parse(e){let t=k.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.string&&n.parsedType!==h.number){let o=k.objectValues(t);return p(n,{expected:k.joinValues(o),received:n.parsedType,code:f.invalid_type}),_}if(Tt(this,qe,"f")||Ur(this,qe,new Set(k.getValidEnumValues(this._def.values)),"f"),!Tt(this,qe,"f").has(e.data)){let o=k.objectValues(t);return p(n,{received:n.data,code:f.invalid_enum_value,options:o}),_}return N(e.data)}get enum(){return this._def.values}};qe=new WeakMap;Se.create=(r,e)=>new Se({values:r,typeName:y.ZodNativeEnum,...b(e)});var ie=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return p(t,{code:f.invalid_type,expected:h.promise,received:t.parsedType}),_;let n=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return N(n.then(o=>this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ie.create=(r,e)=>new ie({type:r,typeName:y.ZodPromise,...b(e)});var Z=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{p(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(t.value==="aborted")return _;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?_:c.status==="dirty"||t.value==="dirty"?Ae(c.value):c});{if(t.value==="aborted")return _;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?_:s.status==="dirty"||t.value==="dirty"?Ae(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?_:(s.status==="dirty"&&t.dirty(),a(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?_:(s.status==="dirty"&&t.dirty(),a(s.value).then(()=>({status:t.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!He(a))return a;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>He(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:t.value,value:s})):a);k.assertNever(o)}};Z.create=(r,e,t)=>new Z({schema:r,typeName:y.ZodEffects,effect:e,...b(t)});Z.createWithPreprocess=(r,e,t)=>new Z({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,...b(t)});var U=class extends x{_parse(e){return this._getType(e)===h.undefined?N(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};U.create=(r,e)=>new U({innerType:r,typeName:y.ZodOptional,...b(e)});var G=class extends x{_parse(e){return this._getType(e)===h.null?N(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};G.create=(r,e)=>new G({innerType:r,typeName:y.ZodNullable,...b(e)});var ke=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===h.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ke.create=(r,e)=>new ke({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});var Te=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ye(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new L(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new L(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Te.create=(r,e)=>new Te({innerType:r,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});var Ze=class extends x{_parse(e){if(this._getType(e)!==h.nan){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}};Ze.create=r=>new Ze({typeName:y.ZodNaN,...b(r)});var to=Symbol("zod_brand"),Ge=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Je=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?_:i.status==="dirty"?(t.dirty(),Ae(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_:o.status==="dirty"?(t.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:y.ZodPipeline})}},Ee=class extends x{_parse(e){let t=this._def.innerType._parse(e),n=o=>(He(o)&&(o.value=Object.freeze(o.value)),o);return Ye(t)?t.then(o=>n(o)):n(t)}unwrap(){return this._def.innerType}};Ee.create=(r,e)=>new Ee({innerType:r,typeName:y.ZodReadonly,...b(e)});function zr(r,e={},t){return r?oe.create().superRefine((n,o)=>{var i,a;if(!r(n)){let s=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(a=(i=s.fatal)!==null&&i!==void 0?i:t)!==null&&a!==void 0?a:!0,l=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...l,fatal:c})}}):oe.create()}var ro={object:D.lazycreate},y;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(y||(y={}));var no=(r,e={message:`Input not instance of ${r.name}`})=>zr(t=>t instanceof r,e),qr=ne.create,Hr=fe.create,oo=Ze.create,io=pe.create,Yr=he.create,ao=me.create,so=Ne.create,co=ve.create,uo=ye.create,lo=oe.create,fo=Q.create,po=q.create,ho=De.create,mo=ee.create,vo=D.create,yo=D.strictCreate,go=ge.create,_o=Et.create,bo=_e.create,xo=Y.create,wo=Ot.create,So=Me.create,ko=Le.create,To=Ct.create,Eo=be.create,Oo=xe.create,Co=we.create,jo=Se.create,Io=ie.create,Zr=Z.create,Ro=U.create,Ao=G.create,Po=Z.createWithPreprocess,No=Je.create,Do=()=>qr().optional(),Mo=()=>Hr().optional(),Lo=()=>Yr().optional(),Zo={string:r=>ne.create({...r,coerce:!0}),number:r=>fe.create({...r,coerce:!0}),boolean:r=>he.create({...r,coerce:!0}),bigint:r=>pe.create({...r,coerce:!0}),date:r=>me.create({...r,coerce:!0})},$o=_,u=Object.freeze({__proto__:null,defaultErrorMap:Pe,setErrorMap:Zn,getErrorMap:St,makeIssue:kt,EMPTY_PATH:$n,addIssueToContext:p,ParseStatus:P,INVALID:_,DIRTY:Ae,OK:N,isAborted:Yt,isDirty:Gt,isValid:He,isAsync:Ye,get util(){return k},get objectUtil(){return Ht},ZodParsedType:h,getParsedType:re,ZodType:x,datetimeRegex:Fr,ZodString:ne,ZodNumber:fe,ZodBigInt:pe,ZodBoolean:he,ZodDate:me,ZodSymbol:Ne,ZodUndefined:ve,ZodNull:ye,ZodAny:oe,ZodUnknown:Q,ZodNever:q,ZodVoid:De,ZodArray:ee,ZodObject:D,ZodUnion:ge,ZodDiscriminatedUnion:Et,ZodIntersection:_e,ZodTuple:Y,ZodRecord:Ot,ZodMap:Me,ZodSet:Le,ZodFunction:Ct,ZodLazy:be,ZodLiteral:xe,ZodEnum:we,ZodNativeEnum:Se,ZodPromise:ie,ZodEffects:Z,ZodTransformer:Z,ZodOptional:U,ZodNullable:G,ZodDefault:ke,ZodCatch:Te,ZodNaN:Ze,BRAND:to,ZodBranded:Ge,ZodPipeline:Je,ZodReadonly:Ee,custom:zr,Schema:x,ZodSchema:x,late:ro,get ZodFirstPartyTypeKind(){return y},coerce:Zo,any:lo,array:mo,bigint:io,boolean:Yr,date:ao,discriminatedUnion:_o,effect:Zr,enum:Co,function:To,instanceof:no,intersection:bo,lazy:Eo,literal:Oo,map:So,nan:oo,nativeEnum:jo,never:po,null:uo,nullable:Ao,number:Hr,object:vo,oboolean:Lo,onumber:Mo,optional:Ro,ostring:Do,pipeline:No,preprocess:Po,promise:Io,record:wo,set:ko,strictObject:yo,string:qr,symbol:so,transformer:Zr,tuple:xo,undefined:co,union:go,unknown:fo,void:ho,NEVER:$o,ZodIssueCode:f,quotelessJson:Ln,ZodError:L});var Kr=(r=>(r.Info="info",r.Debug="debug",r.Trace="trace",r.Error="error",r))(Kr||{}),Xr=(r=>(r.External="BSLIVE_EXTERNAL",r))(Xr||{}),Qr=(r=>(r.Changed="Changed",r.Added="Added",r.Removed="Removed",r))(Qr||{}),Uo=u.union([u.object({kind:u.literal("Html"),payload:u.object({html:u.string()})}),u.object({kind:u.literal("Json"),payload:u.object({json_str:u.string()})}),u.object({kind:u.literal("Raw"),payload:u.object({raw:u.string()})}),u.object({kind:u.literal("Sse"),payload:u.object({sse:u.string()})}),u.object({kind:u.literal("Proxy"),payload:u.object({proxy:u.string()})}),u.object({kind:u.literal("Dir"),payload:u.object({dir:u.string(),base:u.string().optional()})})]),Wo=u.object({path:u.string(),kind:Uo}),Fu=u.object({routes:u.array(Wo),id:u.string()}),en=u.union([u.object({kind:u.literal("Both"),payload:u.object({name:u.string(),bind_address:u.string()})}),u.object({kind:u.literal("Address"),payload:u.object({bind_address:u.string()})}),u.object({kind:u.literal("Named"),payload:u.object({name:u.string()})})]),Vo=u.object({id:u.string(),identity:en,socket_addr:u.string()}),tn=u.object({servers:u.array(Vo)}),Fo=u.object({servers_resp:tn}),Bo=u.object({path:u.string()}),Gr=u.object({path:u.string()}),zo=u.object({paths:u.array(u.string())}),qo=u.object({kind:u.string(),ms:u.string()}),Ho=u.object({paths:u.array(u.string()),debounce:qo}),Yo=u.object({paths:u.array(u.string())}),Go=u.union([u.object({kind:u.literal("Stopped"),payload:u.object({bind_address:u.string()})}),u.object({kind:u.literal("Started"),payload:u.undefined().optional()}),u.object({kind:u.literal("Patched"),payload:u.undefined().optional()}),u.object({kind:u.literal("Errored"),payload:u.object({error:u.string()})})]),Jo=u.object({identity:en,change:Go}),Bu=u.object({items:u.array(Jo)}),Ko=u.nativeEnum(Kr),Jr=u.object({log_level:Ko}),zu=u.object({kind:u.literal("ServersChanged"),payload:tn}),qu=u.nativeEnum(Xr),Hu=u.union([u.object({kind:u.literal("ServersChanged"),payload:Fo}),u.object({kind:u.literal("Watching"),payload:Ho}),u.object({kind:u.literal("WatchingStopped"),payload:Yo}),u.object({kind:u.literal("FileChanged"),payload:Gr}),u.object({kind:u.literal("FilesChanged"),payload:zo}),u.object({kind:u.literal("InputFileChanged"),payload:Gr}),u.object({kind:u.literal("InputAccepted"),payload:Bo})]),Yu=u.union([u.object({kind:u.literal("Started"),payload:u.undefined().optional()}),u.object({kind:u.literal("FailedStartup"),payload:u.string()})]),Gu=u.union([u.object({kind:u.literal("MissingInputs"),payload:u.string()}),u.object({kind:u.literal("InvalidInput"),payload:u.string()}),u.object({kind:u.literal("NotFound"),payload:u.string()}),u.object({kind:u.literal("InputWriteError"),payload:u.string()}),u.object({kind:u.literal("PathError"),payload:u.string()}),u.object({kind:u.literal("PortError"),payload:u.string()}),u.object({kind:u.literal("DirError"),payload:u.string()}),u.object({kind:u.literal("YamlError"),payload:u.string()}),u.object({kind:u.literal("MarkdownError"),payload:u.string()}),u.object({kind:u.literal("HtmlError"),payload:u.string()}),u.object({kind:u.literal("Io"),payload:u.string()}),u.object({kind:u.literal("UnsupportedExtension"),payload:u.string()}),u.object({kind:u.literal("MissingExtension"),payload:u.string()}),u.object({kind:u.literal("EmptyInput"),payload:u.string()}),u.object({kind:u.literal("BsLiveRules"),payload:u.string()})]),Xo=u.nativeEnum(Qr),jt=u.lazy(()=>u.union([u.object({kind:u.literal("Fs"),payload:u.object({path:u.string(),change_kind:Xo})}),u.object({kind:u.literal("FsMany"),payload:u.array(jt)})])),Ju=u.union([u.object({kind:u.literal("Change"),payload:jt}),u.object({kind:u.literal("WsConnection"),payload:Jr}),u.object({kind:u.literal("Config"),payload:Jr})]);var rn=[{selector:"background",styleNames:["backgroundImage"]},{selector:"border",styleNames:["borderImage","webkitBorderImage","MozBorderImage"]}],It={stylesheetReloadTimeout:15e3},Qo=/\.(jpe?g|png|gif|svg)$/i,Rt=class{constructor(e,t,n){this.window=e,this.console=t,this.Timer=n,this.document=this.window.document,this.importCacheWaitPeriod=200,this.plugins=[]}addPlugin(e){return this.plugins.push(e)}analyze(e){}reload(e,t={}){if(this.options={...It,...t},!(t.liveCSS&&e.match(/\.css(?:\.map)?$/i)&&this.reloadStylesheet(e))){if(t.liveImg&&e.match(Qo)){this.reloadImages(e);return}if(t.isChromeExtension){this.reloadChromeExtension();return}return this.reloadPage()}}reloadPage(){return this.window.document.location.reload()}reloadChromeExtension(){return this.window.chrome.runtime.reload()}reloadImages(e){let t,n=this.generateUniqueString();for(t of Array.from(this.document.images))nn(e,Kt(t.src))&&(t.src=this.generateCacheBustUrl(t.src,n));if(this.document.querySelectorAll)for(let{selector:o,styleNames:i}of rn)for(t of Array.from(this.document.querySelectorAll(`[style*=${o}]`)))this.reloadStyleImages(t.style,i,e,n);if(this.document.styleSheets)return Array.from(this.document.styleSheets).map(o=>this.reloadStylesheetImages(o,e,n))}reloadStylesheetImages(e,t,n){let o;try{o=(e||{}).cssRules}catch{}if(o)for(let i of Array.from(o))switch(i.type){case CSSRule.IMPORT_RULE:this.reloadStylesheetImages(i.styleSheet,t,n);break;case CSSRule.STYLE_RULE:for(let{styleNames:a}of rn)this.reloadStyleImages(i.style,a,t,n);break;case CSSRule.MEDIA_RULE:this.reloadStylesheetImages(i,t,n);break}}reloadStyleImages(e,t,n,o){for(let i of t){let a=e[i];if(typeof a=="string"){let s=a.replace(new RegExp("\\burl\\s*\\(([^)]*)\\)"),(c,l)=>nn(n,Kt(l))?`url(${this.generateCacheBustUrl(l,o)})`:c);s!==a&&(e[i]=s)}}}reloadStylesheet(e){let t=this.options||It,n,o,i=(()=>{let c=[];for(o of Array.from(this.document.getElementsByTagName("link")))o.rel.match(/^stylesheet$/i)&&!o.__LiveReload_pendingRemoval&&c.push(o);return c})(),a=[];for(n of Array.from(this.document.getElementsByTagName("style")))n.sheet&&this.collectImportedStylesheets(n,n.sheet,a);for(o of Array.from(i))this.collectImportedStylesheets(o,o.sheet,a);if(this.window.StyleFix&&this.document.querySelectorAll)for(n of Array.from(this.document.querySelectorAll("style[data-href]")))i.push(n);this.console.debug(`found ${i.length} LINKed stylesheets, ${a.length} @imported stylesheets`);let s=ei(e,i.concat(a),c=>Kt(this.linkHref(c)));if(s)s.object.rule?(this.console.debug(`is reloading imported stylesheet: ${s.object.href}`),this.reattachImportedRule(s.object)):(this.console.debug(`is reloading stylesheet: ${this.linkHref(s.object)}`),this.reattachStylesheetLink(s.object));else if(t.reloadMissingCSS){this.console.debug(`will reload all stylesheets because path '${e}' did not match any specific one. To disable this behavior, set 'options.reloadMissingCSS' to 'false'.`);for(o of Array.from(i))this.reattachStylesheetLink(o)}else this.console.debug(`will not reload path '${e}' because the stylesheet was not found on the page and 'options.reloadMissingCSS' was set to 'false'.`);return!0}collectImportedStylesheets(e,t,n){let o;try{o=(t||{}).cssRules}catch{}if(o&&o.length)for(let i=0;i{if(!o)return o=!0,t()};if(e.onload=()=>(this.console.debug("the new stylesheet has finished loading"),this.knownToSupportCssOnLoad=!0,i()),!this.knownToSupportCssOnLoad){let a;(a=()=>e.sheet?(this.console.debug("is polling until the new CSS finishes loading..."),i()):this.Timer.start(50,a))()}return this.Timer.start(n.stylesheetReloadTimeout,i)}linkHref(e){return e.href||e.getAttribute&&e.getAttribute("data-href")}reattachStylesheetLink(e){let t;if(e.__LiveReload_pendingRemoval)return;e.__LiveReload_pendingRemoval=!0,e.tagName==="STYLE"?(t=this.document.createElement("link"),t.rel="stylesheet",t.media=e.media,t.disabled=e.disabled):t=e.cloneNode(!1),t.href=this.generateCacheBustUrl(this.linkHref(e));let n=e.parentNode;return n.lastChild===e?n.appendChild(t):n.insertBefore(t,e.nextSibling),this.waitUntilCssLoads(t,()=>{let o;return/AppleWebKit/.test(this.window.navigator.userAgent)?o=5:o=200,this.Timer.start(o,()=>{if(e.parentNode)return e.parentNode.removeChild(e),t.onreadystatechange=null,this.window.StyleFix?this.window.StyleFix.link(t):void 0})})}reattachImportedRule({rule:e,index:t,link:n}){let o=e.parentStyleSheet,i=this.generateCacheBustUrl(e.href),a=e.media.length?[].join.call(e.media,", "):"",s=`@import url("${i}") ${a};`;e.__LiveReload_newHref=i;let c=this.document.createElement("link");return c.rel="stylesheet",c.href=i,c.__LiveReload_pendingRemoval=!0,n.parentNode&&n.parentNode.insertBefore(c,n),this.Timer.start(this.importCacheWaitPeriod,()=>{if(c.parentNode&&c.parentNode.removeChild(c),e.__LiveReload_newHref===i)return o.insertRule(s,t),o.deleteRule(t+1),e=o.cssRules[t],e.__LiveReload_newHref=i,this.Timer.start(this.importCacheWaitPeriod,()=>{if(e.__LiveReload_newHref===i)return o.insertRule(s,t),o.deleteRule(t+1)})})}generateUniqueString(){return`livereload=${Date.now()}`}generateCacheBustUrl(e,t){let n=this.options||It,o,i;if(t||(t=this.generateUniqueString()),{url:e,hash:o,params:i}=on(e),n.overrideURL&&e.indexOf(n.serverURL)<0){let s=e;e=n.serverURL+n.overrideURL+"?url="+encodeURIComponent(e),this.console.debug(`is overriding source URL ${s} with ${e}`)}let a=i.replace(/(\?|&)livereload=(\d+)/,(s,c)=>`${c}${t}`);return a===i&&(i.length===0?a=`?${t}`:a=`${i}&${t}`),e+a+o}};function on(r){let e="",t="",n=r.indexOf("#");n>=0&&(e=r.slice(n),r=r.slice(0,n));let o=r.indexOf("??");return o>=0?o+1!==r.lastIndexOf("?")&&(n=r.lastIndexOf("?")):n=r.indexOf("?"),n>=0&&(t=r.slice(n),r=r.slice(0,n)),{url:r,params:t,hash:e}}function Kt(r){if(!r)return"";let e;return{url:r}=on(r),r.indexOf("file://")===0?e=r.replace(new RegExp("^file://(localhost)?"),""):e=r.replace(new RegExp("^([^:]+:)?//([^:/]+)(:\\d*)?/"),"/"),decodeURIComponent(e)}function an(r,e){if(r=r.replace(/^\/+/,"").toLowerCase(),e=e.replace(/^\/+/,"").toLowerCase(),r===e)return 1e4;let t=r.split(/\/|\\/).reverse(),n=e.split(/\/|\\/).reverse(),o=Math.min(t.length,n.length),i=0;for(;in){let n,o={score:0};for(let i of e)n=an(r,t(i)),n>o.score&&(o={object:i,score:n});return o.score===0?null:o}function nn(r,e){return an(r,e)>0}var un=gn(cn());var ti=/\.(jpe?g|png|gif|svg)$/i;function Xt(r,e,t){switch(r.kind){case"FsMany":{if(r.payload.some(o=>{switch(o.kind){case"Fs":return!(o.payload.path.match(/\.css(?:\.map)?$/i)||o.payload.path.match(ti));case"FsMany":throw new Error("unreachable")}}))return window.__playwright?.record?window.__playwright?.record({kind:"reloadPage"}):t.reloadPage();for(let o of r.payload)Xt(o,e,t);break}case"Fs":{let n=r.payload.path,o={liveCSS:!0,liveImg:!0,reloadMissingCSS:!0,originalPath:"",overrideURL:"",serverURL:""};window.__playwright?.record?window.__playwright?.record({kind:"reload",args:{path:n,opts:o}}):(e.trace("will reload a file with path ",n),t.reload(n,o))}}}var Qt={name:"dom plugin",globalSetup:(r,e)=>{let t=new Rt(window,e,un.Timer);return[r,[e,t]]},resetSink(r,e,t){let[n,o]=e;return r.pipe(de(i=>i.kind==="Change"),K(i=>i.payload),Be(i=>{n.trace("incoming message",JSON.stringify({change:i,config:t},null,2));let a=jt.parse(i);Xt(a,n,o)}),Fe())}};var ri=Dr(),Ke=ri.create(),[ni,er]=zt.globalSetup(Ke,Mr),[oi,ii]=Qt.globalSetup(Ke,er),ln=Ke.pipe(de(r=>r.kind==="WsConnection"),K(r=>r.payload),Vt()),ai=Ke.pipe(de(r=>r.kind==="Config"),K(r=>r.payload)),fl=Ke.pipe(de(r=>r.kind==="Change"),K(r=>r.payload));wt(ai,ln).pipe(Ft(r=>{let e=[Qt.resetSink(oi,ii,r),zt.resetSink(ni,er,r)];return wt(...e)})).subscribe();ln.subscribe(r=>{er.info("\u{1F7E2} Browsersync Live connected",{config:r})}); + `):"",this.name="UnsubscriptionError",this.errors=t}});function se(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var H=function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,o,i;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var s=J(a),c=s.next();!c.done;c=s.next()){var l=c.value;l.remove(this)}}catch(w){e={error:w}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else a.remove(this);var d=this.initialTeardown;if(S(d))try{d()}catch(w){i=w instanceof nt?w.errors:[w]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var T=J(v),g=T.next();!g.done;g=T.next()){var E=g.value;try{ar(E)}catch(w){i=i??[],w instanceof nt?i=F(F([],V(i)),V(w.errors)):i.push(w)}}}catch(w){n={error:w}}finally{try{g&&!g.done&&(o=T.return)&&o.call(T)}finally{if(n)throw n.error}}}if(i)throw new nt(i)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)ar(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&se(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&se(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=function(){var e=new r;return e.closed=!0,e}(),r}();var Nt=H.EMPTY;function ot(r){return r instanceof H||r&&"closed"in r&&S(r.remove)&&S(r.add)&&S(r.unsubscribe)}function ar(r){S(r)?r():r.unsubscribe()}var B={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Ce={setTimeout:function(r,e){for(var t=[],n=2;n0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,o=this,i=o.hasError,a=o.isStopped,s=o.observers;return i||a?Nt:(this.currentObservers=null,s.push(t),new H(function(){n.currentObservers=null,se(s,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,o=n.hasError,i=n.thrownError,a=n.isStopped;o?t.error(i):a&&t.complete()},e.prototype.asObservable=function(){var t=new O;return t.source=this,t},e.create=function(t,n){return new st(t,n)},e}(O);var st=function(r){R(e,r);function e(t,n){var o=r.call(this)||this;return o.destination=t,o.source=n,o}return e.prototype.next=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,t)},e.prototype.error=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&o!==void 0?o:Nt},e}(z);var We={now:function(){return(We.delegate||Date).now()},delegate:void 0};var ct=function(r){R(e,r);function e(t,n,o){t===void 0&&(t=1/0),n===void 0&&(n=1/0),o===void 0&&(o=We);var i=r.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return e.prototype.next=function(t){var n=this,o=n.isStopped,i=n._buffer,a=n._infiniteTimeWindow,s=n._timestampProvider,c=n._windowTime;o||(i.push(t),!a&&i.push(s.now()+c)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),o=this,i=o._infiniteTimeWindow,a=o._buffer,s=a.slice(),c=0;c0&&(d=new le({next:function(Qe){return Xe.next(Qe)},error:function(Qe){w=!0,A(),v=Wt(M,o,Qe),Xe.error(Qe)},complete:function(){E=!0,A(),v=Wt(M,a),Xe.complete()}}),I($e).subscribe(d))})(l)}}function Wt(r,e){for(var t=[],n=2;n{let r=new URL(window.location.href);return r.protocol=r.protocol==="http:"?"ws":"wss",r.pathname="/__bs_ws",Bt(r.origin+r.pathname).pipe(Ut({delay:5e3}))}}}var Mr={debug(...r){},error(...r){},info(...r){},trace(...r){}},zt={name:"console",globalSetup:r=>{let e=new z;return[e,{debug:function(...n){e.next({level:"debug",args:n})},info:function(...n){e.next({level:"info",args:n})},trace:function(...n){e.next({level:"trace",args:n})},error:function(...n){e.next({level:"error",args:n})}}]},resetSink:(r,e,t)=>r.pipe(Be(n=>{let o=["trace","debug","info","error"],i=o.indexOf(n.level),a=o.indexOf(t.log_level);i>=a&&console.log(`[${n.level}]`,...n.args)}),Fe())};var k;(function(r){r.assertEqual=o=>o;function e(o){}r.assertIs=e;function t(o){throw new Error}r.assertNever=t,r.arrayToEnum=o=>{let i={};for(let a of o)i[a]=a;return i},r.getValidEnumValues=o=>{let i=r.objectKeys(o).filter(s=>typeof o[o[s]]!="number"),a={};for(let s of i)a[s]=o[s];return r.objectValues(a)},r.objectValues=o=>r.objectKeys(o).map(function(i){return o[i]}),r.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let i=[];for(let a in o)Object.prototype.hasOwnProperty.call(o,a)&&i.push(a);return i},r.find=(o,i)=>{for(let a of o)if(i(a))return a},r.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,i=" | "){return o.map(a=>typeof a=="string"?`'${a}'`:a).join(i)}r.joinValues=n,r.jsonStringifyReplacer=(o,i)=>typeof i=="bigint"?i.toString():i})(k||(k={}));var Ht;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Ht||(Ht={}));var h=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),re=r=>{switch(typeof r){case"undefined":return h.undefined;case"string":return h.string;case"number":return isNaN(r)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(r)?h.array:r===null?h.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?h.promise:typeof Map<"u"&&r instanceof Map?h.map:typeof Set<"u"&&r instanceof Set?h.set:typeof Date<"u"&&r instanceof Date?h.date:h.object;default:return h.unknown}},f=k.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ln=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),L=class r extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(i){return i.message},n={_errors:[]},o=i=>{for(let a of i.issues)if(a.code==="invalid_union")a.unionErrors.map(o);else if(a.code==="invalid_return_type")o(a.returnTypeError);else if(a.code==="invalid_arguments")o(a.argumentsError);else if(a.path.length===0)n._errors.push(t(a));else{let s=n,c=0;for(;ct.message){let t={},n=[];for(let o of this.issues)o.path.length>0?(t[o.path[0]]=t[o.path[0]]||[],t[o.path[0]].push(e(o))):n.push(e(o));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};L.create=r=>new L(r);var Pe=(r,e)=>{let t;switch(r.code){case f.invalid_type:r.received===h.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case f.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,k.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:t=`Unrecognized key(s) in object: ${k.joinValues(r.keys,", ")}`;break;case f.invalid_union:t="Invalid input";break;case f.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${k.joinValues(r.options)}`;break;case f.invalid_enum_value:t=`Invalid enum value. Expected ${k.joinValues(r.options)}, received '${r.received}'`;break;case f.invalid_arguments:t="Invalid function arguments";break;case f.invalid_return_type:t="Invalid function return type";break;case f.invalid_date:t="Invalid date";break;case f.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:k.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case f.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case f.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case f.custom:t="Invalid input";break;case f.invalid_intersection_types:t="Intersection results could not be merged";break;case f.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case f.not_finite:t="Number must be finite";break;default:t=e.defaultError,k.assertNever(r)}return{message:t}},$r=Pe;function Zn(r){$r=r}function St(){return $r}var kt=r=>{let{data:e,path:t,errorMaps:n,issueData:o}=r,i=[...t,...o.path||[]],a={...o,path:i};if(o.message!==void 0)return{...o,path:i,message:o.message};let s="",c=n.filter(l=>!!l).slice().reverse();for(let l of c)s=l(a,{data:e,defaultError:s}).message;return{...o,path:i,message:s}},$n=[];function p(r,e){let t=St(),n=kt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===Pe?void 0:Pe].filter(o=>!!o)});r.common.issues.push(n)}var P=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let o of t){if(o.status==="aborted")return _;o.status==="dirty"&&e.dirty(),n.push(o.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let o of t){let i=await o.key,a=await o.value;n.push({key:i,value:a})}return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let o of t){let{key:i,value:a}=o;if(i.status==="aborted"||a.status==="aborted")return _;i.status==="dirty"&&e.dirty(),a.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof a.value<"u"||o.alwaysSet)&&(n[i.value]=a.value)}return{status:e.value,value:n}}},_=Object.freeze({status:"aborted"}),Ae=r=>({status:"dirty",value:r}),N=r=>({status:"valid",value:r}),Yt=r=>r.status==="aborted",Gt=r=>r.status==="dirty",He=r=>r.status==="valid",Ye=r=>typeof Promise<"u"&&r instanceof Promise;function Tt(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)}function Ur(r,e,t,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(r,t):o?o.value=t:e.set(r,t),t}var m;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));var ze,qe,W=class{constructor(e,t,n,o){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=o}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Lr=(r,e)=>{if(He(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new L(r.common.issues);return this._error=t,this._error}}};function b(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:o}=r;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:o}:{errorMap:(a,s)=>{var c,l;let{message:d}=r;return a.code==="invalid_enum_value"?{message:d??s.defaultError}:typeof s.data>"u"?{message:(c=d??n)!==null&&c!==void 0?c:s.defaultError}:a.code!=="invalid_type"?{message:s.defaultError}:{message:(l=d??t)!==null&&l!==void 0?l:s.defaultError}},description:o}}var x=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return re(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:re(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new P,ctx:{common:e.parent.common,data:e.data,parsedType:re(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Ye(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let o={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:re(e)},i=this._parseSync({data:e,path:o.path,parent:o});return Lr(o,i)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:re(e)},o=this._parse({data:e,path:n.path,parent:n}),i=await(Ye(o)?o:Promise.resolve(o));return Lr(n,i)}refine(e,t){let n=o=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(o):t;return this._refinement((o,i)=>{let a=e(o),s=()=>i.addIssue({code:f.custom,...n(o)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(e,t){return this._refinement((n,o)=>e(n)?!0:(o.addIssue(typeof t=="function"?t(n,o):t),!1))}_refinement(e){return new Z({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return U.create(this,this._def)}nullable(){return G.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ee.create(this,this._def)}promise(){return ie.create(this,this._def)}or(e){return ge.create([this,e],this._def)}and(e){return _e.create(this,e,this._def)}transform(e){return new Z({...b(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new ke({...b(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new Ge({typeName:y.ZodBranded,type:this,...b(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Te({...b(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Je.create(this,e)}readonly(){return Ee.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Un=/^c[^\s-]{8,}$/i,Wn=/^[0-9a-z]+$/,Vn=/^[0-9A-HJKMNP-TV-Z]{26}$/,Fn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Bn=/^[a-z0-9_-]{21}$/i,zn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,qn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Hn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",qt,Yn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Gn=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Jn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wr="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Kn=new RegExp(`^${Wr}$`);function Vr(r){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?e=`${e}\\.\\d{${r.precision}}`:r.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Xn(r){return new RegExp(`^${Vr(r)}$`)}function Fr(r){let e=`${Wr}T${Vr(r)}`,t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Qn(r,e){return!!((e==="v4"||!e)&&Yn.test(r)||(e==="v6"||!e)&&Gn.test(r))}var ne=class r extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){let i=this._getOrReturnCtx(e);return p(i,{code:f.invalid_type,expected:h.string,received:i.parsedType}),_}let n=new P,o;for(let i of this._def.checks)if(i.kind==="min")e.data.lengthi.value&&(o=this._getOrReturnCtx(e,o),p(o,{code:f.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){let a=e.data.length>i.value,s=e.data.lengthe.test(o),{validation:t,code:f.invalid_string,...m.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...m.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new ne({checks:[],typeName:y.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...b(r)})};function eo(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,o=t>n?t:n,i=parseInt(r.toFixed(o).replace(".","")),a=parseInt(e.toFixed(o).replace(".",""));return i%a/Math.pow(10,o)}var fe=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){let i=this._getOrReturnCtx(e);return p(i,{code:f.invalid_type,expected:h.number,received:i.parsedType}),_}let n,o=new P;for(let i of this._def.checks)i.kind==="int"?k.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:f.invalid_type,expected:"integer",received:"float",message:i.message}),o.dirty()):i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:f.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),o.dirty()):i.kind==="multipleOf"?eo(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:f.not_finite,message:i.message}),o.dirty()):k.assertNever(i);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,o){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(o)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&k.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.valuenew fe({checks:[],typeName:y.ZodNumber,coerce:r?.coerce||!1,...b(r)});var pe=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==h.bigint){let i=this._getOrReturnCtx(e);return p(i,{code:f.invalid_type,expected:h.bigint,received:i.parsedType}),_}let n,o=new P;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.datai.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:f.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),o.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:f.not_multiple_of,multipleOf:i.value,message:i.message}),o.dirty()):k.assertNever(i);return{status:o.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,o){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(o)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new pe({checks:[],typeName:y.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...b(r)})};var he=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.boolean,received:n.parsedType}),_}return N(e.data)}};he.create=r=>new he({typeName:y.ZodBoolean,coerce:r?.coerce||!1,...b(r)});var me=class r extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){let i=this._getOrReturnCtx(e);return p(i,{code:f.invalid_type,expected:h.date,received:i.parsedType}),_}if(isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return p(i,{code:f.invalid_date}),_}let n=new P,o;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()i.value&&(o=this._getOrReturnCtx(e,o),p(o,{code:f.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):k.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew me({checks:[],coerce:r?.coerce||!1,typeName:y.ZodDate,...b(r)});var Ne=class extends x{_parse(e){if(this._getType(e)!==h.symbol){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.symbol,received:n.parsedType}),_}return N(e.data)}};Ne.create=r=>new Ne({typeName:y.ZodSymbol,...b(r)});var ve=class extends x{_parse(e){if(this._getType(e)!==h.undefined){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.undefined,received:n.parsedType}),_}return N(e.data)}};ve.create=r=>new ve({typeName:y.ZodUndefined,...b(r)});var ye=class extends x{_parse(e){if(this._getType(e)!==h.null){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.null,received:n.parsedType}),_}return N(e.data)}};ye.create=r=>new ye({typeName:y.ZodNull,...b(r)});var oe=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return N(e.data)}};oe.create=r=>new oe({typeName:y.ZodAny,...b(r)});var Q=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return N(e.data)}};Q.create=r=>new Q({typeName:y.ZodUnknown,...b(r)});var q=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return p(t,{code:f.invalid_type,expected:h.never,received:t.parsedType}),_}};q.create=r=>new q({typeName:y.ZodNever,...b(r)});var De=class extends x{_parse(e){if(this._getType(e)!==h.undefined){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.void,received:n.parsedType}),_}return N(e.data)}};De.create=r=>new De({typeName:y.ZodVoid,...b(r)});var ee=class r extends x{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),o=this._def;if(t.parsedType!==h.array)return p(t,{code:f.invalid_type,expected:h.array,received:t.parsedType}),_;if(o.exactLength!==null){let a=t.data.length>o.exactLength.value,s=t.data.lengtho.maxLength.value&&(p(t,{code:f.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((a,s)=>o.type._parseAsync(new W(t,a,t.path,s)))).then(a=>P.mergeArray(n,a));let i=[...t.data].map((a,s)=>o.type._parseSync(new W(t,a,t.path,s)));return P.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}};ee.create=(r,e)=>new ee({type:r,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,...b(e)});function Re(r){if(r instanceof D){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=U.create(Re(n))}return new D({...r._def,shape:()=>e})}else return r instanceof ee?new ee({...r._def,type:Re(r.element)}):r instanceof U?U.create(Re(r.unwrap())):r instanceof G?G.create(Re(r.unwrap())):r instanceof Y?Y.create(r.items.map(e=>Re(e))):r}var D=class r extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=k.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==h.object){let l=this._getOrReturnCtx(e);return p(l,{code:f.invalid_type,expected:h.object,received:l.parsedType}),_}let{status:n,ctx:o}=this._processInputParams(e),{shape:i,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof q&&this._def.unknownKeys==="strip"))for(let l in o.data)a.includes(l)||s.push(l);let c=[];for(let l of a){let d=i[l],v=o.data[l];c.push({key:{status:"valid",value:l},value:d._parse(new W(o,v,o.path,l)),alwaysSet:l in o.data})}if(this._def.catchall instanceof q){let l=this._def.unknownKeys;if(l==="passthrough")for(let d of s)c.push({key:{status:"valid",value:d},value:{status:"valid",value:o.data[d]}});else if(l==="strict")s.length>0&&(p(o,{code:f.unrecognized_keys,keys:s}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let d of s){let v=o.data[d];c.push({key:{status:"valid",value:d},value:l._parse(new W(o,v,o.path,d)),alwaysSet:d in o.data})}}return o.common.async?Promise.resolve().then(async()=>{let l=[];for(let d of c){let v=await d.key,T=await d.value;l.push({key:v,value:T,alwaysSet:d.alwaysSet})}return l}).then(l=>P.mergeObjectSync(n,l)):P.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var o,i,a,s;let c=(a=(i=(o=this._def).errorMap)===null||i===void 0?void 0:i.call(o,t,n).message)!==null&&a!==void 0?a:n.defaultError;return t.code==="unrecognized_keys"?{message:(s=m.errToObj(e).message)!==null&&s!==void 0?s:c}:{message:c}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return k.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return k.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return Re(this)}partial(e){let t={};return k.objectKeys(this.shape).forEach(n=>{let o=this.shape[n];e&&!e[n]?t[n]=o:t[n]=o.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return k.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof U;)i=i._def.innerType;t[n]=i}}),new r({...this._def,shape:()=>t})}keyof(){return Br(k.objectKeys(this.shape))}};D.create=(r,e)=>new D({shape:()=>r,unknownKeys:"strip",catchall:q.create(),typeName:y.ZodObject,...b(e)});D.strictCreate=(r,e)=>new D({shape:()=>r,unknownKeys:"strict",catchall:q.create(),typeName:y.ZodObject,...b(e)});D.lazycreate=(r,e)=>new D({shape:r,unknownKeys:"strip",catchall:q.create(),typeName:y.ZodObject,...b(e)});var ge=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function o(i){for(let s of i)if(s.result.status==="valid")return s.result;for(let s of i)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;let a=i.map(s=>new L(s.ctx.common.issues));return p(t,{code:f.invalid_union,unionErrors:a}),_}if(t.common.async)return Promise.all(n.map(async i=>{let a={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}})).then(o);{let i,a=[];for(let c of n){let l={...t,common:{...t.common,issues:[]},parent:null},d=c._parseSync({data:t.data,path:t.path,parent:l});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;let s=a.map(c=>new L(c));return p(t,{code:f.invalid_union,unionErrors:s}),_}}get options(){return this._def.options}};ge.create=(r,e)=>new ge({options:r,typeName:y.ZodUnion,...b(e)});var X=r=>r instanceof be?X(r.schema):r instanceof Z?X(r.innerType()):r instanceof xe?[r.value]:r instanceof we?r.options:r instanceof Se?k.objectValues(r.enum):r instanceof ke?X(r._def.innerType):r instanceof ve?[void 0]:r instanceof ye?[null]:r instanceof U?[void 0,...X(r.unwrap())]:r instanceof G?[null,...X(r.unwrap())]:r instanceof Ge||r instanceof Ee?X(r.unwrap()):r instanceof Te?X(r._def.innerType):[],Et=class r extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return p(t,{code:f.invalid_type,expected:h.object,received:t.parsedType}),_;let n=this.discriminator,o=t.data[n],i=this.optionsMap.get(o);return i?t.common.async?i._parseAsync({data:t.data,path:t.path,parent:t}):i._parseSync({data:t.data,path:t.path,parent:t}):(p(t,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let o=new Map;for(let i of t){let a=X(i.shape[e]);if(!a.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of a){if(o.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);o.set(s,i)}}return new r({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:o,...b(n)})}};function Jt(r,e){let t=re(r),n=re(e);if(r===e)return{valid:!0,data:r};if(t===h.object&&n===h.object){let o=k.objectKeys(e),i=k.objectKeys(r).filter(s=>o.indexOf(s)!==-1),a={...r,...e};for(let s of i){let c=Jt(r[s],e[s]);if(!c.valid)return{valid:!1};a[s]=c.data}return{valid:!0,data:a}}else if(t===h.array&&n===h.array){if(r.length!==e.length)return{valid:!1};let o=[];for(let i=0;i{if(Yt(i)||Yt(a))return _;let s=Jt(i.value,a.value);return s.valid?((Gt(i)||Gt(a))&&t.dirty(),{status:t.value,value:s.data}):(p(n,{code:f.invalid_intersection_types}),_)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,a])=>o(i,a)):o(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};_e.create=(r,e,t)=>new _e({left:r,right:e,typeName:y.ZodIntersection,...b(t)});var Y=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.array)return p(n,{code:f.invalid_type,expected:h.array,received:n.parsedType}),_;if(n.data.lengththis._def.items.length&&(p(n,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...n.data].map((a,s)=>{let c=this._def.items[s]||this._def.rest;return c?c._parse(new W(n,a,n.path,s)):null}).filter(a=>!!a);return n.common.async?Promise.all(i).then(a=>P.mergeArray(t,a)):P.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};Y.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Y({items:r,typeName:y.ZodTuple,rest:null,...b(e)})};var Ot=class r extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.object)return p(n,{code:f.invalid_type,expected:h.object,received:n.parsedType}),_;let o=[],i=this._def.keyType,a=this._def.valueType;for(let s in n.data)o.push({key:i._parse(new W(n,s,n.path,s)),value:a._parse(new W(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?P.mergeObjectAsync(t,o):P.mergeObjectSync(t,o)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof x?new r({keyType:e,valueType:t,typeName:y.ZodRecord,...b(n)}):new r({keyType:ne.create(),valueType:e,typeName:y.ZodRecord,...b(t)})}},Me=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.map)return p(n,{code:f.invalid_type,expected:h.map,received:n.parsedType}),_;let o=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([s,c],l)=>({key:o._parse(new W(n,s,n.path,[l,"key"])),value:i._parse(new W(n,c,n.path,[l,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let c of a){let l=await c.key,d=await c.value;if(l.status==="aborted"||d.status==="aborted")return _;(l.status==="dirty"||d.status==="dirty")&&t.dirty(),s.set(l.value,d.value)}return{status:t.value,value:s}})}else{let s=new Map;for(let c of a){let l=c.key,d=c.value;if(l.status==="aborted"||d.status==="aborted")return _;(l.status==="dirty"||d.status==="dirty")&&t.dirty(),s.set(l.value,d.value)}return{status:t.value,value:s}}}};Me.create=(r,e,t)=>new Me({valueType:e,keyType:r,typeName:y.ZodMap,...b(t)});var Le=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.set)return p(n,{code:f.invalid_type,expected:h.set,received:n.parsedType}),_;let o=this._def;o.minSize!==null&&n.data.sizeo.maxSize.value&&(p(n,{code:f.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.maxSize.message}),t.dirty());let i=this._def.valueType;function a(c){let l=new Set;for(let d of c){if(d.status==="aborted")return _;d.status==="dirty"&&t.dirty(),l.add(d.value)}return{status:t.value,value:l}}let s=[...n.data.values()].map((c,l)=>i._parse(new W(n,c,n.path,l)));return n.common.async?Promise.all(s).then(c=>a(c)):a(s)}min(e,t){return new r({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Le.create=(r,e)=>new Le({valueType:r,minSize:null,maxSize:null,typeName:y.ZodSet,...b(e)});var Ct=class r extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return p(t,{code:f.invalid_type,expected:h.function,received:t.parsedType}),_;function n(s,c){return kt({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,St(),Pe].filter(l=>!!l),issueData:{code:f.invalid_arguments,argumentsError:c}})}function o(s,c){return kt({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,St(),Pe].filter(l=>!!l),issueData:{code:f.invalid_return_type,returnTypeError:c}})}let i={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ie){let s=this;return N(async function(...c){let l=new L([]),d=await s._def.args.parseAsync(c,i).catch(g=>{throw l.addIssue(n(c,g)),l}),v=await Reflect.apply(a,this,d);return await s._def.returns._def.type.parseAsync(v,i).catch(g=>{throw l.addIssue(o(v,g)),l})})}else{let s=this;return N(function(...c){let l=s._def.args.safeParse(c,i);if(!l.success)throw new L([n(c,l.error)]);let d=Reflect.apply(a,this,l.data),v=s._def.returns.safeParse(d,i);if(!v.success)throw new L([o(d,v.error)]);return v.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:Y.create(e).rest(Q.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||Y.create([]).rest(Q.create()),returns:t||Q.create(),typeName:y.ZodFunction,...b(n)})}},be=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};be.create=(r,e)=>new be({getter:r,typeName:y.ZodLazy,...b(e)});var xe=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return p(t,{received:t.data,code:f.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}};xe.create=(r,e)=>new xe({value:r,typeName:y.ZodLiteral,...b(e)});function Br(r,e){return new we({values:r,typeName:y.ZodEnum,...b(e)})}var we=class r extends x{constructor(){super(...arguments),ze.set(this,void 0)}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{expected:k.joinValues(n),received:t.parsedType,code:f.invalid_type}),_}if(Tt(this,ze,"f")||Ur(this,ze,new Set(this._def.values),"f"),!Tt(this,ze,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return p(t,{received:t.data,code:f.invalid_enum_value,options:n}),_}return N(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,{...this._def,...t})}exclude(e,t=this._def){return r.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};ze=new WeakMap;we.create=Br;var Se=class extends x{constructor(){super(...arguments),qe.set(this,void 0)}_parse(e){let t=k.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.string&&n.parsedType!==h.number){let o=k.objectValues(t);return p(n,{expected:k.joinValues(o),received:n.parsedType,code:f.invalid_type}),_}if(Tt(this,qe,"f")||Ur(this,qe,new Set(k.getValidEnumValues(this._def.values)),"f"),!Tt(this,qe,"f").has(e.data)){let o=k.objectValues(t);return p(n,{received:n.data,code:f.invalid_enum_value,options:o}),_}return N(e.data)}get enum(){return this._def.values}};qe=new WeakMap;Se.create=(r,e)=>new Se({values:r,typeName:y.ZodNativeEnum,...b(e)});var ie=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return p(t,{code:f.invalid_type,expected:h.promise,received:t.parsedType}),_;let n=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return N(n.then(o=>this._def.type.parseAsync(o,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ie.create=(r,e)=>new ie({type:r,typeName:y.ZodPromise,...b(e)});var Z=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),o=this._def.effect||null,i={addIssue:a=>{p(n,a),a.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),o.type==="preprocess"){let a=o.transform(n.data,i);if(n.common.async)return Promise.resolve(a).then(async s=>{if(t.value==="aborted")return _;let c=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return c.status==="aborted"?_:c.status==="dirty"||t.value==="dirty"?Ae(c.value):c});{if(t.value==="aborted")return _;let s=this._def.schema._parseSync({data:a,path:n.path,parent:n});return s.status==="aborted"?_:s.status==="dirty"||t.value==="dirty"?Ae(s.value):s}}if(o.type==="refinement"){let a=s=>{let c=o.refinement(s,i);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?_:(s.status==="dirty"&&t.dirty(),a(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?_:(s.status==="dirty"&&t.dirty(),a(s.value).then(()=>({status:t.value,value:s.value}))))}if(o.type==="transform")if(n.common.async===!1){let a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!He(a))return a;let s=o.transform(a.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>He(a)?Promise.resolve(o.transform(a.value,i)).then(s=>({status:t.value,value:s})):a);k.assertNever(o)}};Z.create=(r,e,t)=>new Z({schema:r,typeName:y.ZodEffects,effect:e,...b(t)});Z.createWithPreprocess=(r,e,t)=>new Z({schema:e,effect:{type:"preprocess",transform:r},typeName:y.ZodEffects,...b(t)});var U=class extends x{_parse(e){return this._getType(e)===h.undefined?N(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};U.create=(r,e)=>new U({innerType:r,typeName:y.ZodOptional,...b(e)});var G=class extends x{_parse(e){return this._getType(e)===h.null?N(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};G.create=(r,e)=>new G({innerType:r,typeName:y.ZodNullable,...b(e)});var ke=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===h.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ke.create=(r,e)=>new ke({innerType:r,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});var Te=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},o=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ye(o)?o.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new L(n.common.issues)},input:n.data})})):{status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new L(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Te.create=(r,e)=>new Te({innerType:r,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});var Ze=class extends x{_parse(e){if(this._getType(e)!==h.nan){let n=this._getOrReturnCtx(e);return p(n,{code:f.invalid_type,expected:h.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}};Ze.create=r=>new Ze({typeName:y.ZodNaN,...b(r)});var to=Symbol("zod_brand"),Ge=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},Je=class r extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?_:i.status==="dirty"?(t.dirty(),Ae(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_:o.status==="dirty"?(t.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:y.ZodPipeline})}},Ee=class extends x{_parse(e){let t=this._def.innerType._parse(e),n=o=>(He(o)&&(o.value=Object.freeze(o.value)),o);return Ye(t)?t.then(o=>n(o)):n(t)}unwrap(){return this._def.innerType}};Ee.create=(r,e)=>new Ee({innerType:r,typeName:y.ZodReadonly,...b(e)});function zr(r,e={},t){return r?oe.create().superRefine((n,o)=>{var i,a;if(!r(n)){let s=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,c=(a=(i=s.fatal)!==null&&i!==void 0?i:t)!==null&&a!==void 0?a:!0,l=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...l,fatal:c})}}):oe.create()}var ro={object:D.lazycreate},y;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(y||(y={}));var no=(r,e={message:`Input not instance of ${r.name}`})=>zr(t=>t instanceof r,e),qr=ne.create,Hr=fe.create,oo=Ze.create,io=pe.create,Yr=he.create,ao=me.create,so=Ne.create,co=ve.create,uo=ye.create,lo=oe.create,fo=Q.create,po=q.create,ho=De.create,mo=ee.create,vo=D.create,yo=D.strictCreate,go=ge.create,_o=Et.create,bo=_e.create,xo=Y.create,wo=Ot.create,So=Me.create,ko=Le.create,To=Ct.create,Eo=be.create,Oo=xe.create,Co=we.create,jo=Se.create,Io=ie.create,Zr=Z.create,Ro=U.create,Ao=G.create,Po=Z.createWithPreprocess,No=Je.create,Do=()=>qr().optional(),Mo=()=>Hr().optional(),Lo=()=>Yr().optional(),Zo={string:r=>ne.create({...r,coerce:!0}),number:r=>fe.create({...r,coerce:!0}),boolean:r=>he.create({...r,coerce:!0}),bigint:r=>pe.create({...r,coerce:!0}),date:r=>me.create({...r,coerce:!0})},$o=_,u=Object.freeze({__proto__:null,defaultErrorMap:Pe,setErrorMap:Zn,getErrorMap:St,makeIssue:kt,EMPTY_PATH:$n,addIssueToContext:p,ParseStatus:P,INVALID:_,DIRTY:Ae,OK:N,isAborted:Yt,isDirty:Gt,isValid:He,isAsync:Ye,get util(){return k},get objectUtil(){return Ht},ZodParsedType:h,getParsedType:re,ZodType:x,datetimeRegex:Fr,ZodString:ne,ZodNumber:fe,ZodBigInt:pe,ZodBoolean:he,ZodDate:me,ZodSymbol:Ne,ZodUndefined:ve,ZodNull:ye,ZodAny:oe,ZodUnknown:Q,ZodNever:q,ZodVoid:De,ZodArray:ee,ZodObject:D,ZodUnion:ge,ZodDiscriminatedUnion:Et,ZodIntersection:_e,ZodTuple:Y,ZodRecord:Ot,ZodMap:Me,ZodSet:Le,ZodFunction:Ct,ZodLazy:be,ZodLiteral:xe,ZodEnum:we,ZodNativeEnum:Se,ZodPromise:ie,ZodEffects:Z,ZodTransformer:Z,ZodOptional:U,ZodNullable:G,ZodDefault:ke,ZodCatch:Te,ZodNaN:Ze,BRAND:to,ZodBranded:Ge,ZodPipeline:Je,ZodReadonly:Ee,custom:zr,Schema:x,ZodSchema:x,late:ro,get ZodFirstPartyTypeKind(){return y},coerce:Zo,any:lo,array:mo,bigint:io,boolean:Yr,date:ao,discriminatedUnion:_o,effect:Zr,enum:Co,function:To,instanceof:no,intersection:bo,lazy:Eo,literal:Oo,map:So,nan:oo,nativeEnum:jo,never:po,null:uo,nullable:Ao,number:Hr,object:vo,oboolean:Lo,onumber:Mo,optional:Ro,ostring:Do,pipeline:No,preprocess:Po,promise:Io,record:wo,set:ko,strictObject:yo,string:qr,symbol:so,transformer:Zr,tuple:xo,undefined:co,union:go,unknown:fo,void:ho,NEVER:$o,ZodIssueCode:f,quotelessJson:Ln,ZodError:L});var Kr=(r=>(r.Info="info",r.Debug="debug",r.Trace="trace",r.Error="error",r))(Kr||{}),Xr=(r=>(r.Changed="Changed",r.Added="Added",r.Removed="Removed",r))(Xr||{}),Qr=(r=>(r.External="BSLIVE_EXTERNAL",r))(Qr||{}),Uo=u.nativeEnum(Kr),Gr=u.object({log_level:Uo}),Wo=u.object({kind:u.string(),ms:u.string()}),Jr=u.object({path:u.string()}),Vo=u.object({paths:u.array(u.string())}),en=u.union([u.object({kind:u.literal("Both"),payload:u.object({name:u.string(),bind_address:u.string()})}),u.object({kind:u.literal("Address"),payload:u.object({bind_address:u.string()})}),u.object({kind:u.literal("Named"),payload:u.object({name:u.string()})})]),Fo=u.object({id:u.string(),identity:en,socket_addr:u.string()}),tn=u.object({servers:u.array(Fo)}),Bo=u.object({path:u.string()}),zo=u.union([u.object({kind:u.literal("Html"),payload:u.object({html:u.string()})}),u.object({kind:u.literal("Json"),payload:u.object({json_str:u.string()})}),u.object({kind:u.literal("Raw"),payload:u.object({raw:u.string()})}),u.object({kind:u.literal("Sse"),payload:u.object({sse:u.string()})}),u.object({kind:u.literal("Proxy"),payload:u.object({proxy:u.string()})}),u.object({kind:u.literal("Dir"),payload:u.object({dir:u.string(),base:u.string().optional()})})]),qo=u.object({path:u.string(),kind:zo}),Ho=u.union([u.object({kind:u.literal("Stopped"),payload:u.object({bind_address:u.string()})}),u.object({kind:u.literal("Started"),payload:u.undefined().optional()}),u.object({kind:u.literal("Patched"),payload:u.undefined().optional()}),u.object({kind:u.literal("Errored"),payload:u.object({error:u.string()})})]),Yo=u.object({identity:en,change:Ho}),Fu=u.object({items:u.array(Yo)}),Bu=u.object({routes:u.array(qo),id:u.string()}),Go=u.object({servers_resp:tn}),Jo=u.object({paths:u.array(u.string())}),Ko=u.object({paths:u.array(u.string()),debounce:Wo}),Xo=u.nativeEnum(Xr),jt=u.lazy(()=>u.union([u.object({kind:u.literal("Fs"),payload:u.object({path:u.string(),change_kind:Xo})}),u.object({kind:u.literal("FsMany"),payload:u.array(jt)})])),zu=u.union([u.object({kind:u.literal("Change"),payload:jt}),u.object({kind:u.literal("WsConnection"),payload:Gr}),u.object({kind:u.literal("Config"),payload:Gr})]),qu=u.nativeEnum(Qr),Hu=u.union([u.object({kind:u.literal("ServersChanged"),payload:Go}),u.object({kind:u.literal("Watching"),payload:Ko}),u.object({kind:u.literal("WatchingStopped"),payload:Jo}),u.object({kind:u.literal("FileChanged"),payload:Jr}),u.object({kind:u.literal("FilesChanged"),payload:Vo}),u.object({kind:u.literal("InputFileChanged"),payload:Jr}),u.object({kind:u.literal("InputAccepted"),payload:Bo})]),Yu=u.union([u.object({kind:u.literal("MissingInputs"),payload:u.string()}),u.object({kind:u.literal("InvalidInput"),payload:u.string()}),u.object({kind:u.literal("NotFound"),payload:u.string()}),u.object({kind:u.literal("InputWriteError"),payload:u.string()}),u.object({kind:u.literal("PathError"),payload:u.string()}),u.object({kind:u.literal("PortError"),payload:u.string()}),u.object({kind:u.literal("DirError"),payload:u.string()}),u.object({kind:u.literal("YamlError"),payload:u.string()}),u.object({kind:u.literal("MarkdownError"),payload:u.string()}),u.object({kind:u.literal("HtmlError"),payload:u.string()}),u.object({kind:u.literal("Io"),payload:u.string()}),u.object({kind:u.literal("UnsupportedExtension"),payload:u.string()}),u.object({kind:u.literal("MissingExtension"),payload:u.string()}),u.object({kind:u.literal("EmptyInput"),payload:u.string()}),u.object({kind:u.literal("BsLiveRules"),payload:u.string()})]),Gu=u.object({kind:u.literal("ServersChanged"),payload:tn}),Ju=u.union([u.object({kind:u.literal("Started"),payload:u.undefined().optional()}),u.object({kind:u.literal("FailedStartup"),payload:u.string()})]);var rn=[{selector:"background",styleNames:["backgroundImage"]},{selector:"border",styleNames:["borderImage","webkitBorderImage","MozBorderImage"]}],It={stylesheetReloadTimeout:15e3},Qo=/\.(jpe?g|png|gif|svg)$/i,Rt=class{constructor(e,t,n){this.window=e,this.console=t,this.Timer=n,this.document=this.window.document,this.importCacheWaitPeriod=200,this.plugins=[]}addPlugin(e){return this.plugins.push(e)}analyze(e){}reload(e,t={}){if(this.options={...It,...t},!(t.liveCSS&&e.match(/\.css(?:\.map)?$/i)&&this.reloadStylesheet(e))){if(t.liveImg&&e.match(Qo)){this.reloadImages(e);return}if(t.isChromeExtension){this.reloadChromeExtension();return}return this.reloadPage()}}reloadPage(){return this.window.document.location.reload()}reloadChromeExtension(){return this.window.chrome.runtime.reload()}reloadImages(e){let t,n=this.generateUniqueString();for(t of Array.from(this.document.images))nn(e,Kt(t.src))&&(t.src=this.generateCacheBustUrl(t.src,n));if(this.document.querySelectorAll)for(let{selector:o,styleNames:i}of rn)for(t of Array.from(this.document.querySelectorAll(`[style*=${o}]`)))this.reloadStyleImages(t.style,i,e,n);if(this.document.styleSheets)return Array.from(this.document.styleSheets).map(o=>this.reloadStylesheetImages(o,e,n))}reloadStylesheetImages(e,t,n){let o;try{o=(e||{}).cssRules}catch{}if(o)for(let i of Array.from(o))switch(i.type){case CSSRule.IMPORT_RULE:this.reloadStylesheetImages(i.styleSheet,t,n);break;case CSSRule.STYLE_RULE:for(let{styleNames:a}of rn)this.reloadStyleImages(i.style,a,t,n);break;case CSSRule.MEDIA_RULE:this.reloadStylesheetImages(i,t,n);break}}reloadStyleImages(e,t,n,o){for(let i of t){let a=e[i];if(typeof a=="string"){let s=a.replace(new RegExp("\\burl\\s*\\(([^)]*)\\)"),(c,l)=>nn(n,Kt(l))?`url(${this.generateCacheBustUrl(l,o)})`:c);s!==a&&(e[i]=s)}}}reloadStylesheet(e){let t=this.options||It,n,o,i=(()=>{let c=[];for(o of Array.from(this.document.getElementsByTagName("link")))o.rel.match(/^stylesheet$/i)&&!o.__LiveReload_pendingRemoval&&c.push(o);return c})(),a=[];for(n of Array.from(this.document.getElementsByTagName("style")))n.sheet&&this.collectImportedStylesheets(n,n.sheet,a);for(o of Array.from(i))this.collectImportedStylesheets(o,o.sheet,a);if(this.window.StyleFix&&this.document.querySelectorAll)for(n of Array.from(this.document.querySelectorAll("style[data-href]")))i.push(n);this.console.debug(`found ${i.length} LINKed stylesheets, ${a.length} @imported stylesheets`);let s=ei(e,i.concat(a),c=>Kt(this.linkHref(c)));if(s)s.object.rule?(this.console.debug(`is reloading imported stylesheet: ${s.object.href}`),this.reattachImportedRule(s.object)):(this.console.debug(`is reloading stylesheet: ${this.linkHref(s.object)}`),this.reattachStylesheetLink(s.object));else if(t.reloadMissingCSS){this.console.debug(`will reload all stylesheets because path '${e}' did not match any specific one. To disable this behavior, set 'options.reloadMissingCSS' to 'false'.`);for(o of Array.from(i))this.reattachStylesheetLink(o)}else this.console.debug(`will not reload path '${e}' because the stylesheet was not found on the page and 'options.reloadMissingCSS' was set to 'false'.`);return!0}collectImportedStylesheets(e,t,n){let o;try{o=(t||{}).cssRules}catch{}if(o&&o.length)for(let i=0;i{if(!o)return o=!0,t()};if(e.onload=()=>(this.console.debug("the new stylesheet has finished loading"),this.knownToSupportCssOnLoad=!0,i()),!this.knownToSupportCssOnLoad){let a;(a=()=>e.sheet?(this.console.debug("is polling until the new CSS finishes loading..."),i()):this.Timer.start(50,a))()}return this.Timer.start(n.stylesheetReloadTimeout,i)}linkHref(e){return e.href||e.getAttribute&&e.getAttribute("data-href")}reattachStylesheetLink(e){let t;if(e.__LiveReload_pendingRemoval)return;e.__LiveReload_pendingRemoval=!0,e.tagName==="STYLE"?(t=this.document.createElement("link"),t.rel="stylesheet",t.media=e.media,t.disabled=e.disabled):t=e.cloneNode(!1),t.href=this.generateCacheBustUrl(this.linkHref(e));let n=e.parentNode;return n.lastChild===e?n.appendChild(t):n.insertBefore(t,e.nextSibling),this.waitUntilCssLoads(t,()=>{let o;return/AppleWebKit/.test(this.window.navigator.userAgent)?o=5:o=200,this.Timer.start(o,()=>{if(e.parentNode)return e.parentNode.removeChild(e),t.onreadystatechange=null,this.window.StyleFix?this.window.StyleFix.link(t):void 0})})}reattachImportedRule({rule:e,index:t,link:n}){let o=e.parentStyleSheet,i=this.generateCacheBustUrl(e.href),a=e.media.length?[].join.call(e.media,", "):"",s=`@import url("${i}") ${a};`;e.__LiveReload_newHref=i;let c=this.document.createElement("link");return c.rel="stylesheet",c.href=i,c.__LiveReload_pendingRemoval=!0,n.parentNode&&n.parentNode.insertBefore(c,n),this.Timer.start(this.importCacheWaitPeriod,()=>{if(c.parentNode&&c.parentNode.removeChild(c),e.__LiveReload_newHref===i)return o.insertRule(s,t),o.deleteRule(t+1),e=o.cssRules[t],e.__LiveReload_newHref=i,this.Timer.start(this.importCacheWaitPeriod,()=>{if(e.__LiveReload_newHref===i)return o.insertRule(s,t),o.deleteRule(t+1)})})}generateUniqueString(){return`livereload=${Date.now()}`}generateCacheBustUrl(e,t){let n=this.options||It,o,i;if(t||(t=this.generateUniqueString()),{url:e,hash:o,params:i}=on(e),n.overrideURL&&e.indexOf(n.serverURL)<0){let s=e;e=n.serverURL+n.overrideURL+"?url="+encodeURIComponent(e),this.console.debug(`is overriding source URL ${s} with ${e}`)}let a=i.replace(/(\?|&)livereload=(\d+)/,(s,c)=>`${c}${t}`);return a===i&&(i.length===0?a=`?${t}`:a=`${i}&${t}`),e+a+o}};function on(r){let e="",t="",n=r.indexOf("#");n>=0&&(e=r.slice(n),r=r.slice(0,n));let o=r.indexOf("??");return o>=0?o+1!==r.lastIndexOf("?")&&(n=r.lastIndexOf("?")):n=r.indexOf("?"),n>=0&&(t=r.slice(n),r=r.slice(0,n)),{url:r,params:t,hash:e}}function Kt(r){if(!r)return"";let e;return{url:r}=on(r),r.indexOf("file://")===0?e=r.replace(new RegExp("^file://(localhost)?"),""):e=r.replace(new RegExp("^([^:]+:)?//([^:/]+)(:\\d*)?/"),"/"),decodeURIComponent(e)}function an(r,e){if(r=r.replace(/^\/+/,"").toLowerCase(),e=e.replace(/^\/+/,"").toLowerCase(),r===e)return 1e4;let t=r.split(/\/|\\/).reverse(),n=e.split(/\/|\\/).reverse(),o=Math.min(t.length,n.length),i=0;for(;in){let n,o={score:0};for(let i of e)n=an(r,t(i)),n>o.score&&(o={object:i,score:n});return o.score===0?null:o}function nn(r,e){return an(r,e)>0}var un=gn(cn());var ti=/\.(jpe?g|png|gif|svg)$/i;function Xt(r,e,t){switch(r.kind){case"FsMany":{if(r.payload.some(o=>{switch(o.kind){case"Fs":return!(o.payload.path.match(/\.css(?:\.map)?$/i)||o.payload.path.match(ti));case"FsMany":throw new Error("unreachable")}}))return window.__playwright?.record?window.__playwright?.record({kind:"reloadPage"}):t.reloadPage();for(let o of r.payload)Xt(o,e,t);break}case"Fs":{let n=r.payload.path,o={liveCSS:!0,liveImg:!0,reloadMissingCSS:!0,originalPath:"",overrideURL:"",serverURL:""};window.__playwright?.record?window.__playwright?.record({kind:"reload",args:{path:n,opts:o}}):(e.trace("will reload a file with path ",n),t.reload(n,o))}}}var Qt={name:"dom plugin",globalSetup:(r,e)=>{let t=new Rt(window,e,un.Timer);return[r,[e,t]]},resetSink(r,e,t){let[n,o]=e;return r.pipe(de(i=>i.kind==="Change"),K(i=>i.payload),Be(i=>{n.trace("incoming message",JSON.stringify({change:i,config:t},null,2));let a=jt.parse(i);Xt(a,n,o)}),Fe())}};var ri=Dr(),Ke=ri.create(),[ni,er]=zt.globalSetup(Ke,Mr),[oi,ii]=Qt.globalSetup(Ke,er),ln=Ke.pipe(de(r=>r.kind==="WsConnection"),K(r=>r.payload),Vt()),ai=Ke.pipe(de(r=>r.kind==="Config"),K(r=>r.payload)),fl=Ke.pipe(de(r=>r.kind==="Change"),K(r=>r.payload));wt(ai,ln).pipe(Ft(r=>{let e=[Qt.resetSink(oi,ii,r),zt.resetSink(ni,er,r)];return wt(...e)})).subscribe();ln.subscribe(r=>{er.info("\u{1F7E2} Browsersync Live connected",{config:r})}); diff --git a/tests/playground.spec.ts-snapshots/examples-markdown-playground-md-markdown-playground-1-chromium-darwin.txt b/tests/playground.spec.ts-snapshots/examples-markdown-playground-md-markdown-playground-1-chromium-darwin.txt index b1b5e38..be77013 100644 --- a/tests/playground.spec.ts-snapshots/examples-markdown-playground-md-markdown-playground-1-chromium-darwin.txt +++ b/tests/playground.spec.ts-snapshots/examples-markdown-playground-md-markdown-playground-1-chromium-darwin.txt @@ -2,14 +2,14 @@ Browsersync Live - Playground - +
Hello world!
- +