From 74103d25d6036fc3e2c7575f57775e31a7875c25 Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Tue, 27 Feb 2024 17:13:11 +0530 Subject: [PATCH 1/9] feat: header in http processor --- fastn-core/src/library2022/processor/http.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/fastn-core/src/library2022/processor/http.rs b/fastn-core/src/library2022/processor/http.rs index 489f9ff581..eec202aeaf 100644 --- a/fastn-core/src/library2022/processor/http.rs +++ b/fastn-core/src/library2022/processor/http.rs @@ -57,7 +57,7 @@ pub async fn process( } }; - let (mut url, conf) = + let (mut url, mut conf) = fastn_core::config::utils::get_clean_url(&req_config.config, url.as_str()).map_err( |e| ftd::interpreter::Error::ParseError { message: format!("invalid url: {:?}", e), @@ -84,16 +84,22 @@ pub async fn process( .get_value(header.line_number, value.as_str())? .to_json_string(doc, true)? { + if let Some(key) = header.key.strip_prefix("header-") { + conf.insert(key.to_string(), value); + continue; + } if method.as_str().eq("post") { body.push(format!("\"{}\": {}", header.key, value)); continue; } - url.query_pairs_mut().append_pair( - header.key.as_str(), - value.trim_start_matches('"').trim_end_matches('"'), - ); + url.query_pairs_mut() + .append_pair(header.key.as_str(), value.trim_matches('"')); } } else { + if let Some(key) = header.key.strip_prefix("header-") { + conf.insert(key.to_string(), value); + continue; + } if method.as_str().eq("post") { body.push(format!( "\"{}\": \"{}\"", From 25ed52a87d65fb6493f893b18c472d03e02f12ae Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Wed, 28 Feb 2024 00:45:26 +0530 Subject: [PATCH 2/9] use -key$ format --- fastn-core/src/http.rs | 11 +++++++++++ fastn-core/src/library2022/processor/http.rs | 4 ++-- ftd/src/ast/kind.rs | 4 +++- ftd/src/ast/utils.rs | 5 +++++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/fastn-core/src/http.rs b/fastn-core/src/http.rs index f246a7a4f6..de5640e9dd 100644 --- a/fastn-core/src/http.rs +++ b/fastn-core/src/http.rs @@ -1016,3 +1016,14 @@ mod test { Ok(()) } } + +static HEADER_KEY_PATTERN: once_cell::sync::Lazy = + once_cell::sync::Lazy::new(|| regex::Regex::new(r"\$header-(\w+)\$").unwrap()); + +pub(crate) fn match_header_key(header_key: &str) -> Option { + if let Some(captures) = HEADER_KEY_PATTERN.captures(header_key) { + return captures.get(1).map(|c| c.as_str().to_string()); + } + + None +} diff --git a/fastn-core/src/library2022/processor/http.rs b/fastn-core/src/library2022/processor/http.rs index eec202aeaf..a205c65b1e 100644 --- a/fastn-core/src/library2022/processor/http.rs +++ b/fastn-core/src/library2022/processor/http.rs @@ -84,7 +84,7 @@ pub async fn process( .get_value(header.line_number, value.as_str())? .to_json_string(doc, true)? { - if let Some(key) = header.key.strip_prefix("header-") { + if let Some(key) = fastn_core::http::match_header_key(header.key.as_str()) { conf.insert(key.to_string(), value); continue; } @@ -96,7 +96,7 @@ pub async fn process( .append_pair(header.key.as_str(), value.trim_matches('"')); } } else { - if let Some(key) = header.key.strip_prefix("header-") { + if let Some(key) = fastn_core::http::match_header_key(header.key.as_str()) { conf.insert(key.to_string(), value); continue; } diff --git a/ftd/src/ast/kind.rs b/ftd/src/ast/kind.rs index 0f36bffed8..96ee8d5a1b 100644 --- a/ftd/src/ast/kind.rs +++ b/ftd/src/ast/kind.rs @@ -622,7 +622,9 @@ impl VariableValue { }) .map(|header| { let key = header.get_key(); - let header_key = if ftd::ast::utils::is_variable_mutable(key.as_str()) { + let header_key = if ftd::ast::utils::is_variable_mutable(key.as_str()) + && !ftd::ast::utils::is_header_key(key.as_str()) + { key.trim_start_matches(ftd::ast::utils::REFERENCE) } else { key.as_str() diff --git a/ftd/src/ast/utils.rs b/ftd/src/ast/utils.rs index 591576e3b1..4f777a6e89 100644 --- a/ftd/src/ast/utils.rs +++ b/ftd/src/ast/utils.rs @@ -74,6 +74,10 @@ pub(crate) fn get_css_and_fields_from_headers( Ok((css, fields)) } +pub(crate) fn is_header_key(key: &str) -> bool { + key.starts_with(HEADER_KEY_START) && key.ends_with('$') +} + pub const REFERENCE: &str = "$"; pub const CLONE: &str = "*$"; pub const LOOP: &str = "$loop$"; @@ -82,3 +86,4 @@ pub const IN: &str = " in "; pub const IF: &str = "if"; pub const FOR: &str = "for"; pub const PROCESSOR: &str = "$processor$"; +pub const HEADER_KEY_START: &str = "$header-"; From d9b678c2db01fecb626dc6b12a0702d94b9d501a Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Wed, 28 Feb 2024 10:37:01 +0530 Subject: [PATCH 3/9] minor code refactor --- fastn-core/src/http.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fastn-core/src/http.rs b/fastn-core/src/http.rs index de5640e9dd..39bbbc3a2f 100644 --- a/fastn-core/src/http.rs +++ b/fastn-core/src/http.rs @@ -907,6 +907,17 @@ pub fn validation_error_to_user_err( fastn_core::http::user_err(converted_error, fastn_core::http::StatusCode::OK) } +static HEADER_KEY_PATTERN: once_cell::sync::Lazy = + once_cell::sync::Lazy::new(|| regex::Regex::new(r"\$header-(\w+)\$").unwrap()); + +pub(crate) fn match_header_key(header_key: &str) -> Option { + if let Some(captures) = HEADER_KEY_PATTERN.captures(header_key) { + return captures.get(1).map(|c| c.as_str().to_string()); + } + + None +} + #[cfg(test)] mod test { use actix_web::body::MessageBody; @@ -1016,14 +1027,3 @@ mod test { Ok(()) } } - -static HEADER_KEY_PATTERN: once_cell::sync::Lazy = - once_cell::sync::Lazy::new(|| regex::Regex::new(r"\$header-(\w+)\$").unwrap()); - -pub(crate) fn match_header_key(header_key: &str) -> Option { - if let Some(captures) = HEADER_KEY_PATTERN.captures(header_key) { - return captures.get(1).map(|c| c.as_str().to_string()); - } - - None -} From 4813125f48ae7b259a3bf88e96cedb9467beb7e1 Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Wed, 28 Feb 2024 11:40:13 +0530 Subject: [PATCH 4/9] replace regex with basic string manipulation --- fastn-core/src/http.rs | 11 +++++------ fastn-core/src/library2022/processor/http.rs | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/fastn-core/src/http.rs b/fastn-core/src/http.rs index 39bbbc3a2f..464664a480 100644 --- a/fastn-core/src/http.rs +++ b/fastn-core/src/http.rs @@ -907,12 +907,11 @@ pub fn validation_error_to_user_err( fastn_core::http::user_err(converted_error, fastn_core::http::StatusCode::OK) } -static HEADER_KEY_PATTERN: once_cell::sync::Lazy = - once_cell::sync::Lazy::new(|| regex::Regex::new(r"\$header-(\w+)\$").unwrap()); - -pub(crate) fn match_header_key(header_key: &str) -> Option { - if let Some(captures) = HEADER_KEY_PATTERN.captures(header_key) { - return captures.get(1).map(|c| c.as_str().to_string()); +pub(crate) fn get_header_key(header_key: &str) -> Option { + if let Some(remaining) = header_key.strip_prefix("$header-") { + if remaining.ends_with('$') { + return remaining.strip_suffix('$').map(|s| s.to_string()); + } } None diff --git a/fastn-core/src/library2022/processor/http.rs b/fastn-core/src/library2022/processor/http.rs index a205c65b1e..55eec44f51 100644 --- a/fastn-core/src/library2022/processor/http.rs +++ b/fastn-core/src/library2022/processor/http.rs @@ -84,7 +84,7 @@ pub async fn process( .get_value(header.line_number, value.as_str())? .to_json_string(doc, true)? { - if let Some(key) = fastn_core::http::match_header_key(header.key.as_str()) { + if let Some(key) = fastn_core::http::get_header_key(header.key.as_str()) { conf.insert(key.to_string(), value); continue; } @@ -96,7 +96,7 @@ pub async fn process( .append_pair(header.key.as_str(), value.trim_matches('"')); } } else { - if let Some(key) = fastn_core::http::match_header_key(header.key.as_str()) { + if let Some(key) = fastn_core::http::get_header_key(header.key.as_str()) { conf.insert(key.to_string(), value); continue; } From 135bfb56e4f044693fd5ab4629e18d015c59aaf5 Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Wed, 28 Feb 2024 11:46:49 +0530 Subject: [PATCH 5/9] minor changes --- fastn-core/src/http.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fastn-core/src/http.rs b/fastn-core/src/http.rs index 464664a480..2e95d8637d 100644 --- a/fastn-core/src/http.rs +++ b/fastn-core/src/http.rs @@ -909,9 +909,7 @@ pub fn validation_error_to_user_err( pub(crate) fn get_header_key(header_key: &str) -> Option { if let Some(remaining) = header_key.strip_prefix("$header-") { - if remaining.ends_with('$') { - return remaining.strip_suffix('$').map(|s| s.to_string()); - } + return remaining.strip_suffix('$').map(|s| s.to_string()); } None From 14d9f5220476512525a06b4d836178ca2e20cc2d Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Wed, 28 Feb 2024 11:59:53 +0530 Subject: [PATCH 6/9] minor changes --- fastn-core/src/library2022/processor/http.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastn-core/src/library2022/processor/http.rs b/fastn-core/src/library2022/processor/http.rs index 55eec44f51..e25f0f9e2c 100644 --- a/fastn-core/src/library2022/processor/http.rs +++ b/fastn-core/src/library2022/processor/http.rs @@ -85,7 +85,7 @@ pub async fn process( .to_json_string(doc, true)? { if let Some(key) = fastn_core::http::get_header_key(header.key.as_str()) { - conf.insert(key.to_string(), value); + conf.insert(key, value); continue; } if method.as_str().eq("post") { @@ -97,7 +97,7 @@ pub async fn process( } } else { if let Some(key) = fastn_core::http::get_header_key(header.key.as_str()) { - conf.insert(key.to_string(), value); + conf.insert(key, value); continue; } if method.as_str().eq("post") { From 4ed6422fbfb73b2ce4168d18306abada0be47758 Mon Sep 17 00:00:00 2001 From: Harsh Singh Date: Wed, 28 Feb 2024 12:38:30 +0530 Subject: [PATCH 7/9] added tests --- fastn-core/src/http.rs | 4 +- fastn-core/src/library2022/processor/http.rs | 4 +- .../tests/19-offline-build/output/index.html | 2 +- fastn-core/tests/22-http-headers/cmd.p1 | 12 + .../tests/22-http-headers/input/FASTN.ftd | 3 + .../tests/22-http-headers/input/index.ftd | 74 + .../tests/22-http-headers/output/FASTN.ftd | 3 + ...D46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css | 139 + ...0379A2DB3483A1F058CA29FBCFB3815CA76148.css | 172 + ...74F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css | 122 + ...6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css | 133 + ...4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css | 172 + ...3FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css | 172 + ...43E976EA9F41AD75268B2DD825C33C68B573A6.css | 428 ++ ...93E43A6135D910989ADD88CA3C0D6117EE24D7.css | 172 + ...32BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css | 168 + ...084DBF71BC5750C2C1357F0E7D936867AFAB62.css | 160 + ...5E65580DB580F1477931AADCB5118E4E69D1CD.css | 158 + ...72EE9053D04923BBC5D1BA52B574E78D8C536A.css | 207 + ...2ABE4BA14CEEA13CD23E157BF6A137762B8452.css | 205 + ...066C3706A6DF3579B14F41AF05564E41CAA09C.css | 172 + ...265387B814AE85A7D33666A4AE4BEFF59016D0.css | 318 + ...A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css | 317 + ...BC0BDF6AE447485C30B0389ADA7B49C069E46A.css | 172 + ...3CAE3B938D54E2813F0855312D2554DBE97BAD.css | 440 ++ ...1ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css | 134 + ...0E9C8E73F6345E49362B46E6F52CEE40471248.css | 140 + ...DBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css | 139 + ...1BB0511696A1EE8002C5088748DA0BAC0806E6.css | 210 + ...93D04881B17EA4699BA9C568C83D32A18B0173.css | 281 + ...5175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css | 194 + ...127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js | 6550 +++++++++++++++++ .../tests/22-http-headers/output/index.ftd | 74 + .../tests/22-http-headers/output/index.html | 474 ++ .../22-http-headers/output/manifest.json | 16 + ...88EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js | 7 + ...F239A103F0B0F93B69CD55CB5C6530501182EB.css | 61 + ...059F8F1870D613AD0C5B0B013D6205B72A62BAF.js | 84 + 38 files changed, 12288 insertions(+), 5 deletions(-) create mode 100644 fastn-core/tests/22-http-headers/cmd.p1 create mode 100644 fastn-core/tests/22-http-headers/input/FASTN.ftd create mode 100644 fastn-core/tests/22-http-headers/input/index.ftd create mode 100644 fastn-core/tests/22-http-headers/output/FASTN.ftd create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-06E6F84E43C61CB1653D9F4FACD46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-0800A18B1822D6AFDAF807CF840379A2DB3483A1F058CA29FBCFB3815CA76148.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-0CA636E4954E3FC6184FB8000174F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-0F444C6433C356376F7E92122F6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-256C21B515FC9E77F95D88689A4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-4DD8479BE14A755645BC09FF433FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-60E02531E77333F3F1B636C4FC43E976EA9F41AD75268B2DD825C33C68B573A6.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-6EB6F03F9F578742CA0CD1189693E43A6135D910989ADD88CA3C0D6117EE24D7.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-7852E516BA094B01897820BB3432BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-792C7BB9F4C8DFF3E0CBC354D2084DBF71BC5750C2C1357F0E7D936867AFAB62.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-88F91252A8A0EA125B4BA2C7B85E65580DB580F1477931AADCB5118E4E69D1CD.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-8C59190F5018F48CCBB063359072EE9053D04923BBC5D1BA52B574E78D8C536A.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-8CCA3D600F91FA55950DF3132F2ABE4BA14CEEA13CD23E157BF6A137762B8452.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-95B9118AFC8631777EEBBD89B2066C3706A6DF3579B14F41AF05564E41CAA09C.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-99CD7B013C96C4632F0AEA39AC265387B814AE85A7D33666A4AE4BEFF59016D0.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-9A3284FD117DFF7CFD432FF860A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-9A45313F167DBD90654BFD5BB3BC0BDF6AE447485C30B0389ADA7B49C069E46A.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-A24DC8F09D03756A62923E8A883CAE3B938D54E2813F0855312D2554DBE97BAD.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-A352AF572179AB980583D41BC41ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-B3AEA322EADEDA61F0E219845A0E9C8E73F6345E49362B46E6F52CEE40471248.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-B68AA27E05B319F04A9CD747AADBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-B8645DE281A38A3068C56919DE1BB0511696A1EE8002C5088748DA0BAC0806E6.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-DC76F700474E809F7BA2D9914793D04881B17EA4699BA9C568C83D32A18B0173.css create mode 100644 fastn-core/tests/22-http-headers/output/code-theme-F614177D3155EA8E915B35A3445175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css create mode 100644 fastn-core/tests/22-http-headers/output/default-B66C2B8914832538F78C67C1C127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js create mode 100644 fastn-core/tests/22-http-headers/output/index.ftd create mode 100644 fastn-core/tests/22-http-headers/output/index.html create mode 100644 fastn-core/tests/22-http-headers/output/manifest.json create mode 100644 fastn-core/tests/22-http-headers/output/markdown-24E09EFC0C2B9A11DEA9AC71888EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js create mode 100644 fastn-core/tests/22-http-headers/output/prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css create mode 100644 fastn-core/tests/22-http-headers/output/prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js diff --git a/fastn-core/src/http.rs b/fastn-core/src/http.rs index 2e95d8637d..495e9a4d35 100644 --- a/fastn-core/src/http.rs +++ b/fastn-core/src/http.rs @@ -907,9 +907,9 @@ pub fn validation_error_to_user_err( fastn_core::http::user_err(converted_error, fastn_core::http::StatusCode::OK) } -pub(crate) fn get_header_key(header_key: &str) -> Option { +pub(crate) fn get_header_key(header_key: &str) -> Option<&str> { if let Some(remaining) = header_key.strip_prefix("$header-") { - return remaining.strip_suffix('$').map(|s| s.to_string()); + return remaining.strip_suffix('$'); } None diff --git a/fastn-core/src/library2022/processor/http.rs b/fastn-core/src/library2022/processor/http.rs index e25f0f9e2c..16800b8307 100644 --- a/fastn-core/src/library2022/processor/http.rs +++ b/fastn-core/src/library2022/processor/http.rs @@ -85,7 +85,7 @@ pub async fn process( .to_json_string(doc, true)? { if let Some(key) = fastn_core::http::get_header_key(header.key.as_str()) { - conf.insert(key, value); + conf.insert(key.to_string(), value.trim_matches('"').to_string()); continue; } if method.as_str().eq("post") { @@ -97,7 +97,7 @@ pub async fn process( } } else { if let Some(key) = fastn_core::http::get_header_key(header.key.as_str()) { - conf.insert(key, value); + conf.insert(key.to_string(), value); continue; } if method.as_str().eq("post") { diff --git a/fastn-core/tests/19-offline-build/output/index.html b/fastn-core/tests/19-offline-build/output/index.html index f2b4ad74cd..9d98ef4f95 100644 --- a/fastn-core/tests/19-offline-build/output/index.html +++ b/fastn-core/tests/19-offline-build/output/index.html @@ -16,7 +16,7 @@ - + diff --git a/fastn-core/tests/22-http-headers/cmd.p1 b/fastn-core/tests/22-http-headers/cmd.p1 new file mode 100644 index 0000000000..f4b8f80116 --- /dev/null +++ b/fastn-core/tests/22-http-headers/cmd.p1 @@ -0,0 +1,12 @@ +-- fbt: +cmd: $FBT_CWD/../target/debug/fastn --test build +output: .build + +-- stdout: + +Updated package dependency. +Processing fastn-stack.github.io/http-headers-test/manifest.json ... done in +Processing fastn-stack.github.io/http-headers-test/FASTN/ ... done in +Processing fastn-stack.github.io/http-headers-test/ ... calling `http` processor with url: https://dummyjson.com/auth/login +calling `http` processor with url: https://dummyjson.com/auth/me +done in diff --git a/fastn-core/tests/22-http-headers/input/FASTN.ftd b/fastn-core/tests/22-http-headers/input/FASTN.ftd new file mode 100644 index 0000000000..a62ae8aa0e --- /dev/null +++ b/fastn-core/tests/22-http-headers/input/FASTN.ftd @@ -0,0 +1,3 @@ +-- import: fastn + +-- fastn.package: fastn-stack.github.io/http-headers-test diff --git a/fastn-core/tests/22-http-headers/input/index.ftd b/fastn-core/tests/22-http-headers/input/index.ftd new file mode 100644 index 0000000000..a28d9716c0 --- /dev/null +++ b/fastn-core/tests/22-http-headers/input/index.ftd @@ -0,0 +1,74 @@ +-- import: fastn/processors as pr + +-- record auth-response: +string token: + +-- record user-response: +integer id: +string username: +string email: +string firstName: +string lastName: + + + +-- auth-response auth-res: +$processor$: pr.http +method: post +url: https://dummyjson.com/auth/login +username: kminchelle +password: 0lelplR +$header-content-type$: application/json + + + +-- string bearer-token: $join(a = Bearer, b = *$auth-res.token) + + + +-- user-response user-res: +$processor$: pr.http +method: get +url: https://dummyjson.com/auth/me +$header-authorization$: $bearer-token + + + +-- display-user: $user-res + + + +-- string join(a, b): +string a: +string b: + +a + " " + b + + + +-- component display-user: +caption user-res user: + +-- ftd.column: + +-- ftd.row: +spacing.fixed.rem: 1 + +-- ftd.text: Username: + +-- ftd.text: $user-res.username + +-- end: ftd.row + +-- ftd.row: +spacing.fixed.rem: 1 + +-- ftd.text: Email: + +-- ftd.text: $user-res.email + +-- end: ftd.row + +-- end: ftd.column + +-- end: display-user diff --git a/fastn-core/tests/22-http-headers/output/FASTN.ftd b/fastn-core/tests/22-http-headers/output/FASTN.ftd new file mode 100644 index 0000000000..a62ae8aa0e --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/FASTN.ftd @@ -0,0 +1,3 @@ +-- import: fastn + +-- fastn.package: fastn-stack.github.io/http-headers-test diff --git a/fastn-core/tests/22-http-headers/output/code-theme-06E6F84E43C61CB1653D9F4FACD46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css b/fastn-core/tests/22-http-headers/output/code-theme-06E6F84E43C61CB1653D9F4FACD46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css new file mode 100644 index 0000000000..4a32152b08 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-06E6F84E43C61CB1653D9F4FACD46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css @@ -0,0 +1,139 @@ +/** + * Gruvbox light theme + * + * Based on Gruvbox: https://github.com/morhetz/gruvbox + * Adapted from PrismJS gruvbox-dark theme: https://github.com/schnerring/prism-themes/blob/master/themes/prism-gruvbox-dark.css + * + * @author Michael Schnerring (https://schnerring.net) + * @version 1.0 + */ + +code[class*="language-"].gruvbox-theme-light, +pre[class*="language-"].gruvbox-theme-light { + color: #3c3836; /* fg1 / fg */ + font-family: Consolas, Monaco, "Andale Mono", monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"].gruvbox-theme-light::-moz-selection, +pre[class*="language-"].gruvbox-theme-light ::-moz-selection, +code[class*="language-"].gruvbox-theme-light::-moz-selection, +code[class*="language-"].gruvbox-theme-light ::-moz-selection { + color: #282828; /* fg0 */ + background: #a89984; /* bg4 */ +} + +pre[class*="language-"].gruvbox-theme-light::selection, +pre[class*="language-"].gruvbox-theme-light ::selection, +code[class*="language-"].gruvbox-theme-light::selection, +code[class*="language-"].gruvbox-theme-light ::selection { + color: #282828; /* fg0 */ + background: #a89984; /* bg4 */ +} + +/* Code blocks */ +pre[class*="language-"].gruvbox-theme-light { + padding: 1em; + margin: 0.5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"].gruvbox-theme-light, +pre[class*="language-"].gruvbox-theme-light { + background: #f9f5d7; /* bg0_h */ +} + +/* Inline code */ +:not(pre) > code[class*="language-"].gruvbox-theme-light { + padding: 0.1em; + border-radius: 0.3em; +} + +.gruvbox-theme-light .token.comment, +.gruvbox-theme-light .token.prolog, +.gruvbox-theme-light .token.cdata { + color: #7c6f64; /* fg4 / gray1 */ +} + +.gruvbox-theme-light .token.delimiter, +.gruvbox-theme-light .token.boolean, +.gruvbox-theme-light .token.keyword, +.gruvbox-theme-light .token.selector, +.gruvbox-theme-light .token.important, +.gruvbox-theme-light .token.atrule { + color: #9d0006; /* red2 */ +} + +.gruvbox-theme-light .token.operator, +.gruvbox-theme-light .token.punctuation, +.gruvbox-theme-light .token.attr-name { + color: #7c6f64; /* fg4 / gray1 */ +} + +.gruvbox-theme-light .token.tag, +.gruvbox-theme-light .token.tag .punctuation, +.gruvbox-theme-light .token.doctype, +.gruvbox-theme-light .token.builtin { + color: #b57614; /* yellow2 */ +} + +.gruvbox-theme-light .token.entity, +.gruvbox-theme-light .token.number, +.gruvbox-theme-light .token.symbol { + color: #8f3f71; /* purple2 */ +} + +.gruvbox-theme-light .token.property, +.gruvbox-theme-light .token.constant, +.gruvbox-theme-light .token.variable { + color: #9d0006; /* red2 */ +} + +.gruvbox-theme-light .token.string, +.gruvbox-theme-light .token.char { + color: #797403; /* green2 */ +} + +.gruvbox-theme-light .token.attr-value, +.gruvbox-theme-light .token.attr-value .punctuation { + color: #7c6f64; /* fg4 / gray1 */ +} + +.gruvbox-theme-light .token.url { + color: #797403; /* green2 */ + text-decoration: underline; +} + +.gruvbox-theme-light .token.function { + color: #b57614; /* yellow2 */ +} + +.gruvbox-theme-light .token.bold { + font-weight: bold; +} + +.gruvbox-theme-light .token.italic { + font-style: italic; +} + +.gruvbox-theme-light .token.inserted { + background: #7c6f64; /* fg4 / gray1 */ +} + +.gruvbox-theme-light .token.deleted { + background: #9d0006; /* red2 */ +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-0800A18B1822D6AFDAF807CF840379A2DB3483A1F058CA29FBCFB3815CA76148.css b/fastn-core/tests/22-http-headers/output/code-theme-0800A18B1822D6AFDAF807CF840379A2DB3483A1F058CA29FBCFB3815CA76148.css new file mode 100644 index 0000000000..63ab0878b3 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-0800A18B1822D6AFDAF807CF840379A2DB3483A1F058CA29FBCFB3815CA76148.css @@ -0,0 +1,172 @@ +/* +Name: Duotone Light +Author: Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) + +Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-morning-light.css) +Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) +*/ + +code[class*="language-"].duotone-theme-light, +pre[class*="language-"].duotone-theme-light { + font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; + font-size: 14px; + line-height: 1.375; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + background: #faf8f5; + color: #728fcb; +} + +pre > code[class*="language-"].duotone-theme-light { + font-size: 1em; +} + +pre[class*="language-"].duotone-theme-light::-moz-selection, pre[class*="language-"].duotone-theme-light ::-moz-selection, +code[class*="language-"].duotone-theme-light::-moz-selection, code[class*="language-"].duotone-theme-light ::-moz-selection { + text-shadow: none; + background: #faf8f5; +} + +pre[class*="language-"].duotone-theme-light::selection, pre[class*="language-"].duotone-theme-light ::selection, +code[class*="language-"].duotone-theme-light::selection, code[class*="language-"].duotone-theme-light ::selection { + text-shadow: none; + background: #faf8f5; +} + +/* Code blocks */ +pre[class*="language-"].duotone-theme-light { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].duotone-theme-light { + padding: .1em; + border-radius: .3em; +} + +.duotone-theme-light .token.comment, +.duotone-theme-light .token.prolog, +.duotone-theme-light .token.doctype, +.duotone-theme-light .token.cdata { + color: #b6ad9a; +} + +.duotone-theme-light .token.punctuation { + color: #b6ad9a; +} + +.duotone-theme-light .token.namespace { + opacity: .7; +} + +.duotone-theme-light .token.tag, +.duotone-theme-light .token.operator, +.duotone-theme-light .token.number { + color: #063289; +} + +.duotone-theme-light .token.property, +.duotone-theme-light .token.function { + color: #b29762; +} + +.duotone-theme-light .token.tag-id, +.duotone-theme-light .token.selector, +.duotone-theme-light .token.atrule-id { + color: #2d2006; +} + +code.language-javascript, +.duotone-theme-light .token.attr-name { + color: #896724; +} + +code.language-css, +code.language-scss, +.duotone-theme-light .token.boolean, +.duotone-theme-light .token.string, +.duotone-theme-light .token.entity, +.duotone-theme-light .token.url, +.language-css .duotone-theme-light .token.string, +.language-scss .duotone-theme-light .token.string, +.style .duotone-theme-light .token.string, +.duotone-theme-light .token.attr-value, +.duotone-theme-light .token.keyword, +.duotone-theme-light .token.control, +.duotone-theme-light .token.directive, +.duotone-theme-light .token.unit, +.duotone-theme-light .token.statement, +.duotone-theme-light .token.regex, +.duotone-theme-light .token.atrule { + color: #728fcb; +} + +.duotone-theme-light .token.placeholder, +.duotone-theme-light .token.variable { + color: #93abdc; +} + +.duotone-theme-light .token.deleted { + text-decoration: line-through; +} + +.duotone-theme-light .token.inserted { + border-bottom: 1px dotted #2d2006; + text-decoration: none; +} + +.duotone-theme-light .token.italic { + font-style: italic; +} + +.duotone-theme-light .token.important, +.duotone-theme-light .token.bold { + font-weight: bold; +} + +.duotone-theme-light .token.important { + color: #896724; +} + +.duotone-theme-light .token.entity { + cursor: help; +} + +pre > code.highlight { + outline: .4em solid #896724; + outline-offset: .4em; +} + +/* overrides color-values for the Line Numbers plugin + * http://prismjs.com/plugins/line-numbers/ + */ +.line-numbers.line-numbers .line-numbers-rows { + border-right-color: #ece8de; +} + +.line-numbers .line-numbers-rows > span:before { + color: #cdc4b1; +} + +/* overrides color-values for the Line Highlight plugin + * http://prismjs.com/plugins/line-highlight/ + */ +.line-highlight.line-highlight { + background: rgba(45, 32, 6, 0.2); + background: -webkit-linear-gradient(left, rgba(45, 32, 6, 0.2) 70%, rgba(45, 32, 6, 0)); + background: linear-gradient(to right, rgba(45, 32, 6, 0.2) 70%, rgba(45, 32, 6, 0)); +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-0CA636E4954E3FC6184FB8000174F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css b/fastn-core/tests/22-http-headers/output/code-theme-0CA636E4954E3FC6184FB8000174F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css new file mode 100644 index 0000000000..06a53a01e6 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-0CA636E4954E3FC6184FB8000174F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css @@ -0,0 +1,122 @@ +/** + * Dracula Theme originally by Zeno Rocha [@zenorocha] + * https://draculatheme.com/ + * + * Ported for PrismJS by Albert Vallverdu [@byverdu] + */ + +code[class*="language-"].dracula-theme, +pre[class*="language-"].dracula-theme { + color: #f8f8f2; + background: none; + text-shadow: 0 1px rgba(0, 0, 0, 0.3); + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +/* Code blocks */ +pre[class*="language-"].dracula-theme { + padding: 1em; + margin: .5em 0; + overflow: auto; + border-radius: 0.3em; +} + +:not(pre) > code[class*="language-"].dracula-theme, +pre[class*="language-"].dracula-theme { + background: #282a36; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].dracula-theme { + padding: .1em; + border-radius: .3em; + white-space: normal; +} + +.dracula-theme .token.comment, +.dracula-theme .token.prolog, +.dracula-theme .token.doctype, +.dracula-theme .token.cdata { + color: #6272a4; +} + +.dracula-theme .token.punctuation { + color: #f8f8f2; +} + +.namespace { + opacity: .7; +} + +.dracula-theme .token.property, +.dracula-theme .token.tag, +.dracula-theme .token.constant, +.dracula-theme .token.symbol, +.dracula-theme .token.deleted { + color: #ff79c6; +} + +.dracula-theme .token.boolean, +.dracula-theme .token.number { + color: #bd93f9; +} + +.dracula-theme .token.selector, +.dracula-theme .token.attr-name, +.dracula-theme .token.string, +.dracula-theme .token.char, +.dracula-theme .token.builtin, +.dracula-theme .token.inserted { + color: #50fa7b; +} + +.dracula-theme .token.operator, +.dracula-theme .token.entity, +.dracula-theme .token.url, +.language-css .dracula-theme .token.string, +.style .dracula-theme .token.string, +.dracula-theme .token.variable { + color: #f8f8f2; +} + +.dracula-theme .token.atrule, +.dracula-theme .token.attr-value, +.dracula-theme .token.function, +.dracula-theme .token.class-name { + color: #f1fa8c; +} + +.dracula-theme .token.keyword { + color: #8be9fd; +} + +.dracula-theme .token.regex, +.dracula-theme .token.important { + color: #ffb86c; +} + +.dracula-theme .token.important, +.dracula-theme .token.bold { + font-weight: bold; +} + +.dracula-theme .token.italic { + font-style: italic; +} + +.dracula-theme .token.entity { + cursor: help; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-0F444C6433C356376F7E92122F6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css b/fastn-core/tests/22-http-headers/output/code-theme-0F444C6433C356376F7E92122F6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css new file mode 100644 index 0000000000..b0b38cbdd7 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-0F444C6433C356376F7E92122F6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css @@ -0,0 +1,133 @@ +/* + * Laserwave Theme originally by Jared Jones for Visual Studio Code + * https://github.com/Jaredk3nt/laserwave + * + * Ported for PrismJS by Simon Jespersen [https://github.com/simjes] + */ + +code[class*="language-"].laserwave-theme, +pre[class*="language-"].laserwave-theme { + background: #27212e; + color: #ffffff; + font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; /* this is the default */ + /* The following properties are standard, please leave them as they are */ + font-size: 1em; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; + /* The following properties are also standard */ + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +code[class*="language-"].laserwave-theme::-moz-selection, +code[class*="language-"].laserwave-theme ::-moz-selection, +pre[class*="language-"].laserwave-theme::-moz-selection, +pre[class*="language-"].laserwave-theme ::-moz-selection { + background: #eb64b927; + color: inherit; +} + +code[class*="language-"].laserwave-theme::selection, +code[class*="language-"].laserwave-theme ::selection, +pre[class*="language-"].laserwave-theme::selection, +pre[class*="language-"].laserwave-theme ::selection { + background: #eb64b927; + color: inherit; +} + +/* Properties specific to code blocks */ +pre[class*="language-"].laserwave-theme { + padding: 1em; /* this is standard */ + margin: 0.5em 0; /* this is the default */ + overflow: auto; /* this is standard */ + border-radius: 0.5em; +} + +/* Properties specific to inline code */ +:not(pre) > code[class*="language-"].laserwave-theme { + padding: 0.2em 0.3em; + border-radius: 0.5rem; + white-space: normal; /* this is standard */ +} + +.laserwave-theme .token.comment, +.laserwave-theme .token.prolog, +.laserwave-theme .token.cdata { + color: #91889b; +} + +.laserwave-theme .token.punctuation { + color: #7b6995; +} + +.laserwave-theme .token.builtin, +.laserwave-theme .token.constant, +.laserwave-theme .token.boolean { + color: #ffe261; +} + +.laserwave-theme .token.number { + color: #b381c5; +} + +.laserwave-theme .token.important, +.laserwave-theme .token.atrule, +.laserwave-theme .token.property, +.laserwave-theme .token.keyword { + color: #40b4c4; +} + +.laserwave-theme .token.doctype, +.laserwave-theme .token.operator, +.laserwave-theme .token.inserted, +.laserwave-theme .token.tag, +.laserwave-theme .token.class-name, +.laserwave-theme .token.symbol { + color: #74dfc4; +} + +.laserwave-theme .token.attr-name, +.laserwave-theme .token.function, +.laserwave-theme .token.deleted, +.laserwave-theme .token.selector { + color: #eb64b9; +} + +.laserwave-theme .token.attr-value, +.laserwave-theme .token.regex, +.laserwave-theme .token.char, +.laserwave-theme .token.string { + color: #b4dce7; +} + +.laserwave-theme .token.entity, +.laserwave-theme .token.url, +.laserwave-theme .token.variable { + color: #ffffff; +} + +/* The following rules are pretty similar across themes, but feel free to adjust them */ +.laserwave-theme .token.bold { + font-weight: bold; +} + +.laserwave-theme .token.italic { + font-style: italic; +} + +.laserwave-theme .token.entity { + cursor: help; +} + +.laserwave-theme .token.namespace { + opacity: 0.7; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-256C21B515FC9E77F95D88689A4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css b/fastn-core/tests/22-http-headers/output/code-theme-256C21B515FC9E77F95D88689A4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css new file mode 100644 index 0000000000..1c8b8fe6d3 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-256C21B515FC9E77F95D88689A4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css @@ -0,0 +1,172 @@ +/* +Name: Duotone Forest +Author: by Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) + +Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-forest-dark.css) +Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) +*/ + +code[class*="language-"].duotone-theme-forest, +pre[class*="language-"].duotone-theme-forest { + font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; + font-size: 14px; + line-height: 1.375; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + background: #2a2d2a; + color: #687d68; +} + +pre > code[class*="language-"].duotone-theme-forest { + font-size: 1em; +} + +pre[class*="language-"].duotone-theme-forest::-moz-selection, pre[class*="language-"].duotone-theme-forest ::-moz-selection, +code[class*="language-"].duotone-theme-forest::-moz-selection, code[class*="language-"].duotone-theme-forest ::-moz-selection { + text-shadow: none; + background: #435643; +} + +pre[class*="language-"].duotone-theme-forest::selection, pre[class*="language-"].duotone-theme-forest ::selection, +code[class*="language-"].duotone-theme-forest::selection, code[class*="language-"].duotone-theme-forest ::selection { + text-shadow: none; + background: #435643; +} + +/* Code blocks */ +pre[class*="language-"].duotone-theme-forest { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].duotone-theme-forest { + padding: .1em; + border-radius: .3em; +} + +.duotone-theme-forest .token.comment, +.duotone-theme-forest .token.prolog, +.duotone-theme-forest .token.doctype, +.duotone-theme-forest .token.cdata { + color: #535f53; +} + +.duotone-theme-forest .token.punctuation { + color: #535f53; +} + +.duotone-theme-forest .token.namespace { + opacity: .7; +} + +.duotone-theme-forest .token.tag, +.duotone-theme-forest .token.operator, +.duotone-theme-forest .token.number { + color: #a2b34d; +} + +.duotone-theme-forest .token.property, +.duotone-theme-forest .token.function { + color: #687d68; +} + +.duotone-theme-forest .token.tag-id, +.duotone-theme-forest .token.selector, +.duotone-theme-forest .token.atrule-id { + color: #f0fff0; +} + +code.language-javascript, +.duotone-theme-forest .token.attr-name { + color: #b3d6b3; +} + +code.language-css, +code.language-scss, +.duotone-theme-forest .token.boolean, +.duotone-theme-forest .token.string, +.duotone-theme-forest .token.entity, +.duotone-theme-forest .token.url, +.language-css .duotone-theme-forest .token.string, +.language-scss .duotone-theme-forest .token.string, +.style .duotone-theme-forest .token.string, +.duotone-theme-forest .token.attr-value, +.duotone-theme-forest .token.keyword, +.duotone-theme-forest .token.control, +.duotone-theme-forest .token.directive, +.duotone-theme-forest .token.unit, +.duotone-theme-forest .token.statement, +.duotone-theme-forest .token.regex, +.duotone-theme-forest .token.atrule { + color: #e5fb79; +} + +.duotone-theme-forest .token.placeholder, +.duotone-theme-forest .token.variable { + color: #e5fb79; +} + +.duotone-theme-forest .token.deleted { + text-decoration: line-through; +} + +.duotone-theme-forest .token.inserted { + border-bottom: 1px dotted #f0fff0; + text-decoration: none; +} + +.duotone-theme-forest .token.italic { + font-style: italic; +} + +.duotone-theme-forest .token.important, +.duotone-theme-forest .token.bold { + font-weight: bold; +} + +.duotone-theme-forest .token.important { + color: #b3d6b3; +} + +.duotone-theme-forest .token.entity { + cursor: help; +} + +pre > code.highlight { + outline: .4em solid #5c705c; + outline-offset: .4em; +} + +/* overrides color-values for the Line Numbers plugin + * http://prismjs.com/plugins/line-numbers/ + */ +.line-numbers.line-numbers .line-numbers-rows { + border-right-color: #2c302c; +} + +.line-numbers .line-numbers-rows > span:before { + color: #3b423b; +} + +/* overrides color-values for the Line Highlight plugin +* http://prismjs.com/plugins/line-highlight/ +*/ +.line-highlight.line-highlight { + background: rgba(162, 179, 77, 0.2); + background: -webkit-linear-gradient(left, rgba(162, 179, 77, 0.2) 70%, rgba(162, 179, 77, 0)); + background: linear-gradient(to right, rgba(162, 179, 77, 0.2) 70%, rgba(162, 179, 77, 0)); +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-4DD8479BE14A755645BC09FF433FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css b/fastn-core/tests/22-http-headers/output/code-theme-4DD8479BE14A755645BC09FF433FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css new file mode 100644 index 0000000000..e1095a1fcd --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-4DD8479BE14A755645BC09FF433FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css @@ -0,0 +1,172 @@ +/* +Name: Duotone Space +Author: Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) + +Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-space-dark.css) +Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) +*/ + +code[class*="language-"].duotone-theme-space, +pre[class*="language-"].duotone-theme-space { + font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; + font-size: 14px; + line-height: 1.375; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + background: #24242e; + color: #767693; +} + +pre > code[class*="language-"].duotone-theme-space { + font-size: 1em; +} + +pre[class*="language-"].duotone-theme-space::-moz-selection, pre[class*="language-"].duotone-theme-space ::-moz-selection, +code[class*="language-"].duotone-theme-space::-moz-selection, code[class*="language-"].duotone-theme-space ::-moz-selection { + text-shadow: none; + background: #5151e6; +} + +pre[class*="language-"].duotone-theme-space::selection, pre[class*="language-"].duotone-theme-space ::selection, +code[class*="language-"].duotone-theme-space::selection, code[class*="language-"].duotone-theme-space ::selection { + text-shadow: none; + background: #5151e6; +} + +/* Code blocks */ +pre[class*="language-"].duotone-theme-space { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].duotone-theme-space { + padding: .1em; + border-radius: .3em; +} + +.duotone-theme-space .token.comment, +.duotone-theme-space .token.prolog, +.duotone-theme-space .token.doctype, +.duotone-theme-space .token.cdata { + color: #5b5b76; +} + +.duotone-theme-space .token.punctuation { + color: #5b5b76; +} + +.duotone-theme-space .token.namespace { + opacity: .7; +} + +.duotone-theme-space .token.tag, +.duotone-theme-space .token.operator, +.duotone-theme-space .token.number { + color: #dd672c; +} + +.duotone-theme-space .token.property, +.duotone-theme-space .token.function { + color: #767693; +} + +.duotone-theme-space .token.tag-id, +.duotone-theme-space .token.selector, +.duotone-theme-space .token.atrule-id { + color: #ebebff; +} + +code.language-javascript, +.duotone-theme-space .token.attr-name { + color: #aaaaca; +} + +code.language-css, +code.language-scss, +.duotone-theme-space .token.boolean, +.duotone-theme-space .token.string, +.duotone-theme-space .token.entity, +.duotone-theme-space .token.url, +.language-css .duotone-theme-space .token.string, +.language-scss .duotone-theme-space .token.string, +.style .duotone-theme-space .token.string, +.duotone-theme-space .token.attr-value, +.duotone-theme-space .token.keyword, +.duotone-theme-space .token.control, +.duotone-theme-space .token.directive, +.duotone-theme-space .token.unit, +.duotone-theme-space .token.statement, +.duotone-theme-space .token.regex, +.duotone-theme-space .token.atrule { + color: #fe8c52; +} + +.duotone-theme-space .token.placeholder, +.duotone-theme-space .token.variable { + color: #fe8c52; +} + +.duotone-theme-space .token.deleted { + text-decoration: line-through; +} + +.duotone-theme-space .token.inserted { + border-bottom: 1px dotted #ebebff; + text-decoration: none; +} + +.duotone-theme-space .token.italic { + font-style: italic; +} + +.duotone-theme-space .token.important, +.duotone-theme-space .token.bold { + font-weight: bold; +} + +.duotone-theme-space .token.important { + color: #aaaaca; +} + +.duotone-theme-space .token.entity { + cursor: help; +} + +pre > code.highlight { + outline: .4em solid #7676f4; + outline-offset: .4em; +} + +/* overrides color-values for the Line Numbers plugin + * http://prismjs.com/plugins/line-numbers/ + */ +.line-numbers.line-numbers .line-numbers-rows { + border-right-color: #262631; +} + +.line-numbers .line-numbers-rows > span:before { + color: #393949; +} + +/* overrides color-values for the Line Highlight plugin +* http://prismjs.com/plugins/line-highlight/ +*/ +.line-highlight.line-highlight { + background: rgba(221, 103, 44, 0.2); + background: -webkit-linear-gradient(left, rgba(221, 103, 44, 0.2) 70%, rgba(221, 103, 44, 0)); + background: linear-gradient(to right, rgba(221, 103, 44, 0.2) 70%, rgba(221, 103, 44, 0)); +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-60E02531E77333F3F1B636C4FC43E976EA9F41AD75268B2DD825C33C68B573A6.css b/fastn-core/tests/22-http-headers/output/code-theme-60E02531E77333F3F1B636C4FC43E976EA9F41AD75268B2DD825C33C68B573A6.css new file mode 100644 index 0000000000..0353aa3fbe --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-60E02531E77333F3F1B636C4FC43E976EA9F41AD75268B2DD825C33C68B573A6.css @@ -0,0 +1,428 @@ +/** + * One Light theme for prism.js + * Based on Atom's One Light theme: https://github.com/atom/atom/tree/master/packages/one-light-syntax + */ + +/** + * One Light colours (accurate as of commit eb064bf on 19 Feb 2021) + * From colors.less + * --mono-1: hsl(230, 8%, 24%); + * --mono-2: hsl(230, 6%, 44%); + * --mono-3: hsl(230, 4%, 64%) + * --hue-1: hsl(198, 99%, 37%); + * --hue-2: hsl(221, 87%, 60%); + * --hue-3: hsl(301, 63%, 40%); + * --hue-4: hsl(119, 34%, 47%); + * --hue-5: hsl(5, 74%, 59%); + * --hue-5-2: hsl(344, 84%, 43%); + * --hue-6: hsl(35, 99%, 36%); + * --hue-6-2: hsl(35, 99%, 40%); + * --syntax-fg: hsl(230, 8%, 24%); + * --syntax-bg: hsl(230, 1%, 98%); + * --syntax-gutter: hsl(230, 1%, 62%); + * --syntax-guide: hsla(230, 8%, 24%, 0.2); + * --syntax-accent: hsl(230, 100%, 66%); + * From syntax-variables.less + * --syntax-selection-color: hsl(230, 1%, 90%); + * --syntax-gutter-background-color-selected: hsl(230, 1%, 90%); + * --syntax-cursor-line: hsla(230, 8%, 24%, 0.05); + */ + +code[class*="language-"].one-theme-light, +pre[class*="language-"].one-theme-light { + background: hsl(230, 1%, 98%); + color: hsl(230, 8%, 24%); + font-family: "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +/* Selection */ +code[class*="language-"].one-theme-light::-moz-selection, +code[class*="language-"].one-theme-light *::-moz-selection, +pre[class*="language-"].one-theme-light *::-moz-selection { + background: hsl(230, 1%, 90%); + color: inherit; +} + +code[class*="language-"].one-theme-light::selection, +code[class*="language-"].one-theme-light *::selection, +pre[class*="language-"].one-theme-light *::selection { + background: hsl(230, 1%, 90%); + color: inherit; +} + +/* Code blocks */ +pre[class*="language-"].one-theme-light { + padding: 1em; + margin: 0.5em 0; + overflow: auto; + border-radius: 0.3em; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].one-theme-light { + padding: 0.2em 0.3em; + border-radius: 0.3em; + white-space: normal; +} + +.one-theme-light .token.comment, +.one-theme-light .token.prolog, +.one-theme-light .token.cdata { + color: hsl(230, 4%, 64%); +} + +.one-theme-light .token.doctype, +.one-theme-light .token.punctuation, +.one-theme-light .token.entity { + color: hsl(230, 8%, 24%); +} + +.one-theme-light .token.attr-name, +.one-theme-light .token.class-name, +.one-theme-light .token.boolean, +.one-theme-light .token.constant, +.one-theme-light .token.number, +.one-theme-light .token.atrule { + color: hsl(35, 99%, 36%); +} + +.one-theme-light .token.keyword { + color: hsl(301, 63%, 40%); +} + +.one-theme-light .token.property, +.one-theme-light .token.tag, +.one-theme-light .token.symbol, +.one-theme-light .token.deleted, +.one-theme-light .token.important { + color: hsl(5, 74%, 59%); +} + +.one-theme-light .token.selector, +.one-theme-light .token.string, +.one-theme-light .token.char, +.one-theme-light .token.builtin, +.one-theme-light .token.inserted, +.one-theme-light .token.regex, +.one-theme-light .token.attr-value, +.one-theme-light .token.attr-value > .one-theme-light .token.punctuation { + color: hsl(119, 34%, 47%); +} + +.one-theme-light .token.variable, +.one-theme-light .token.operator, +.one-theme-light .token.function { + color: hsl(221, 87%, 60%); +} + +.one-theme-light .token.url { + color: hsl(198, 99%, 37%); +} + +/* HTML overrides */ +.one-theme-light .token.attr-value > .one-theme-light .token.punctuation.attr-equals, +.one-theme-light .token.special-attr > .one-theme-light .token.attr-value > .one-theme-light .token.value.css { + color: hsl(230, 8%, 24%); +} + +/* CSS overrides */ +.language-css .one-theme-light .token.selector { + color: hsl(5, 74%, 59%); +} + +.language-css .one-theme-light .token.property { + color: hsl(230, 8%, 24%); +} + +.language-css .one-theme-light .token.function, +.language-css .one-theme-light .token.url > .one-theme-light .token.function { + color: hsl(198, 99%, 37%); +} + +.language-css .one-theme-light .token.url > .one-theme-light .token.string.url { + color: hsl(119, 34%, 47%); +} + +.language-css .one-theme-light .token.important, +.language-css .one-theme-light .token.atrule .one-theme-light .token.rule { + color: hsl(301, 63%, 40%); +} + +/* JS overrides */ +.language-javascript .one-theme-light .token.operator { + color: hsl(301, 63%, 40%); +} + +.language-javascript .one-theme-light .token.template-string > .one-theme-light .token.interpolation > .one-theme-light .token.interpolation-punctuation.punctuation { + color: hsl(344, 84%, 43%); +} + +/* JSON overrides */ +.language-json .one-theme-light .token.operator { + color: hsl(230, 8%, 24%); +} + +.language-json .one-theme-light .token.null.keyword { + color: hsl(35, 99%, 36%); +} + +/* MD overrides */ +.language-markdown .one-theme-light .token.url, +.language-markdown .one-theme-light .token.url > .one-theme-light .token.operator, +.language-markdown .one-theme-light .token.url-reference.url > .one-theme-light .token.string { + color: hsl(230, 8%, 24%); +} + +.language-markdown .one-theme-light .token.url > .one-theme-light .token.content { + color: hsl(221, 87%, 60%); +} + +.language-markdown .one-theme-light .token.url > .one-theme-light .token.url, +.language-markdown .one-theme-light .token.url-reference.url { + color: hsl(198, 99%, 37%); +} + +.language-markdown .one-theme-light .token.blockquote.punctuation, +.language-markdown .one-theme-light .token.hr.punctuation { + color: hsl(230, 4%, 64%); + font-style: italic; +} + +.language-markdown .one-theme-light .token.code-snippet { + color: hsl(119, 34%, 47%); +} + +.language-markdown .one-theme-light .token.bold .one-theme-light .token.content { + color: hsl(35, 99%, 36%); +} + +.language-markdown .one-theme-light .token.italic .one-theme-light .token.content { + color: hsl(301, 63%, 40%); +} + +.language-markdown .one-theme-light .token.strike .one-theme-light .token.content, +.language-markdown .one-theme-light .token.strike .one-theme-light .token.punctuation, +.language-markdown .one-theme-light .token.list.punctuation, +.language-markdown .one-theme-light .token.title.important > .one-theme-light .token.punctuation { + color: hsl(5, 74%, 59%); +} + +/* General */ +.one-theme-light .token.bold { + font-weight: bold; +} + +.one-theme-light .token.comment, +.one-theme-light .token.italic { + font-style: italic; +} + +.one-theme-light .token.entity { + cursor: help; +} + +.one-theme-light .token.namespace { + opacity: 0.8; +} + +/* Plugin overrides */ +/* Selectors should have higher specificity than those in the plugins' default stylesheets */ + +/* Show Invisibles plugin overrides */ +.one-theme-light .token.one-theme-light .token.tab:not(:empty):before, +.one-theme-light .token.one-theme-light .token.cr:before, +.one-theme-light .token.one-theme-light .token.lf:before, +.one-theme-light .token.one-theme-light .token.space:before { + color: hsla(230, 8%, 24%, 0.2); +} + +/* Toolbar plugin overrides */ +/* Space out all buttons and move them away from the right edge of the code block */ +div.code-toolbar > .toolbar.toolbar > .toolbar-item { + margin-right: 0.4em; +} + +/* Styling the buttons */ +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span { + background: hsl(230, 1%, 90%); + color: hsl(230, 6%, 44%); + padding: 0.1em 0.4em; + border-radius: 0.3em; +} + +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus { + background: hsl(230, 1%, 78%); /* custom: darken(--syntax-bg, 20%) */ + color: hsl(230, 8%, 24%); +} + +/* Line Highlight plugin overrides */ +/* The highlighted line itself */ +.line-highlight.line-highlight { + background: hsla(230, 8%, 24%, 0.05); +} + +/* Default line numbers in Line Highlight plugin */ +.line-highlight.line-highlight:before, +.line-highlight.line-highlight[data-end]:after { + background: hsl(230, 1%, 90%); + color: hsl(230, 8%, 24%); + padding: 0.1em 0.6em; + border-radius: 0.3em; + box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.2); /* same as Toolbar plugin default */ +} + +/* Hovering over a linkable line number (in the gutter area) */ +/* Requires Line Numbers plugin as well */ +pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before { + background-color: hsla(230, 8%, 24%, 0.05); +} + +/* Line Numbers and Command Line plugins overrides */ +/* Line separating gutter from coding area */ +.line-numbers.line-numbers .line-numbers-rows, +.command-line .command-line-prompt { + border-right-color: hsla(230, 8%, 24%, 0.2); +} + +/* Stuff in the gutter */ +.line-numbers .line-numbers-rows > span:before, +.command-line .command-line-prompt > span:before { + color: hsl(230, 1%, 62%); +} + +/* Match Braces plugin overrides */ +/* Note: Outline colour is inherited from the braces */ +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-1, +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-5, +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-9 { + color: hsl(5, 74%, 59%); +} + +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-2, +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-6, +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-10 { + color: hsl(119, 34%, 47%); +} + +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-3, +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-7, +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-11 { + color: hsl(221, 87%, 60%); +} + +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-4, +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-8, +.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-12 { + color: hsl(301, 63%, 40%); +} + +/* Diff Highlight plugin overrides */ +/* Taken from https://github.com/atom/github/blob/master/styles/variables.less */ +pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.deleted:not(.prefix), +pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.deleted:not(.prefix) { + background-color: hsla(353, 100%, 66%, 0.15); +} + +pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.deleted:not(.prefix)::-moz-selection, +pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.deleted:not(.prefix) *::-moz-selection, +pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.deleted:not(.prefix)::-moz-selection, +pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.deleted:not(.prefix) *::-moz-selection { + background-color: hsla(353, 95%, 66%, 0.25); +} + +pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.deleted:not(.prefix)::selection, +pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.deleted:not(.prefix) *::selection, +pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.deleted:not(.prefix)::selection, +pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.deleted:not(.prefix) *::selection { + background-color: hsla(353, 95%, 66%, 0.25); +} + +pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.inserted:not(.prefix), +pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.inserted:not(.prefix) { + background-color: hsla(137, 100%, 55%, 0.15); +} + +pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.inserted:not(.prefix)::-moz-selection, +pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.inserted:not(.prefix) *::-moz-selection, +pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.inserted:not(.prefix)::-moz-selection, +pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.inserted:not(.prefix) *::-moz-selection { + background-color: hsla(135, 73%, 55%, 0.25); +} + +pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.inserted:not(.prefix)::selection, +pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.inserted:not(.prefix) *::selection, +pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.inserted:not(.prefix)::selection, +pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.inserted:not(.prefix) *::selection { + background-color: hsla(135, 73%, 55%, 0.25); +} + +/* Previewers plugin overrides */ +/* Based on https://github.com/atom-community/atom-ide-datatip/blob/master/styles/atom-ide-datatips.less and https://github.com/atom/atom/blob/master/packages/one-light-ui */ +/* Border around popup */ +.prism-previewer.prism-previewer:before, +.prism-previewer-gradient.prism-previewer-gradient div { + border-color: hsl(0, 0, 95%); +} + +/* Angle and time should remain as circles and are hence not included */ +.prism-previewer-color.prism-previewer-color:before, +.prism-previewer-gradient.prism-previewer-gradient div, +.prism-previewer-easing.prism-previewer-easing:before { + border-radius: 0.3em; +} + +/* Triangles pointing to the code */ +.prism-previewer.prism-previewer:after { + border-top-color: hsl(0, 0, 95%); +} + +.prism-previewer-flipped.prism-previewer-flipped.after { + border-bottom-color: hsl(0, 0, 95%); +} + +/* Background colour within the popup */ +.prism-previewer-angle.prism-previewer-angle:before, +.prism-previewer-time.prism-previewer-time:before, +.prism-previewer-easing.prism-previewer-easing { + background: hsl(0, 0%, 100%); +} + +/* For angle, this is the positive area (eg. 90deg will display one quadrant in this colour) */ +/* For time, this is the alternate colour */ +.prism-previewer-angle.prism-previewer-angle circle, +.prism-previewer-time.prism-previewer-time circle { + stroke: hsl(230, 8%, 24%); + stroke-opacity: 1; +} + +/* Stroke colours of the handle, direction point, and vector itself */ +.prism-previewer-easing.prism-previewer-easing circle, +.prism-previewer-easing.prism-previewer-easing path, +.prism-previewer-easing.prism-previewer-easing line { + stroke: hsl(230, 8%, 24%); +} + +/* Fill colour of the handle */ +.prism-previewer-easing.prism-previewer-easing circle { + fill: transparent; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-6EB6F03F9F578742CA0CD1189693E43A6135D910989ADD88CA3C0D6117EE24D7.css b/fastn-core/tests/22-http-headers/output/code-theme-6EB6F03F9F578742CA0CD1189693E43A6135D910989ADD88CA3C0D6117EE24D7.css new file mode 100644 index 0000000000..96ee075b18 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-6EB6F03F9F578742CA0CD1189693E43A6135D910989ADD88CA3C0D6117EE24D7.css @@ -0,0 +1,172 @@ +/* +Name: Duotone Earth +Author: Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) + +Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-earth-dark.css) +Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) +*/ + +code[class*="language-"].duotone-theme-earth, +pre[class*="language-"].duotone-theme-earth { + font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; + font-size: 14px; + line-height: 1.375; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + background: #322d29; + color: #88786d; +} + +pre > code[class*="language-"].duotone-theme-earth { + font-size: 1em; +} + +pre[class*="language-"].duotone-theme-earth::-moz-selection, pre[class*="language-"].duotone-theme-earth ::-moz-selection, +code[class*="language-"].duotone-theme-earth::-moz-selection, code[class*="language-"].duotone-theme-earth ::-moz-selection { + text-shadow: none; + background: #6f5849; +} + +pre[class*="language-"].duotone-theme-earth::selection, pre[class*="language-"].duotone-theme-earth ::selection, +code[class*="language-"].duotone-theme-earth::selection, code[class*="language-"].duotone-theme-earth ::selection { + text-shadow: none; + background: #6f5849; +} + +/* Code blocks */ +pre[class*="language-"].duotone-theme-earth { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].duotone-theme-earth { + padding: .1em; + border-radius: .3em; +} + +.duotone-theme-earth .token.comment, +.duotone-theme-earth .token.prolog, +.duotone-theme-earth .token.doctype, +.duotone-theme-earth .token.cdata { + color: #6a5f58; +} + +.duotone-theme-earth .token.punctuation { + color: #6a5f58; +} + +.duotone-theme-earth .token.namespace { + opacity: .7; +} + +.duotone-theme-earth .token.tag, +.duotone-theme-earth .token.operator, +.duotone-theme-earth .token.number { + color: #bfa05a; +} + +.duotone-theme-earth .token.property, +.duotone-theme-earth .token.function { + color: #88786d; +} + +.duotone-theme-earth .token.tag-id, +.duotone-theme-earth .token.selector, +.duotone-theme-earth .token.atrule-id { + color: #fff3eb; +} + +code.language-javascript, +.duotone-theme-earth .token.attr-name { + color: #a48774; +} + +code.language-css, +code.language-scss, +.duotone-theme-earth .token.boolean, +.duotone-theme-earth .token.string, +.duotone-theme-earth .token.entity, +.duotone-theme-earth .token.url, +.language-css .duotone-theme-earth .token.string, +.language-scss .duotone-theme-earth .token.string, +.style .duotone-theme-earth .token.string, +.duotone-theme-earth .token.attr-value, +.duotone-theme-earth .token.keyword, +.duotone-theme-earth .token.control, +.duotone-theme-earth .token.directive, +.duotone-theme-earth .token.unit, +.duotone-theme-earth .token.statement, +.duotone-theme-earth .token.regex, +.duotone-theme-earth .token.atrule { + color: #fcc440; +} + +.duotone-theme-earth .token.placeholder, +.duotone-theme-earth .token.variable { + color: #fcc440; +} + +.duotone-theme-earth .token.deleted { + text-decoration: line-through; +} + +.duotone-theme-earth .token.inserted { + border-bottom: 1px dotted #fff3eb; + text-decoration: none; +} + +.duotone-theme-earth .token.italic { + font-style: italic; +} + +.duotone-theme-earth .token.important, +.duotone-theme-earth .token.bold { + font-weight: bold; +} + +.duotone-theme-earth .token.important { + color: #a48774; +} + +.duotone-theme-earth .token.entity { + cursor: help; +} + +pre > code.highlight { + outline: .4em solid #816d5f; + outline-offset: .4em; +} + +/* overrides color-values for the Line Numbers plugin + * http://prismjs.com/plugins/line-numbers/ + */ +.line-numbers.line-numbers .line-numbers-rows { + border-right-color: #35302b; +} + +.line-numbers .line-numbers-rows > span:before { + color: #46403d; +} + +/* overrides color-values for the Line Highlight plugin +* http://prismjs.com/plugins/line-highlight/ +*/ +.line-highlight.line-highlight { + background: rgba(191, 160, 90, 0.2); + background: -webkit-linear-gradient(left, rgba(191, 160, 90, 0.2) 70%, rgba(191, 160, 90, 0)); + background: linear-gradient(to right, rgba(191, 160, 90, 0.2) 70%, rgba(191, 160, 90, 0)); +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-7852E516BA094B01897820BB3432BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css b/fastn-core/tests/22-http-headers/output/code-theme-7852E516BA094B01897820BB3432BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css new file mode 100644 index 0000000000..c4e4d34880 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-7852E516BA094B01897820BB3432BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css @@ -0,0 +1,168 @@ +/** + * VS theme by Andrew Lock (https://andrewlock.net) + * Inspired by Visual Studio syntax coloring + */ + +code[class*="language-"].vs-theme-light, +pre[class*="language-"].vs-theme-light { + color: #393A34; + font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + font-size: .9em; + line-height: 1.2em; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre > code[class*="language-"].vs-theme-light { + font-size: 1em; +} + +pre[class*="language-"].vs-theme-light::-moz-selection, pre[class*="language-"].vs-theme-light ::-moz-selection, +code[class*="language-"].vs-theme-light::-moz-selection, code[class*="language-"].vs-theme-light ::-moz-selection { + background: #C1DEF1; +} + +pre[class*="language-"].vs-theme-light::selection, pre[class*="language-"].vs-theme-light ::selection, +code[class*="language-"].vs-theme-light::selection, code[class*="language-"].vs-theme-light ::selection { + background: #C1DEF1; +} + +/* Code blocks */ +pre[class*="language-"].vs-theme-light { + padding: 1em; + margin: .5em 0; + overflow: auto; + border: 1px solid #dddddd; + background-color: white; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].vs-theme-light { + padding: .2em; + padding-top: 1px; + padding-bottom: 1px; + background: #f8f8f8; + border: 1px solid #dddddd; +} + +.vs-theme-light .token.comment, +.vs-theme-light .token.prolog, +.vs-theme-light .token.doctype, +.vs-theme-light .token.cdata { + color: #008000; + font-style: italic; +} + +.vs-theme-light .token.namespace { + opacity: .7; +} + +.vs-theme-light .token.string { + color: #A31515; +} + +.vs-theme-light .token.punctuation, +.vs-theme-light .token.operator { + color: #393A34; /* no highlight */ +} + +.vs-theme-light .token.url, +.vs-theme-light .token.symbol, +.vs-theme-light .token.number, +.vs-theme-light .token.boolean, +.vs-theme-light .token.variable, +.vs-theme-light .token.constant, +.vs-theme-light .token.inserted { + color: #36acaa; +} + +.vs-theme-light .token.atrule, +.vs-theme-light .token.keyword, +.vs-theme-light .token.attr-value, +.language-autohotkey .vs-theme-light .token.selector, +.language-json .vs-theme-light .token.boolean, +.language-json .vs-theme-light .token.number, +code[class*="language-css"] { + color: #0000ff; +} + +.vs-theme-light .token.function { + color: #393A34; +} + +.vs-theme-light .token.deleted, +.language-autohotkey .vs-theme-light .token.tag { + color: #9a050f; +} + +.vs-theme-light .token.selector, +.language-autohotkey .vs-theme-light .token.keyword { + color: #00009f; +} + +.vs-theme-light .token.important { + color: #e90; +} + +.vs-theme-light .token.important, +.vs-theme-light .token.bold { + font-weight: bold; +} + +.vs-theme-light .token.italic { + font-style: italic; +} + +.vs-theme-light .token.class-name, +.language-json .vs-theme-light .token.property { + color: #2B91AF; +} + +.vs-theme-light .token.tag, +.vs-theme-light .token.selector { + color: #800000; +} + +.vs-theme-light .token.attr-name, +.vs-theme-light .token.property, +.vs-theme-light .token.regex, +.vs-theme-light .token.entity { + color: #ff0000; +} + +.vs-theme-light .token.directive.tag .tag { + background: #ffff00; + color: #393A34; +} + +/* overrides color-values for the Line Numbers plugin + * http://prismjs.com/plugins/line-numbers/ + */ +.line-numbers.line-numbers .line-numbers-rows { + border-right-color: #a5a5a5; +} + +.line-numbers .line-numbers-rows > span:before { + color: #2B91AF; +} + +/* overrides color-values for the Line Highlight plugin +* http://prismjs.com/plugins/line-highlight/ +*/ +.line-highlight.line-highlight { + background: rgba(193, 222, 241, 0.2); + background: -webkit-linear-gradient(left, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0)); + background: linear-gradient(to right, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0)); +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-792C7BB9F4C8DFF3E0CBC354D2084DBF71BC5750C2C1357F0E7D936867AFAB62.css b/fastn-core/tests/22-http-headers/output/code-theme-792C7BB9F4C8DFF3E0CBC354D2084DBF71BC5750C2C1357F0E7D936867AFAB62.css new file mode 100644 index 0000000000..8f0bbb35c5 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-792C7BB9F4C8DFF3E0CBC354D2084DBF71BC5750C2C1357F0E7D936867AFAB62.css @@ -0,0 +1,160 @@ +/* + * Z-Toch + * by Zeel Codder + * https://github.com/zeel-codder + * + */ +code[class*="language-"].ztouch-theme, +pre[class*="language-"].ztouch-theme { + color: #22da17; + font-family: monospace; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + line-height: 25px; + font-size: 18px; + margin: 5px 0; +} + +pre[class*="language-"].ztouch-theme * { + font-family: monospace; +} + +:not(pre) > code[class*="language-"].ztouch-theme, +pre[class*="language-"].ztouch-theme { + color: white; + background: #0a143c; + padding: 22px; +} + +/* Code blocks */ +pre[class*="language-"].ztouch-theme { + padding: 1em; + margin: 0.5em 0; + overflow: auto; +} + +pre[class*="language-"].ztouch-theme::-moz-selection, +pre[class*="language-"].ztouch-theme ::-moz-selection, +code[class*="language-"].ztouch-theme::-moz-selection, +code[class*="language-"].ztouch-theme ::-moz-selection { + text-shadow: none; + background: rgba(29, 59, 83, 0.99); +} + +pre[class*="language-"].ztouch-theme::selection, +pre[class*="language-"].ztouch-theme ::selection, +code[class*="language-"].ztouch-theme::selection, +code[class*="language-"].ztouch-theme ::selection { + text-shadow: none; + background: rgba(29, 59, 83, 0.99); +} + +@media print { + code[class*="language-"].ztouch-theme, + pre[class*="language-"].ztouch-theme { + text-shadow: none; + } +} + +:not(pre) > code[class*="language-"].ztouch-theme { + padding: 0.1em; + border-radius: 0.3em; + white-space: normal; +} + +.ztouch-theme .token.comment, +.ztouch-theme .token.prolog, +.ztouch-theme .token.cdata { + color: rgb(99, 119, 119); + font-style: italic; +} + +.ztouch-theme .token.punctuation { + color: rgb(199, 146, 234); +} + +.namespace { + color: rgb(178, 204, 214); +} + +.ztouch-theme .token.deleted { + color: rgba(239, 83, 80, 0.56); + font-style: italic; +} + +.ztouch-theme .token.symbol, +.ztouch-theme .token.property { + color: rgb(128, 203, 196); +} + +.ztouch-theme .token.tag, +.ztouch-theme .token.operator, +.ztouch-theme .token.keyword { + color: rgb(127, 219, 202); +} + +.ztouch-theme .token.boolean { + color: rgb(255, 88, 116); +} + +.ztouch-theme .token.number { + color: rgb(247, 140, 108); +} + +.ztouch-theme .token.constant, +.ztouch-theme .token.function, +.ztouch-theme .token.builtin, +.ztouch-theme .token.char { + color: rgb(34 183 199); +} + +.ztouch-theme .token.selector, +.ztouch-theme .token.doctype { + color: rgb(199, 146, 234); + font-style: italic; +} + +.ztouch-theme .token.attr-name, +.ztouch-theme .token.inserted { + color: rgb(173, 219, 103); + font-style: italic; +} + +.ztouch-theme .token.string, +.ztouch-theme .token.url, +.ztouch-theme .token.entity, +.language-css .ztouch-theme .token.string, +.style .ztouch-theme .token.string { + color: rgb(173, 219, 103); +} + +.ztouch-theme .token.class-name, +.ztouch-theme .token.atrule, +.ztouch-theme .token.attr-value { + color: rgb(255, 203, 139); +} + +.ztouch-theme .token.regex, +.ztouch-theme .token.important, +.ztouch-theme .token.variable { + color: rgb(214, 222, 235); +} + +.ztouch-theme .token.important, +.ztouch-theme .token.bold { + font-weight: bold; +} + +.ztouch-theme .token.italic { + font-style: italic; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-88F91252A8A0EA125B4BA2C7B85E65580DB580F1477931AADCB5118E4E69D1CD.css b/fastn-core/tests/22-http-headers/output/code-theme-88F91252A8A0EA125B4BA2C7B85E65580DB580F1477931AADCB5118E4E69D1CD.css new file mode 100644 index 0000000000..a4fd66e9de --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-88F91252A8A0EA125B4BA2C7B85E65580DB580F1477931AADCB5118E4E69D1CD.css @@ -0,0 +1,158 @@ +/** + * MIT License + * Copyright (c) 2018 Sarah Drasner + * Sarah Drasner's[@sdras] Night Owl + * Ported by Sara vieria [@SaraVieira] + * Added by Souvik Mandal [@SimpleIndian] + */ + +code[class*="language-"].nightowl-theme, +pre[class*="language-"].nightowl-theme { + color: #d6deeb; + font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + font-size: 1em; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"].nightowl-theme::-moz-selection, +pre[class*="language-"].nightowl-theme::-moz-selection, +code[class*="language-"].nightowl-theme::-moz-selection, +code[class*="language-"].nightowl-theme::-moz-selection { + text-shadow: none; + background: rgba(29, 59, 83, 0.99); +} + +pre[class*="language-"].nightowl-theme::selection, +pre[class*="language-"].nightowl-theme ::selection, +code[class*="language-"].nightowl-theme::selection, +code[class*="language-"].nightowl-theme ::selection { + text-shadow: none; + background: rgba(29, 59, 83, 0.99); +} + +@media print { + code[class*="language-"].nightowl-theme, + pre[class*="language-"].nightowl-theme { + text-shadow: none; + } +} + +/* Code blocks */ +pre[class*="language-"].nightowl-theme { + padding: 1em; + margin: 0.5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"].nightowl-theme, +pre[class*="language-"].nightowl-theme { + color: white; + background: #011627; +} + +:not(pre) > code[class*="language-"].nightowl-theme { + padding: 0.1em; + border-radius: 0.3em; + white-space: normal; +} + +.nightowl-theme .token.comment, +.nightowl-theme .token.prolog, +.nightowl-theme .token.cdata { + color: rgb(99, 119, 119); + font-style: italic; +} + +.nightowl-theme .token.punctuation { + color: rgb(199, 146, 234); +} + +.namespace { + color: rgb(178, 204, 214); +} + +.nightowl-theme .token.deleted { + color: rgba(239, 83, 80, 0.56); + font-style: italic; +} + +.nightowl-theme .token.symbol, +.nightowl-theme .token.property { + color: rgb(128, 203, 196); +} + +.nightowl-theme .token.tag, +.nightowl-theme .token.operator, +.nightowl-theme .token.keyword { + color: rgb(127, 219, 202); +} + +.nightowl-theme .token.boolean { + color: rgb(255, 88, 116); +} + +.nightowl-theme .token.number { + color: rgb(247, 140, 108); +} + +.nightowl-theme .token.constant, +.nightowl-theme .token.function, +.nightowl-theme .token.builtin, +.nightowl-theme .token.char { + color: rgb(130, 170, 255); +} + +.nightowl-theme .token.selector, +.nightowl-theme .token.doctype { + color: rgb(199, 146, 234); + font-style: italic; +} + +.nightowl-theme .token.attr-name, +.nightowl-theme .token.inserted { + color: rgb(173, 219, 103); + font-style: italic; +} + +.nightowl-theme .token.string, +.nightowl-theme .token.url, +.nightowl-theme .token.entity, +.language-css .nightowl-theme .token.string, +.style .nightowl-theme .token.string { + color: rgb(173, 219, 103); +} + +.nightowl-theme .token.class-name, +.nightowl-theme .token.atrule, +.nightowl-theme .token.attr-value { + color: rgb(255, 203, 139); +} + +.nightowl-theme .token.regex, +.nightowl-theme .token.important, +.nightowl-theme .token.variable { + color: rgb(214, 222, 235); +} + +.nightowl-theme .token.important, +.nightowl-theme .token.bold { + font-weight: bold; +} + +.nightowl-theme .token.italic { + font-style: italic; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-8C59190F5018F48CCBB063359072EE9053D04923BBC5D1BA52B574E78D8C536A.css b/fastn-core/tests/22-http-headers/output/code-theme-8C59190F5018F48CCBB063359072EE9053D04923BBC5D1BA52B574E78D8C536A.css new file mode 100644 index 0000000000..74b9801c00 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-8C59190F5018F48CCBB063359072EE9053D04923BBC5D1BA52B574E78D8C536A.css @@ -0,0 +1,207 @@ +code[class*="language-"].material-theme-light, +pre[class*="language-"].material-theme-light { + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + color: #90a4ae; + background: #fafafa; + font-family: Roboto Mono, monospace; + font-size: 1em; + line-height: 1.5em; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +code[class*="language-"].material-theme-light::-moz-selection, +pre[class*="language-"].material-theme-light::-moz-selection, +code[class*="language-"].material-theme-light ::-moz-selection, +pre[class*="language-"].material-theme-light ::-moz-selection { + background: #cceae7; + color: #263238; +} + +code[class*="language-"].material-theme-light::selection, +pre[class*="language-"].material-theme-light::selection, +code[class*="language-"].material-theme-light ::selection, +pre[class*="language-"].material-theme-light ::selection { + background: #cceae7; + color: #263238; +} + +:not(pre) > code[class*="language-"].material-theme-light { + white-space: normal; + border-radius: 0.2em; + padding: 0.1em; +} + +pre[class*="language-"].material-theme-light { + overflow: auto; + position: relative; + margin: 0.5em 0; + padding: 1.25em 1em; +} + +.language-css > code, +.language-sass > code, +.language-scss > code { + color: #f76d47; +} + +[class*="language-"].material-theme-light .namespace { + opacity: 0.7; +} + +.material-theme-light .token.atrule { + color: #7c4dff; +} + +.material-theme-light .token.attr-name { + color: #39adb5; +} + +.material-theme-light .token.attr-value { + color: #f6a434; +} + +.material-theme-light .token.attribute { + color: #f6a434; +} + +.material-theme-light .token.boolean { + color: #7c4dff; +} + +.material-theme-light .token.builtin { + color: #39adb5; +} + +.material-theme-light .token.cdata { + color: #39adb5; +} + +.material-theme-light .token.char { + color: #39adb5; +} + +.material-theme-light .token.class { + color: #39adb5; +} + +.material-theme-light .token.class-name { + color: #6182b8; +} + +.material-theme-light .token.comment { + color: #aabfc9; +} + +.material-theme-light .token.constant { + color: #7c4dff; +} + +.material-theme-light .token.deleted { + color: #e53935; +} + +.material-theme-light .token.doctype { + color: #aabfc9; +} + +.material-theme-light .token.entity { + color: #e53935; +} + +.material-theme-light .token.function { + color: #7c4dff; +} + +.material-theme-light .token.hexcode { + color: #f76d47; +} + +.material-theme-light .token.id { + color: #7c4dff; + font-weight: bold; +} + +.material-theme-light .token.important { + color: #7c4dff; + font-weight: bold; +} + +.material-theme-light .token.inserted { + color: #39adb5; +} + +.material-theme-light .token.keyword { + color: #7c4dff; +} + +.material-theme-light .token.number { + color: #f76d47; +} + +.material-theme-light .token.operator { + color: #39adb5; +} + +.material-theme-light .token.prolog { + color: #aabfc9; +} + +.material-theme-light .token.property { + color: #39adb5; +} + +.material-theme-light .token.pseudo-class { + color: #f6a434; +} + +.material-theme-light .token.pseudo-element { + color: #f6a434; +} + +.material-theme-light .token.punctuation { + color: #39adb5; +} + +.material-theme-light .token.regex { + color: #6182b8; +} + +.material-theme-light .token.selector { + color: #e53935; +} + +.material-theme-light .token.string { + color: #f6a434; +} + +.material-theme-light .token.symbol { + color: #7c4dff; +} + +.material-theme-light .token.tag { + color: #e53935; +} + +.material-theme-light .token.unit { + color: #f76d47; +} + +.material-theme-light .token.url { + color: #e53935; +} + +.material-theme-light .token.variable { + color: #e53935; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-8CCA3D600F91FA55950DF3132F2ABE4BA14CEEA13CD23E157BF6A137762B8452.css b/fastn-core/tests/22-http-headers/output/code-theme-8CCA3D600F91FA55950DF3132F2ABE4BA14CEEA13CD23E157BF6A137762B8452.css new file mode 100644 index 0000000000..911b935600 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-8CCA3D600F91FA55950DF3132F2ABE4BA14CEEA13CD23E157BF6A137762B8452.css @@ -0,0 +1,205 @@ +code[class*="language-"].material-theme-dark, +pre[class*="language-"].material-theme-dark { + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + color: #eee; + background: #2f2f2f; + font-family: Roboto Mono, monospace; + font-size: 1em; + line-height: 1.5em; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +code[class*="language-"].material-theme-dark::-moz-selection, +pre[class*="language-"].material-theme-dark::-moz-selection, +code[class*="language-"].material-theme-dark::-moz-selection, +pre[class*="language-"].material-theme-dark::-moz-selection { + background: #363636; +} + +code[class*="language-"].material-theme-dark::selection, +pre[class*="language-"].material-theme-dark::selection, +code[class*="language-"].material-theme-dark::selection, +pre[class*="language-"].material-theme-dark::selection { + background: #363636; +} + +:not(pre) > code[class*="language-"].material-theme-dark { + white-space: normal; + border-radius: 0.2em; + padding: 0.1em; +} + +pre[class*="language-"].material-theme-dark { + overflow: auto; + position: relative; + margin: 0.5em 0; + padding: 1.25em 1em; +} + +.language-css > code, +.language-sass > code, +.language-scss > code { + color: #fd9170; +} + +[class*="language-"].material-theme-dark .namespace { + opacity: 0.7; +} + +.material-theme-dark .token.atrule { + color: #c792ea; +} + +.material-theme-dark .token.attr-name { + color: #ffcb6b; +} + +.material-theme-dark .token.attr-value { + color: #a5e844; +} + +.material-theme-dark .token.attribute { + color: #a5e844; +} + +.material-theme-dark .token.boolean { + color: #c792ea; +} + +.material-theme-dark .token.builtin { + color: #ffcb6b; +} + +.material-theme-dark .token.cdata { + color: #80cbc4; +} + +.material-theme-dark .token.char { + color: #80cbc4; +} + +.material-theme-dark .token.class { + color: #ffcb6b; +} + +.material-theme-dark .token.class-name { + color: #f2ff00; +} + +.material-theme-dark .token.comment { + color: #616161; +} + +.material-theme-dark .token.constant { + color: #c792ea; +} + +.material-theme-dark .token.deleted { + color: #ff6666; +} + +.material-theme-dark .token.doctype { + color: #616161; +} + +.material-theme-dark .token.entity { + color: #ff6666; +} + +.material-theme-dark .token.function { + color: #c792ea; +} + +.material-theme-dark .token.hexcode { + color: #f2ff00; +} + +.material-theme-dark .token.id { + color: #c792ea; + font-weight: bold; +} + +.material-theme-dark .token.important { + color: #c792ea; + font-weight: bold; +} + +.material-theme-dark .token.inserted { + color: #80cbc4; +} + +.material-theme-dark .token.keyword { + color: #c792ea; +} + +.material-theme-dark .token.number { + color: #fd9170; +} + +.material-theme-dark .token.operator { + color: #89ddff; +} + +.material-theme-dark .token.prolog { + color: #616161; +} + +.material-theme-dark .token.property { + color: #80cbc4; +} + +.material-theme-dark .token.pseudo-class { + color: #a5e844; +} + +.material-theme-dark .token.pseudo-element { + color: #a5e844; +} + +.material-theme-dark .token.punctuation { + color: #89ddff; +} + +.material-theme-dark .token.regex { + color: #f2ff00; +} + +.material-theme-dark .token.selector { + color: #ff6666; +} + +.material-theme-dark .token.string { + color: #a5e844; +} + +.material-theme-dark .token.symbol { + color: #c792ea; +} + +.material-theme-dark .token.tag { + color: #ff6666; +} + +.material-theme-dark .token.unit { + color: #fd9170; +} + +.material-theme-dark .token.url { + color: #ff6666; +} + +.material-theme-dark .token.variable { + color: #ff6666; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-95B9118AFC8631777EEBBD89B2066C3706A6DF3579B14F41AF05564E41CAA09C.css b/fastn-core/tests/22-http-headers/output/code-theme-95B9118AFC8631777EEBBD89B2066C3706A6DF3579B14F41AF05564E41CAA09C.css new file mode 100644 index 0000000000..4aeccfcd65 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-95B9118AFC8631777EEBBD89B2066C3706A6DF3579B14F41AF05564E41CAA09C.css @@ -0,0 +1,172 @@ +/* +Name: Duotone Dark +Author: Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) + +Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-evening-dark.css) +Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) +*/ + +code[class*="language-"].duotone-theme-dark, +pre[class*="language-"].duotone-theme-dark { + font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; + font-size: 14px; + line-height: 1.375; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + background: #2a2734; + color: #9a86fd; +} + +pre > code[class*="language-"].duotone-theme-dark { + font-size: 1em; +} + +pre[class*="language-"].duotone-theme-dark::-moz-selection, pre[class*="language-"].duotone-theme-dark ::-moz-selection, +code[class*="language-"].duotone-theme-dark::-moz-selection, code[class*="language-"].duotone-theme-dark ::-moz-selection { + text-shadow: none; + background: #6a51e6; +} + +pre[class*="language-"].duotone-theme-dark::selection, pre[class*="language-"].duotone-theme-dark ::selection, +code[class*="language-"].duotone-theme-dark::selection, code[class*="language-"].duotone-theme-dark ::selection { + text-shadow: none; + background: #6a51e6; +} + +/* Code blocks */ +pre[class*="language-"].duotone-theme-dark { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].duotone-theme-dark { + padding: .1em; + border-radius: .3em; +} + +.duotone-theme-dark .token.comment, +.duotone-theme-dark .token.prolog, +.duotone-theme-dark .token.doctype, +.duotone-theme-dark .token.cdata { + color: #6c6783; +} + +.duotone-theme-dark .token.punctuation { + color: #6c6783; +} + +.duotone-theme-dark .token.namespace { + opacity: .7; +} + +.duotone-theme-dark .token.tag, +.duotone-theme-dark .token.operator, +.duotone-theme-dark .token.number { + color: #e09142; +} + +.duotone-theme-dark .token.property, +.duotone-theme-dark .token.function { + color: #9a86fd; +} + +.duotone-theme-dark .token.tag-id, +.duotone-theme-dark .token.selector, +.duotone-theme-dark .token.atrule-id { + color: #eeebff; +} + +code.language-javascript, +.duotone-theme-dark .token.attr-name { + color: #c4b9fe; +} + +code.language-css, +code.language-scss, +.duotone-theme-dark .token.boolean, +.duotone-theme-dark .token.string, +.duotone-theme-dark .token.entity, +.duotone-theme-dark .token.url, +.language-css .duotone-theme-dark .token.string, +.language-scss .duotone-theme-dark .token.string, +.style .duotone-theme-dark .token.string, +.duotone-theme-dark .token.attr-value, +.duotone-theme-dark .token.keyword, +.duotone-theme-dark .token.control, +.duotone-theme-dark .token.directive, +.duotone-theme-dark .token.unit, +.duotone-theme-dark .token.statement, +.duotone-theme-dark .token.regex, +.duotone-theme-dark .token.atrule { + color: #ffcc99; +} + +.duotone-theme-dark .token.placeholder, +.duotone-theme-dark .token.variable { + color: #ffcc99; +} + +.duotone-theme-dark .token.deleted { + text-decoration: line-through; +} + +.duotone-theme-dark .token.inserted { + border-bottom: 1px dotted #eeebff; + text-decoration: none; +} + +.duotone-theme-dark .token.italic { + font-style: italic; +} + +.duotone-theme-dark .token.important, +.duotone-theme-dark .token.bold { + font-weight: bold; +} + +.duotone-theme-dark .token.important { + color: #c4b9fe; +} + +.duotone-theme-dark .token.entity { + cursor: help; +} + +pre > code.highlight { + outline: .4em solid #8a75f5; + outline-offset: .4em; +} + +/* overrides color-values for the Line Numbers plugin + * http://prismjs.com/plugins/line-numbers/ + */ +.line-numbers.line-numbers .line-numbers-rows { + border-right-color: #2c2937; +} + +.line-numbers .line-numbers-rows > span:before { + color: #3c3949; +} + +/* overrides color-values for the Line Highlight plugin +* http://prismjs.com/plugins/line-highlight/ +*/ +.line-highlight.line-highlight { + background: rgba(224, 145, 66, 0.2); + background: -webkit-linear-gradient(left, rgba(224, 145, 66, 0.2) 70%, rgba(224, 145, 66, 0)); + background: linear-gradient(to right, rgba(224, 145, 66, 0.2) 70%, rgba(224, 145, 66, 0)); +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-99CD7B013C96C4632F0AEA39AC265387B814AE85A7D33666A4AE4BEFF59016D0.css b/fastn-core/tests/22-http-headers/output/code-theme-99CD7B013C96C4632F0AEA39AC265387B814AE85A7D33666A4AE4BEFF59016D0.css new file mode 100644 index 0000000000..7044cc5db4 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-99CD7B013C96C4632F0AEA39AC265387B814AE85A7D33666A4AE4BEFF59016D0.css @@ -0,0 +1,318 @@ +/** + * Coldark Theme for Prism.js + * Theme variation: Cold + * Tested with HTML, CSS, JS, JSON, PHP, YAML, Bash script + * @author Armand Philippot + * @homepage https://github.com/ArmandPhilippot/coldark-prism + * @license MIT + * NOTE: This theme is used as light theme + */ +code[class*="language-"].coldark-theme-light, +pre[class*="language-"].coldark-theme-light { + color: #111b27; + background: none; + font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"].coldark-theme-light::-moz-selection, +pre[class*="language-"].coldark-theme-light ::-moz-selection, +code[class*="language-"].coldark-theme-light::-moz-selection, +code[class*="language-"].coldark-theme-light ::-moz-selection { + background: #8da1b9; +} + +pre[class*="language-"].coldark-theme-light::selection, +pre[class*="language-"].coldark-theme-light ::selection, +code[class*="language-"].coldark-theme-light::selection, +code[class*="language-"].coldark-theme-light ::selection { + background: #8da1b9; +} + +/* Code blocks */ +pre[class*="language-"].coldark-theme-light { + padding: 1em; + margin: 0.5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"].coldark-theme-light, +pre[class*="language-"].coldark-theme-light { + background: #e3eaf2; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].coldark-theme-light { + padding: 0.1em 0.3em; + border-radius: 0.3em; + white-space: normal; +} + +.coldark-theme-light .token.comment, +.coldark-theme-light .token.prolog, +.coldark-theme-light .token.doctype, +.coldark-theme-light .token.cdata { + color: #3c526d; +} + +.coldark-theme-light .token.punctuation { + color: #111b27; +} + +.coldark-theme-light .token.delimiter.important, +.coldark-theme-light .token.selector .parent, +.coldark-theme-light .token.tag, +.coldark-theme-light .token.tag .coldark-theme-light .token.punctuation { + color: #006d6d; +} + +.coldark-theme-light .token.attr-name, +.coldark-theme-light .token.boolean, +.coldark-theme-light .token.boolean.important, +.coldark-theme-light .token.number, +.coldark-theme-light .token.constant, +.coldark-theme-light .token.selector .coldark-theme-light .token.attribute { + color: #755f00; +} + +.coldark-theme-light .token.class-name, +.coldark-theme-light .token.key, +.coldark-theme-light .token.parameter, +.coldark-theme-light .token.property, +.coldark-theme-light .token.property-access, +.coldark-theme-light .token.variable { + color: #005a8e; +} + +.coldark-theme-light .token.attr-value, +.coldark-theme-light .token.inserted, +.coldark-theme-light .token.color, +.coldark-theme-light .token.selector .coldark-theme-light .token.value, +.coldark-theme-light .token.string, +.coldark-theme-light .token.string .coldark-theme-light .token.url-link { + color: #116b00; +} + +.coldark-theme-light .token.builtin, +.coldark-theme-light .token.keyword-array, +.coldark-theme-light .token.package, +.coldark-theme-light .token.regex { + color: #af00af; +} + +.coldark-theme-light .token.function, +.coldark-theme-light .token.selector .coldark-theme-light .token.class, +.coldark-theme-light .token.selector .coldark-theme-light .token.id { + color: #7c00aa; +} + +.coldark-theme-light .token.atrule .coldark-theme-light .token.rule, +.coldark-theme-light .token.combinator, +.coldark-theme-light .token.keyword, +.coldark-theme-light .token.operator, +.coldark-theme-light .token.pseudo-class, +.coldark-theme-light .token.pseudo-element, +.coldark-theme-light .token.selector, +.coldark-theme-light .token.unit { + color: #a04900; +} + +.coldark-theme-light .token.deleted, +.coldark-theme-light .token.important { + color: #c22f2e; +} + +.coldark-theme-light .token.keyword-this, +.coldark-theme-light .token.this { + color: #005a8e; +} + +.coldark-theme-light .token.important, +.coldark-theme-light .token.keyword-this, +.coldark-theme-light .token.this, +.coldark-theme-light .token.bold { + font-weight: bold; +} + +.coldark-theme-light .token.delimiter.important { + font-weight: inherit; +} + +.coldark-theme-light .token.italic { + font-style: italic; +} + +.coldark-theme-light .token.entity { + cursor: help; +} + +.language-markdown .coldark-theme-light .token.title, +.language-markdown .coldark-theme-light .token.title .coldark-theme-light .token.punctuation { + color: #005a8e; + font-weight: bold; +} + +.language-markdown .coldark-theme-light .token.blockquote.punctuation { + color: #af00af; +} + +.language-markdown .coldark-theme-light .token.code { + color: #006d6d; +} + +.language-markdown .coldark-theme-light .token.hr.punctuation { + color: #005a8e; +} + +.language-markdown .coldark-theme-light .token.url > .coldark-theme-light .token.content { + color: #116b00; +} + +.language-markdown .coldark-theme-light .token.url-link { + color: #755f00; +} + +.language-markdown .coldark-theme-light .token.list.punctuation { + color: #af00af; +} + +.language-markdown .coldark-theme-light .token.table-header { + color: #111b27; +} + +.language-json .coldark-theme-light .token.operator { + color: #111b27; +} + +.language-scss .coldark-theme-light .token.variable { + color: #006d6d; +} + +/* overrides color-values for the Show Invisibles plugin + * https://prismjs.com/plugins/show-invisibles/ + */ +.coldark-theme-light .token.coldark-theme-light .token.tab:not(:empty):before, +.coldark-theme-light .token.coldark-theme-light .token.cr:before, +.coldark-theme-light .token.coldark-theme-light .token.lf:before, +.coldark-theme-light .token.coldark-theme-light .token.space:before { + color: #3c526d; +} + +/* overrides color-values for the Toolbar plugin + * https://prismjs.com/plugins/toolbar/ + */ +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button { + color: #e3eaf2; + background: #005a8e; +} + +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus { + color: #e3eaf2; + background: #005a8eda; + text-decoration: none; +} + +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus { + color: #e3eaf2; + background: #3c526d; +} + +/* overrides color-values for the Line Highlight plugin + * http://prismjs.com/plugins/line-highlight/ + */ +.line-highlight.line-highlight { + background: #8da1b92f; + background: linear-gradient(to right, #8da1b92f 70%, #8da1b925); +} + +.line-highlight.line-highlight:before, +.line-highlight.line-highlight[data-end]:after { + background-color: #3c526d; + color: #e3eaf2; + box-shadow: 0 1px #8da1b9; +} + +pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before { + background-color: #3c526d1f; +} + +/* overrides color-values for the Line Numbers plugin + * http://prismjs.com/plugins/line-numbers/ + */ +.line-numbers.line-numbers .line-numbers-rows { + border-right: 1px solid #8da1b97a; + background: #d0dae77a; +} + +.line-numbers .line-numbers-rows > span:before { + color: #3c526dda; +} + +/* overrides color-values for the Match Braces plugin + * https://prismjs.com/plugins/match-braces/ + */ +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-1, +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-5, +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-9 { + color: #755f00; +} + +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-2, +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-6, +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-10 { + color: #af00af; +} + +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-3, +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-7, +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-11 { + color: #005a8e; +} + +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-4, +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-8, +.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-12 { + color: #7c00aa; +} + +/* overrides color-values for the Diff Highlight plugin + * https://prismjs.com/plugins/diff-highlight/ + */ +pre.diff-highlight > code .coldark-theme-light .token.coldark-theme-light .token.deleted:not(.prefix), +pre > code.diff-highlight .coldark-theme-light .token.coldark-theme-light .token.deleted:not(.prefix) { + background-color: #c22f2e1f; +} + +pre.diff-highlight > code .coldark-theme-light .token.coldark-theme-light .token.inserted:not(.prefix), +pre > code.diff-highlight .coldark-theme-light .token.coldark-theme-light .token.inserted:not(.prefix) { + background-color: #116b001f; +} + +/* overrides color-values for the Command Line plugin + * https://prismjs.com/plugins/command-line/ + */ +.command-line .command-line-prompt { + border-right: 1px solid #8da1b97a; +} + +.command-line .command-line-prompt > span:before { + color: #3c526dda; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-9A3284FD117DFF7CFD432FF860A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css b/fastn-core/tests/22-http-headers/output/code-theme-9A3284FD117DFF7CFD432FF860A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css new file mode 100644 index 0000000000..fd310e58c0 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-9A3284FD117DFF7CFD432FF860A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css @@ -0,0 +1,317 @@ +/** + * Coldark Theme for Prism.js + * Theme variation: Dark + * Tested with HTML, CSS, JS, JSON, PHP, YAML, Bash script + * @author Armand Philippot + * @homepage https://github.com/ArmandPhilippot/coldark-prism + * @license MIT + */ +code[class*="language-"].coldark-theme-dark, +pre[class*="language-"].coldark-theme-dark { + color: #e3eaf2; + background: none; + font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"].coldark-theme-dark::-moz-selection, +pre[class*="language-"].coldark-theme-dark ::-moz-selection, +code[class*="language-"].coldark-theme-dark::-moz-selection, +code[class*="language-"].coldark-theme-dark ::-moz-selection { + background: #3c526d; +} + +pre[class*="language-"].coldark-theme-dark::selection, +pre[class*="language-"].coldark-theme-dark ::selection, +code[class*="language-"].coldark-theme-dark::selection, +code[class*="language-"].coldark-theme-dark ::selection { + background: #3c526d; +} + +/* Code blocks */ +pre[class*="language-"].coldark-theme-dark { + padding: 1em; + margin: 0.5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"].coldark-theme-dark, +pre[class*="language-"].coldark-theme-dark { + background: #111b27; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].coldark-theme-dark { + padding: 0.1em 0.3em; + border-radius: 0.3em; + white-space: normal; +} + +.coldark-theme-dark .token.comment, +.coldark-theme-dark .token.prolog, +.coldark-theme-dark .token.doctype, +.coldark-theme-dark .token.cdata { + color: #8da1b9; +} + +.coldark-theme-dark .token.punctuation { + color: #e3eaf2; +} + +.coldark-theme-dark .token.delimiter.important, +.coldark-theme-dark .token.selector .parent, +.coldark-theme-dark .token.tag, +.coldark-theme-dark .token.tag .coldark-theme-dark .token.punctuation { + color: #66cccc; +} + +.coldark-theme-dark .token.attr-name, +.coldark-theme-dark .token.boolean, +.coldark-theme-dark .token.boolean.important, +.coldark-theme-dark .token.number, +.coldark-theme-dark .token.constant, +.coldark-theme-dark .token.selector .coldark-theme-dark .token.attribute { + color: #e6d37a; +} + +.coldark-theme-dark .token.class-name, +.coldark-theme-dark .token.key, +.coldark-theme-dark .token.parameter, +.coldark-theme-dark .token.property, +.coldark-theme-dark .token.property-access, +.coldark-theme-dark .token.variable { + color: #6cb8e6; +} + +.coldark-theme-dark .token.attr-value, +.coldark-theme-dark .token.inserted, +.coldark-theme-dark .token.color, +.coldark-theme-dark .token.selector .coldark-theme-dark .token.value, +.coldark-theme-dark .token.string, +.coldark-theme-dark .token.string .coldark-theme-dark .token.url-link { + color: #91d076; +} + +.coldark-theme-dark .token.builtin, +.coldark-theme-dark .token.keyword-array, +.coldark-theme-dark .token.package, +.coldark-theme-dark .token.regex { + color: #f4adf4; +} + +.coldark-theme-dark .token.function, +.coldark-theme-dark .token.selector .coldark-theme-dark .token.class, +.coldark-theme-dark .token.selector .coldark-theme-dark .token.id { + color: #c699e3; +} + +.coldark-theme-dark .token.atrule .coldark-theme-dark .token.rule, +.coldark-theme-dark .token.combinator, +.coldark-theme-dark .token.keyword, +.coldark-theme-dark .token.operator, +.coldark-theme-dark .token.pseudo-class, +.coldark-theme-dark .token.pseudo-element, +.coldark-theme-dark .token.selector, +.coldark-theme-dark .token.unit { + color: #e9ae7e; +} + +.coldark-theme-dark .token.deleted, +.coldark-theme-dark .token.important { + color: #cd6660; +} + +.coldark-theme-dark .token.keyword-this, +.coldark-theme-dark .token.this { + color: #6cb8e6; +} + +.coldark-theme-dark .token.important, +.coldark-theme-dark .token.keyword-this, +.coldark-theme-dark .token.this, +.coldark-theme-dark .token.bold { + font-weight: bold; +} + +.coldark-theme-dark .token.delimiter.important { + font-weight: inherit; +} + +.coldark-theme-dark .token.italic { + font-style: italic; +} + +.coldark-theme-dark .token.entity { + cursor: help; +} + +.language-markdown .coldark-theme-dark .token.title, +.language-markdown .coldark-theme-dark .token.title .coldark-theme-dark .token.punctuation { + color: #6cb8e6; + font-weight: bold; +} + +.language-markdown .coldark-theme-dark .token.blockquote.punctuation { + color: #f4adf4; +} + +.language-markdown .coldark-theme-dark .token.code { + color: #66cccc; +} + +.language-markdown .coldark-theme-dark .token.hr.punctuation { + color: #6cb8e6; +} + +.language-markdown .coldark-theme-dark .token.url .coldark-theme-dark .token.content { + color: #91d076; +} + +.language-markdown .coldark-theme-dark .token.url-link { + color: #e6d37a; +} + +.language-markdown .coldark-theme-dark .token.list.punctuation { + color: #f4adf4; +} + +.language-markdown .coldark-theme-dark .token.table-header { + color: #e3eaf2; +} + +.language-json .coldark-theme-dark .token.operator { + color: #e3eaf2; +} + +.language-scss .coldark-theme-dark .token.variable { + color: #66cccc; +} + +/* overrides color-values for the Show Invisibles plugin + * https://prismjs.com/plugins/show-invisibles/ + */ +.coldark-theme-dark .token.coldark-theme-dark .token.tab:not(:empty):before, +.coldark-theme-dark .token.coldark-theme-dark .token.cr:before, +.coldark-theme-dark .token.coldark-theme-dark .token.lf:before, +.coldark-theme-dark .token.coldark-theme-dark .token.space:before { + color: #8da1b9; +} + +/* overrides color-values for the Toolbar plugin + * https://prismjs.com/plugins/toolbar/ + */ +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button { + color: #111b27; + background: #6cb8e6; +} + +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus { + color: #111b27; + background: #6cb8e6da; + text-decoration: none; +} + +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus { + color: #111b27; + background: #8da1b9; +} + +/* overrides color-values for the Line Highlight plugin + * http://prismjs.com/plugins/line-highlight/ + */ +.line-highlight.line-highlight { + background: #3c526d5f; + background: linear-gradient(to right, #3c526d5f 70%, #3c526d55); +} + +.line-highlight.line-highlight:before, +.line-highlight.line-highlight[data-end]:after { + background-color: #8da1b9; + color: #111b27; + box-shadow: 0 1px #3c526d; +} + +pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before { + background-color: #8da1b918; +} + +/* overrides color-values for the Line Numbers plugin + * http://prismjs.com/plugins/line-numbers/ + */ +.line-numbers.line-numbers .line-numbers-rows { + border-right: 1px solid #0b121b; + background: #0b121b7a; +} + +.line-numbers .line-numbers-rows > span:before { + color: #8da1b9da; +} + +/* overrides color-values for the Match Braces plugin + * https://prismjs.com/plugins/match-braces/ + */ +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-1, +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-5, +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-9 { + color: #e6d37a; +} + +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-2, +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-6, +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-10 { + color: #f4adf4; +} + +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-3, +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-7, +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-11 { + color: #6cb8e6; +} + +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-4, +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-8, +.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-12 { + color: #c699e3; +} + +/* overrides color-values for the Diff Highlight plugin + * https://prismjs.com/plugins/diff-highlight/ + */ +pre.diff-highlight > code .coldark-theme-dark .token.coldark-theme-dark .token.deleted:not(.prefix), +pre > code.diff-highlight .coldark-theme-dark .token.coldark-theme-dark .token.deleted:not(.prefix) { + background-color: #cd66601f; +} + +pre.diff-highlight > code .coldark-theme-dark .token.coldark-theme-dark .token.inserted:not(.prefix), +pre > code.diff-highlight .coldark-theme-dark .token.coldark-theme-dark .token.inserted:not(.prefix) { + background-color: #91d0761f; +} + +/* overrides color-values for the Command Line plugin + * https://prismjs.com/plugins/command-line/ + */ +.command-line .command-line-prompt { + border-right: 1px solid #0b121b; +} + +.command-line .command-line-prompt > span:before { + color: #8da1b9da; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-9A45313F167DBD90654BFD5BB3BC0BDF6AE447485C30B0389ADA7B49C069E46A.css b/fastn-core/tests/22-http-headers/output/code-theme-9A45313F167DBD90654BFD5BB3BC0BDF6AE447485C30B0389ADA7B49C069E46A.css new file mode 100644 index 0000000000..5448cf3a91 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-9A45313F167DBD90654BFD5BB3BC0BDF6AE447485C30B0389ADA7B49C069E46A.css @@ -0,0 +1,172 @@ +/* +Name: Duotone Sea +Author: by Simurai, adapted from DuoTone themes by Simurai for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) + +Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-sea-dark.css) +Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) +*/ + +code[class*="language-"].duotone-theme-sea, +pre[class*="language-"].duotone-theme-sea { + font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; + font-size: 14px; + line-height: 1.375; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; + background: #1d262f; + color: #57718e; +} + +pre > code[class*="language-"].duotone-theme-sea { + font-size: 1em; +} + +pre[class*="language-"].duotone-theme-sea::-moz-selection, pre[class*="language-"].duotone-theme-sea ::-moz-selection, +code[class*="language-"].duotone-theme-sea::-moz-selection, code[class*="language-"].duotone-theme-sea ::-moz-selection { + text-shadow: none; + background: #004a9e; +} + +pre[class*="language-"].duotone-theme-sea::selection, pre[class*="language-"].duotone-theme-sea ::selection, +code[class*="language-"].duotone-theme-sea::selection, code[class*="language-"].duotone-theme-sea ::selection { + text-shadow: none; + background: #004a9e; +} + +/* Code blocks */ +pre[class*="language-"].duotone-theme-sea { + padding: 1em; + margin: .5em 0; + overflow: auto; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].duotone-theme-sea { + padding: .1em; + border-radius: .3em; +} + +.duotone-theme-sea .token.comment, +.duotone-theme-sea .token.prolog, +.duotone-theme-sea .token.doctype, +.duotone-theme-sea .token.cdata { + color: #4a5f78; +} + +.duotone-theme-sea .token.punctuation { + color: #4a5f78; +} + +.duotone-theme-sea .token.namespace { + opacity: .7; +} + +.duotone-theme-sea .token.tag, +.duotone-theme-sea .token.operator, +.duotone-theme-sea .token.number { + color: #0aa370; +} + +.duotone-theme-sea .token.property, +.duotone-theme-sea .token.function { + color: #57718e; +} + +.duotone-theme-sea .token.tag-id, +.duotone-theme-sea .token.selector, +.duotone-theme-sea .token.atrule-id { + color: #ebf4ff; +} + +code.language-javascript, +.duotone-theme-sea .token.attr-name { + color: #7eb6f6; +} + +code.language-css, +code.language-scss, +.duotone-theme-sea .token.boolean, +.duotone-theme-sea .token.string, +.duotone-theme-sea .token.entity, +.duotone-theme-sea .token.url, +.language-css .duotone-theme-sea .token.string, +.language-scss .duotone-theme-sea .token.string, +.style .duotone-theme-sea .token.string, +.duotone-theme-sea .token.attr-value, +.duotone-theme-sea .token.keyword, +.duotone-theme-sea .token.control, +.duotone-theme-sea .token.directive, +.duotone-theme-sea .token.unit, +.duotone-theme-sea .token.statement, +.duotone-theme-sea .token.regex, +.duotone-theme-sea .token.atrule { + color: #47ebb4; +} + +.duotone-theme-sea .token.placeholder, +.duotone-theme-sea .token.variable { + color: #47ebb4; +} + +.duotone-theme-sea .token.deleted { + text-decoration: line-through; +} + +.duotone-theme-sea .token.inserted { + border-bottom: 1px dotted #ebf4ff; + text-decoration: none; +} + +.duotone-theme-sea .token.italic { + font-style: italic; +} + +.duotone-theme-sea .token.important, +.duotone-theme-sea .token.bold { + font-weight: bold; +} + +.duotone-theme-sea .token.important { + color: #7eb6f6; +} + +.duotone-theme-sea .token.entity { + cursor: help; +} + +pre > code.highlight { + outline: .4em solid #34659d; + outline-offset: .4em; +} + +/* overrides color-values for the Line Numbers plugin + * http://prismjs.com/plugins/line-numbers/ + */ +.line-numbers.line-numbers .line-numbers-rows { + border-right-color: #1f2932; +} + +.line-numbers .line-numbers-rows > span:before { + color: #2c3847; +} + +/* overrides color-values for the Line Highlight plugin +* http://prismjs.com/plugins/line-highlight/ +*/ +.line-highlight.line-highlight { + background: rgba(10, 163, 112, 0.2); + background: -webkit-linear-gradient(left, rgba(10, 163, 112, 0.2) 70%, rgba(10, 163, 112, 0)); + background: linear-gradient(to right, rgba(10, 163, 112, 0.2) 70%, rgba(10, 163, 112, 0)); +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-A24DC8F09D03756A62923E8A883CAE3B938D54E2813F0855312D2554DBE97BAD.css b/fastn-core/tests/22-http-headers/output/code-theme-A24DC8F09D03756A62923E8A883CAE3B938D54E2813F0855312D2554DBE97BAD.css new file mode 100644 index 0000000000..db09be499c --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-A24DC8F09D03756A62923E8A883CAE3B938D54E2813F0855312D2554DBE97BAD.css @@ -0,0 +1,440 @@ +/** + * One Dark theme for prism.js + * Based on Atom's One Dark theme: https://github.com/atom/atom/tree/master/packages/one-dark-syntax + */ + +/** + * One Dark colours (accurate as of commit 8ae45ca on 6 Sep 2018) + * From colors.less + * --mono-1: hsl(220, 14%, 71%); + * --mono-2: hsl(220, 9%, 55%); + * --mono-3: hsl(220, 10%, 40%); + * --hue-1: hsl(187, 47%, 55%); + * --hue-2: hsl(207, 82%, 66%); + * --hue-3: hsl(286, 60%, 67%); + * --hue-4: hsl(95, 38%, 62%); + * --hue-5: hsl(355, 65%, 65%); + * --hue-5-2: hsl(5, 48%, 51%); + * --hue-6: hsl(29, 54%, 61%); + * --hue-6-2: hsl(39, 67%, 69%); + * --syntax-fg: hsl(220, 14%, 71%); + * --syntax-bg: hsl(220, 13%, 18%); + * --syntax-gutter: hsl(220, 14%, 45%); + * --syntax-guide: hsla(220, 14%, 71%, 0.15); + * --syntax-accent: hsl(220, 100%, 66%); + * From syntax-variables.less + * --syntax-selection-color: hsl(220, 13%, 28%); + * --syntax-gutter-background-color-selected: hsl(220, 13%, 26%); + * --syntax-cursor-line: hsla(220, 100%, 80%, 0.04); + */ + +code[class*="language-"].one-theme-dark, +pre[class*="language-"].one-theme-dark { + background: hsl(220, 13%, 18%); + color: hsl(220, 14%, 71%); + text-shadow: 0 1px rgba(0, 0, 0, 0.3); + font-family: "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +/* Selection */ +code[class*="language-"].one-theme-dark::-moz-selection, +code[class*="language-"].one-theme-dark *::-moz-selection, +pre[class*="language-"].one-theme-dark *::-moz-selection { + background: hsl(220, 13%, 28%); + color: inherit; + text-shadow: none; +} + +code[class*="language-"].one-theme-dark::selection, +code[class*="language-"].one-theme-dark *::selection, +pre[class*="language-"].one-theme-dark *::selection { + background: hsl(220, 13%, 28%); + color: inherit; + text-shadow: none; +} + +/* Code blocks */ +pre[class*="language-"].one-theme-dark { + padding: 1em; + margin: 0.5em 0; + overflow: auto; + border-radius: 0.3em; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].one-theme-dark { + padding: 0.2em 0.3em; + border-radius: 0.3em; + white-space: normal; +} + +/* Print */ +@media print { + code[class*="language-"].one-theme-dark, + pre[class*="language-"].one-theme-dark { + text-shadow: none; + } +} + +.one-theme-dark .token.comment, +.one-theme-dark .token.prolog, +.one-theme-dark .token.cdata { + color: hsl(220, 10%, 40%); +} + +.one-theme-dark .token.doctype, +.one-theme-dark .token.punctuation, +.one-theme-dark .token.entity { + color: hsl(220, 14%, 71%); +} + +.one-theme-dark .token.attr-name, +.one-theme-dark .token.class-name, +.one-theme-dark .token.boolean, +.one-theme-dark .token.constant, +.one-theme-dark .token.number, +.one-theme-dark .token.atrule { + color: hsl(29, 54%, 61%); +} + +.one-theme-dark .token.keyword { + color: hsl(286, 60%, 67%); +} + +.one-theme-dark .token.property, +.one-theme-dark .token.tag, +.one-theme-dark .token.symbol, +.one-theme-dark .token.deleted, +.one-theme-dark .token.important { + color: hsl(355, 65%, 65%); +} + +.one-theme-dark .token.selector, +.one-theme-dark .token.string, +.one-theme-dark .token.char, +.one-theme-dark .token.builtin, +.one-theme-dark .token.inserted, +.one-theme-dark .token.regex, +.one-theme-dark .token.attr-value, +.one-theme-dark .token.attr-value > .one-theme-dark .token.punctuation { + color: hsl(95, 38%, 62%); +} + +.one-theme-dark .token.variable, +.one-theme-dark .token.operator, +.one-theme-dark .token.function { + color: hsl(207, 82%, 66%); +} + +.one-theme-dark .token.url { + color: hsl(187, 47%, 55%); +} + +/* HTML overrides */ +.one-theme-dark .token.attr-value > .one-theme-dark .token.punctuation.attr-equals, +.one-theme-dark .token.special-attr > .one-theme-dark .token.attr-value > .one-theme-dark .token.value.css { + color: hsl(220, 14%, 71%); +} + +/* CSS overrides */ +.language-css .one-theme-dark .token.selector { + color: hsl(355, 65%, 65%); +} + +.language-css .one-theme-dark .token.property { + color: hsl(220, 14%, 71%); +} + +.language-css .one-theme-dark .token.function, +.language-css .one-theme-dark .token.url > .one-theme-dark .token.function { + color: hsl(187, 47%, 55%); +} + +.language-css .one-theme-dark .token.url > .one-theme-dark .token.string.url { + color: hsl(95, 38%, 62%); +} + +.language-css .one-theme-dark .token.important, +.language-css .one-theme-dark .token.atrule .one-theme-dark .token.rule { + color: hsl(286, 60%, 67%); +} + +/* JS overrides */ +.language-javascript .one-theme-dark .token.operator { + color: hsl(286, 60%, 67%); +} + +.language-javascript .one-theme-dark .token.template-string > .one-theme-dark .token.interpolation > .one-theme-dark .token.interpolation-punctuation.punctuation { + color: hsl(5, 48%, 51%); +} + +/* JSON overrides */ +.language-json .one-theme-dark .token.operator { + color: hsl(220, 14%, 71%); +} + +.language-json .one-theme-dark .token.null.keyword { + color: hsl(29, 54%, 61%); +} + +/* MD overrides */ +.language-markdown .one-theme-dark .token.url, +.language-markdown .one-theme-dark .token.url > .one-theme-dark .token.operator, +.language-markdown .one-theme-dark .token.url-reference.url > .one-theme-dark .token.string { + color: hsl(220, 14%, 71%); +} + +.language-markdown .one-theme-dark .token.url > .one-theme-dark .token.content { + color: hsl(207, 82%, 66%); +} + +.language-markdown .one-theme-dark .token.url > .one-theme-dark .token.url, +.language-markdown .one-theme-dark .token.url-reference.url { + color: hsl(187, 47%, 55%); +} + +.language-markdown .one-theme-dark .token.blockquote.punctuation, +.language-markdown .one-theme-dark .token.hr.punctuation { + color: hsl(220, 10%, 40%); + font-style: italic; +} + +.language-markdown .one-theme-dark .token.code-snippet { + color: hsl(95, 38%, 62%); +} + +.language-markdown .one-theme-dark .token.bold .one-theme-dark .token.content { + color: hsl(29, 54%, 61%); +} + +.language-markdown .one-theme-dark .token.italic .one-theme-dark .token.content { + color: hsl(286, 60%, 67%); +} + +.language-markdown .one-theme-dark .token.strike .one-theme-dark .token.content, +.language-markdown .one-theme-dark .token.strike .one-theme-dark .token.punctuation, +.language-markdown .one-theme-dark .token.list.punctuation, +.language-markdown .one-theme-dark .token.title.important > .one-theme-dark .token.punctuation { + color: hsl(355, 65%, 65%); +} + +/* General */ +.one-theme-dark .token.bold { + font-weight: bold; +} + +.one-theme-dark .token.comment, +.one-theme-dark .token.italic { + font-style: italic; +} + +.one-theme-dark .token.entity { + cursor: help; +} + +.one-theme-dark .token.namespace { + opacity: 0.8; +} + +/* Plugin overrides */ +/* Selectors should have higher specificity than those in the plugins' default stylesheets */ + +/* Show Invisibles plugin overrides */ +.one-theme-dark .token.one-theme-dark .token.tab:not(:empty):before, +.one-theme-dark .token.one-theme-dark .token.cr:before, +.one-theme-dark .token.one-theme-dark .token.lf:before, +.one-theme-dark .token.one-theme-dark .token.space:before { + color: hsla(220, 14%, 71%, 0.15); + text-shadow: none; +} + +/* Toolbar plugin overrides */ +/* Space out all buttons and move them away from the right edge of the code block */ +div.code-toolbar > .toolbar.toolbar > .toolbar-item { + margin-right: 0.4em; +} + +/* Styling the buttons */ +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span { + background: hsl(220, 13%, 26%); + color: hsl(220, 9%, 55%); + padding: 0.1em 0.4em; + border-radius: 0.3em; +} + +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover, +div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus { + background: hsl(220, 13%, 28%); + color: hsl(220, 14%, 71%); +} + +/* Line Highlight plugin overrides */ +/* The highlighted line itself */ +.line-highlight.line-highlight { + background: hsla(220, 100%, 80%, 0.04); +} + +/* Default line numbers in Line Highlight plugin */ +.line-highlight.line-highlight:before, +.line-highlight.line-highlight[data-end]:after { + background: hsl(220, 13%, 26%); + color: hsl(220, 14%, 71%); + padding: 0.1em 0.6em; + border-radius: 0.3em; + box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.2); /* same as Toolbar plugin default */ +} + +/* Hovering over a linkable line number (in the gutter area) */ +/* Requires Line Numbers plugin as well */ +pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before { + background-color: hsla(220, 100%, 80%, 0.04); +} + +/* Line Numbers and Command Line plugins overrides */ +/* Line separating gutter from coding area */ +.line-numbers.line-numbers .line-numbers-rows, +.command-line .command-line-prompt { + border-right-color: hsla(220, 14%, 71%, 0.15); +} + +/* Stuff in the gutter */ +.line-numbers .line-numbers-rows > span:before, +.command-line .command-line-prompt > span:before { + color: hsl(220, 14%, 45%); +} + +/* Match Braces plugin overrides */ +/* Note: Outline colour is inherited from the braces */ +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-1, +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-5, +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-9 { + color: hsl(355, 65%, 65%); +} + +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-2, +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-6, +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-10 { + color: hsl(95, 38%, 62%); +} + +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-3, +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-7, +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-11 { + color: hsl(207, 82%, 66%); +} + +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-4, +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-8, +.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-12 { + color: hsl(286, 60%, 67%); +} + +/* Diff Highlight plugin overrides */ +/* Taken from https://github.com/atom/github/blob/master/styles/variables.less */ +pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix), +pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix) { + background-color: hsla(353, 100%, 66%, 0.15); +} + +pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix)::-moz-selection, +pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix) *::-moz-selection, +pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix)::-moz-selection, +pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix) *::-moz-selection { + background-color: hsla(353, 95%, 66%, 0.25); +} + +pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix)::selection, +pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix) *::selection, +pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix)::selection, +pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix) *::selection { + background-color: hsla(353, 95%, 66%, 0.25); +} + +pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix), +pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix) { + background-color: hsla(137, 100%, 55%, 0.15); +} + +pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix)::-moz-selection, +pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix) *::-moz-selection, +pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix)::-moz-selection, +pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix) *::-moz-selection { + background-color: hsla(135, 73%, 55%, 0.25); +} + +pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix)::selection, +pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix) *::selection, +pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix)::selection, +pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix) *::selection { + background-color: hsla(135, 73%, 55%, 0.25); +} + +/* Previewers plugin overrides */ +/* Based on https://github.com/atom-community/atom-ide-datatip/blob/master/styles/atom-ide-datatips.less and https://github.com/atom/atom/blob/master/packages/one-dark-ui */ +/* Border around popup */ +.prism-previewer.prism-previewer:before, +.prism-previewer-gradient.prism-previewer-gradient div { + border-color: hsl(224, 13%, 17%); +} + +/* Angle and time should remain as circles and are hence not included */ +.prism-previewer-color.prism-previewer-color:before, +.prism-previewer-gradient.prism-previewer-gradient div, +.prism-previewer-easing.prism-previewer-easing:before { + border-radius: 0.3em; +} + +/* Triangles pointing to the code */ +.prism-previewer.prism-previewer:after { + border-top-color: hsl(224, 13%, 17%); +} + +.prism-previewer-flipped.prism-previewer-flipped.after { + border-bottom-color: hsl(224, 13%, 17%); +} + +/* Background colour within the popup */ +.prism-previewer-angle.prism-previewer-angle:before, +.prism-previewer-time.prism-previewer-time:before, +.prism-previewer-easing.prism-previewer-easing { + background: hsl(219, 13%, 22%); +} + +/* For angle, this is the positive area (eg. 90deg will display one quadrant in this colour) */ +/* For time, this is the alternate colour */ +.prism-previewer-angle.prism-previewer-angle circle, +.prism-previewer-time.prism-previewer-time circle { + stroke: hsl(220, 14%, 71%); + stroke-opacity: 1; +} + +/* Stroke colours of the handle, direction point, and vector itself */ +.prism-previewer-easing.prism-previewer-easing circle, +.prism-previewer-easing.prism-previewer-easing path, +.prism-previewer-easing.prism-previewer-easing line { + stroke: hsl(220, 14%, 71%); +} + +/* Fill colour of the handle */ +.prism-previewer-easing.prism-previewer-easing circle { + fill: transparent; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-A352AF572179AB980583D41BC41ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css b/fastn-core/tests/22-http-headers/output/code-theme-A352AF572179AB980583D41BC41ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css new file mode 100644 index 0000000000..5fc5648fb7 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-A352AF572179AB980583D41BC41ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css @@ -0,0 +1,134 @@ +code[class*=language-].fire-light, +pre[class*=language-].fire-light { + color: #000; + background: 0 0; + text-shadow: 0 1px #fff; + /*font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;*/ + /*font-size: 1em;*/ + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + /*line-height: 1.5;*/ + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none +} + +code[class*=language-].fire-light ::-moz-selection, +code[class*=language-].fire-light::-moz-selection, +pre[class*=language-].fire-light ::-moz-selection, +pre[class*=language-].fire-light::-moz-selection { + text-shadow: none; + background: #b3d4fc +} + +code[class*=language-].fire-light ::selection, +code[class*=language-].fire-light::selection, +pre[class*=language-].fire-light ::selection, +pre[class*=language-].fire-light::selection { + text-shadow: none; + background: #b3d4fc +} + +@media print { + + code[class*=language-].fire-light, + pre[class*=language-].fire-light { + text-shadow: none + } +} + +pre[class*=language-].fire-light { + padding: 1em; + overflow: auto +} + +:not(pre)>code[class*=language-].fire-light, +pre[class*=language-].fire-light { + background: #f5f2f0 +} + +:not(pre)>code[class*=language-].fire-light { + padding: .1em; + border-radius: .3em; + white-space: normal +} + +.fire-light .token.cdata, +.fire-light .token.comment, +.fire-light .token.doctype, +.fire-light .token.prolog { + color: #708090 +} + +.fire-light .token.punctuation { + color: #999 +} + +.fire-light .token.namespace { + opacity: .7 +} + +.fire-light .token.boolean, +.fire-light .token.constant, +.fire-light .token.deleted, +.fire-light .token.number, +.fire-light .token.property, +.fire-light .token.symbol, +.fire-light .token.tag { + color: #905 +} + +.fire-light .token.attr-name, +.fire-light .token.builtin, +.fire-light .token.char, +.fire-light .token.inserted, +.fire-light .token.selector, +.fire-light .token.string { + color: #690 +} + +.language-css .fire-light .token.string, +.style .fire-light .token.string, +.fire-light .token.entity, +.fire-light .token.operator, +.fire-light .token.url { + color: #9a6e3a; + background: hsla(0, 0%, 100%, .5) +} + +.fire-light .token.atrule, +.fire-light .token.attr-value, +.fire-light .token.keyword { + color: #07a +} + +.fire-light .token.class-name, +.fire-light .token.function { + color: #dd4a68 +} + +.fire-light .token.important, +.fire-light .token.regex, +.fire-light .token.variable { + color: #e90 +} + +.fire-light .token.bold, +.fire-light .token.important { + font-weight: 700 +} + +.fire-light .token.italic { + font-style: italic +} + +.fire-light .token.entity { + cursor: help +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-B3AEA322EADEDA61F0E219845A0E9C8E73F6345E49362B46E6F52CEE40471248.css b/fastn-core/tests/22-http-headers/output/code-theme-B3AEA322EADEDA61F0E219845A0E9C8E73F6345E49362B46E6F52CEE40471248.css new file mode 100644 index 0000000000..7e3f7c4c3d --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-B3AEA322EADEDA61F0E219845A0E9C8E73F6345E49362B46E6F52CEE40471248.css @@ -0,0 +1,140 @@ +/** + * Coy without shadows + * Based on Tim Shedor's Coy theme for prism.js + * Author: RunDevelopment + */ + +code[class*="language-"].coy-theme, +pre[class*="language-"].coy-theme { + color: black; + background: none; + font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; + font-size: 1em; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +/* Code blocks */ +pre[class*="language-"].coy-theme { + position: relative; + border-left: 10px solid #358ccb; + box-shadow: -1px 0 0 0 #358ccb, 0 0 0 1px #dfdfdf; + background-color: #fdfdfd; + background-image: linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); + background-size: 3em 3em; + background-origin: content-box; + background-attachment: local; + margin: .5em 0; + padding: 0 1em; +} + +pre[class*="language-"].coy-theme > code { + display: block; +} + +/* Inline code */ +:not(pre) > code[class*="language-"].coy-theme { + position: relative; + padding: .2em; + border-radius: 0.3em; + color: #c92c2c; + border: 1px solid rgba(0, 0, 0, 0.1); + display: inline; + white-space: normal; + background-color: #fdfdfd; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.coy-theme .token.comment, +.coy-theme .token.block-comment, +.coy-theme .token.prolog, +.coy-theme .token.doctype, +.coy-theme .token.cdata { + color: #7D8B99; +} + +.coy-theme .token.punctuation { + color: #5F6364; +} + +.coy-theme .token.property, +.coy-theme .token.tag, +.coy-theme .token.boolean, +.coy-theme .token.number, +.coy-theme .token.function-name, +.coy-theme .token.constant, +.coy-theme .token.symbol, +.coy-theme .token.deleted { + color: #c92c2c; +} + +.coy-theme .token.selector, +.coy-theme .token.attr-name, +.coy-theme .token.string, +.coy-theme .token.char, +.coy-theme .token.function, +.coy-theme .token.builtin, +.coy-theme .token.inserted { + color: #2f9c0a; +} + +.coy-theme .token.operator, +.coy-theme .token.entity, +.coy-theme .token.url, +.coy-theme .token.variable { + color: #a67f59; + background: rgba(255, 255, 255, 0.5); +} + +.coy-theme .token.atrule, +.coy-theme .token.attr-value, +.coy-theme .token.keyword, +.coy-theme .token.class-name { + color: #1990b8; +} + +.coy-theme .token.regex, +.coy-theme .token.important { + color: #e90; +} + +.language-css .coy-theme .token.string, +.style .coy-theme .token.string { + color: #a67f59; + background: rgba(255, 255, 255, 0.5); +} + +.coy-theme .token.important { + font-weight: normal; +} + +.coy-theme .token.bold { + font-weight: bold; +} + +.coy-theme .token.italic { + font-style: italic; +} + +.coy-theme .token.entity { + cursor: help; +} + +.coy-theme .token.namespace { + opacity: .7; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-B68AA27E05B319F04A9CD747AADBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css b/fastn-core/tests/22-http-headers/output/code-theme-B68AA27E05B319F04A9CD747AADBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css new file mode 100644 index 0000000000..834c3b19f6 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-B68AA27E05B319F04A9CD747AADBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css @@ -0,0 +1,139 @@ +/** + * Gruvbox dark theme + * + * Adapted from a theme based on: + * Vim Gruvbox dark Theme (https://github.com/morhetz/gruvbox) + * + * @author Azat S. + * @version 1.0 + */ + +code[class*="language-"].gruvbox-theme-dark, +pre[class*="language-"].gruvbox-theme-dark { + color: #ebdbb2; /* fg1 / fg */ + font-family: Consolas, Monaco, "Andale Mono", monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"].gruvbox-theme-dark::-moz-selection, +pre[class*="language-"].gruvbox-theme-dark ::-moz-selection, +code[class*="language-"].gruvbox-theme-dark::-moz-selection, +code[class*="language-"].gruvbox-theme-dark ::-moz-selection { + color: #fbf1c7; /* fg0 */ + background: #7c6f64; /* bg4 */ +} + +pre[class*="language-"].gruvbox-theme-dark::selection, +pre[class*="language-"].gruvbox-theme-dark ::selection, +code[class*="language-"].gruvbox-theme-dark::selection, +code[class*="language-"].gruvbox-theme-dark ::selection { + color: #fbf1c7; /* fg0 */ + background: #7c6f64; /* bg4 */ +} + +/* Code blocks */ +pre[class*="language-"].gruvbox-theme-dark { + padding: 1em; + margin: 0.5em 0; + overflow: auto; +} + +:not(pre) > code[class*="language-"].gruvbox-theme-dark, +pre[class*="language-"].gruvbox-theme-dark { + background: #1d2021; /* bg0_h */ +} + +/* Inline code */ +:not(pre) > code[class*="language-"].gruvbox-theme-dark { + padding: 0.1em; + border-radius: 0.3em; +} + +.gruvbox-theme-dark .token.comment, +.gruvbox-theme-dark .token.prolog, +.gruvbox-theme-dark .token.cdata { + color: #a89984; /* fg4 / gray1 */ +} + +.gruvbox-theme-dark .token.delimiter, +.gruvbox-theme-dark .token.boolean, +.gruvbox-theme-dark .token.keyword, +.gruvbox-theme-dark .token.selector, +.gruvbox-theme-dark .token.important, +.gruvbox-theme-dark .token.atrule { + color: #fb4934; /* red2 */ +} + +.gruvbox-theme-dark .token.operator, +.gruvbox-theme-dark .token.punctuation, +.gruvbox-theme-dark .token.attr-name { + color: #a89984; /* fg4 / gray1 */ +} + +.gruvbox-theme-dark .token.tag, +.gruvbox-theme-dark .token.tag .punctuation, +.gruvbox-theme-dark .token.doctype, +.gruvbox-theme-dark .token.builtin { + color: #fabd2f; /* yellow2 */ +} + +.gruvbox-theme-dark .token.entity, +.gruvbox-theme-dark .token.number, +.gruvbox-theme-dark .token.symbol { + color: #d3869b; /* purple2 */ +} + +.gruvbox-theme-dark .token.property, +.gruvbox-theme-dark .token.constant, +.gruvbox-theme-dark .token.variable { + color: #fb4934; /* red2 */ +} + +.gruvbox-theme-dark .token.string, +.gruvbox-theme-dark .token.char { + color: #b8bb26; /* green2 */ +} + +.gruvbox-theme-dark .token.attr-value, +.gruvbox-theme-dark .token.attr-value .punctuation { + color: #a89984; /* fg4 / gray1 */ +} + +.gruvbox-theme-dark .token.url { + color: #b8bb26; /* green2 */ + text-decoration: underline; +} + +.gruvbox-theme-dark .token.function { + color: #fabd2f; /* yellow2 */ +} + +.gruvbox-theme-dark .token.bold { + font-weight: bold; +} + +.gruvbox-theme-dark .token.italic { + font-style: italic; +} + +.gruvbox-theme-dark .token.inserted { + background: #a89984; /* fg4 / gray1 */ +} + +.gruvbox-theme-dark .token.deleted { + background: #fb4934; /* red2 */ +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-B8645DE281A38A3068C56919DE1BB0511696A1EE8002C5088748DA0BAC0806E6.css b/fastn-core/tests/22-http-headers/output/code-theme-B8645DE281A38A3068C56919DE1BB0511696A1EE8002C5088748DA0BAC0806E6.css new file mode 100644 index 0000000000..5943471ef6 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-B8645DE281A38A3068C56919DE1BB0511696A1EE8002C5088748DA0BAC0806E6.css @@ -0,0 +1,210 @@ +code[class*=language-].fastn-theme-light, +pre[class*=language-].fastn-theme-light { + color: #000; + background: 0 0; + text-shadow: 0 1px #fff; + /*font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;*/ + /*font-size: 1em;*/ + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + word-wrap: normal; + /*line-height: 1.5;*/ + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none +} + +code[class*=language-].fastn-theme-light ::-moz-selection, +code[class*=language-].fastn-theme-light::-moz-selection, +pre[class*=language-].fastn-theme-light ::-moz-selection, +pre[class*=language-].fastn-theme-light::-moz-selection { + text-shadow: none; + background: #b3d4fc +} + +code[class*=language-].fastn-theme-light ::selection, +code[class*=language-].fastn-theme-light::selection, +pre[class*=language-].fastn-theme-light ::selection, +pre[class*=language-].fastn-theme-light::selection { + text-shadow: none; + background: #b3d4fc +} + +@media print { + + code[class*=language-].fastn-theme-light, + pre[class*=language-].fastn-theme-light { + text-shadow: none + } +} + +pre[class*=language-].fastn-theme-light { + padding: 1em; + overflow: auto +} + +:not(pre)>code[class*=language-].fastn-theme-light, +pre[class*=language-].fastn-theme-light { + background: #f5f2f0 +} + +:not(pre)>code[class*=language-].fastn-theme-light { + padding: .1em; + border-radius: .3em; + white-space: normal +} + +/* Fastn Language tokens -------------------------------------------------- */ + +.fastn-theme-light .token.section-identifier { + color: #36464e; +} + +.fastn-theme-light .token.section-name { + color: #07a; +} + +.fastn-theme-light .token.section-caption { + color: #1c7d4d; +} + +.fastn-theme-light .token.semi-colon { + color: #696b70; +} + +.fastn-theme-light .token.event { + color: #c46262; +} + +.fastn-theme-light .token.processor { + color: #c46262; +} + +.fastn-theme-light .token.type-modifier { + color: #5c43bd; +} + +.fastn-theme-light .token.value-type { + color: #5c43bd; +} + +.fastn-theme-light .token.kernel-type { + color: #5c43bd; +} + +.fastn-theme-light .token.header-type { + color: #5c43bd; +} + +.fastn-theme-light .token.header-name { + color: #a846b9; +} + +.fastn-theme-light .token.header-condition { + color: #8b3b3b; +} + +.fastn-theme-light .token.header-value { + color: #36464e; +} + +/* END ----------------------------------------------------------------- */ + +.fastn-theme-light .token.cdata, +.fastn-theme-light .token.comment, +.fastn-theme-light .token.doctype, +.fastn-theme-light .token.prolog { + color: #7f93a8 +} + +.fastn-theme-light .token.punctuation { + color: #999 +} + +.fastn-theme-light .token.namespace { + opacity: .7 +} + +.fastn-theme-light .token.boolean, +.fastn-theme-light .token.constant, +.fastn-theme-light .token.deleted, +.fastn-theme-light .token.number, +.fastn-theme-light .token.property, +.fastn-theme-light .token.symbol, +.fastn-theme-light .token.tag { + color: #905 +} + +.fastn-theme-light .token.attr-name, +.fastn-theme-light .token.builtin, +.fastn-theme-light .token.char, +.fastn-theme-light .token.inserted, +.fastn-theme-light .token.selector, +.fastn-theme-light .token.string { + color: #36464e +} + +.fastn-theme-light .token.important, +.fastn-theme-light .token.deliminator { + color: #1c7d4d; +} + +.language-css .fastn-theme-light .token.string, +.style .fastn-theme-light .token.string, +.fastn-theme-light .token.entity, +.fastn-theme-light .token.operator, +.fastn-theme-light .token.url { + color: #9a6e3a; + background: hsla(0, 0%, 100%, .5) +} + +.fastn-theme-light .token.atrule, +.fastn-theme-light .token.attr-value, +.fastn-theme-light .token.keyword { + color: #07a +} + +.fastn-theme-light .token.class-name, +.fastn-theme-light .token.function { + color: #3f6ec6 +} + +.fastn-theme-light .token.important, +.fastn-theme-light .token.regex, +.fastn-theme-light .token.variable { + color: #a846b9 +} + +.fastn-theme-light .token.bold, +.fastn-theme-light .token.important { + font-weight: 700 +} + +.fastn-theme-light .token.italic { + font-style: italic +} + +.fastn-theme-light .token.entity { + cursor: help +} + + +/* Line highlight plugin */ +.fastn-theme-light .line-highlight.line-highlight { + background-color: #87afff33; + box-shadow: inset 2px 0 0 #4387ff +} + +.fastn-theme-light .line-highlight.line-highlight:before, +.fastn-theme-light .line-highlight.line-highlight[data-end]:after { + top: auto; + background-color: #4387ff; + color: #fff; + border-radius: 50%; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-DC76F700474E809F7BA2D9914793D04881B17EA4699BA9C568C83D32A18B0173.css b/fastn-core/tests/22-http-headers/output/code-theme-DC76F700474E809F7BA2D9914793D04881B17EA4699BA9C568C83D32A18B0173.css new file mode 100644 index 0000000000..a94a172385 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-DC76F700474E809F7BA2D9914793D04881B17EA4699BA9C568C83D32A18B0173.css @@ -0,0 +1,281 @@ +/** + * VS Code Dark+ theme by tabuckner (https://github.com/tabuckner) + * Inspired by Visual Studio syntax coloring + */ + + +pre[class*="language-"].vs-theme-dark, +code[class*="language-"].vs-theme-dark { + color: #d4d4d4; + font-size: 13px; + text-shadow: none; + font-family: Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace; + direction: ltr; + text-align: left; + white-space: pre; + word-spacing: normal; + word-break: normal; + line-height: 1.5; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*="language-"].vs-theme-dark::selection, +code[class*="language-"].vs-theme-dark::selection, +pre[class*="language-"].vs-theme-dark *::selection, +code[class*="language-"].vs-theme-dark *::selection { + text-shadow: none; + background: #264F78; +} + +@media print { + pre[class*="language-"].vs-theme-dark, + code[class*="language-"].vs-theme-dark { + text-shadow: none; + } +} + +pre[class*="language-"].vs-theme-dark { + padding: 1em; + margin: .5em 0; + overflow: auto; + background: #1e1e1e; +} + +:not(pre) > code[class*="language-"].vs-theme-dark { + padding: .1em .3em; + border-radius: .3em; + color: #db4c69; + background: #1e1e1e; +} +/********************************************************* +* Tokens +*/ +.namespace { + opacity: .7; +} + +.vs-theme-dark .token.doctype .token.doctype-tag { + color: #569CD6; +} + +.vs-theme-dark .token.doctype .token.name { + color: #9cdcfe; +} + +.vs-theme-dark .token.comment, +.vs-theme-dark .token.prolog { + color: #6a9955; +} + +.vs-theme-dark .token.punctuation, +.language-html .language-css .vs-theme-dark .token.punctuation, +.language-html .language-javascript .vs-theme-dark .token.punctuation { + color: #d4d4d4; +} + +.vs-theme-dark .token.property, +.vs-theme-dark .token.tag, +.vs-theme-dark .token.boolean, +.vs-theme-dark .token.number, +.vs-theme-dark .token.constant, +.vs-theme-dark .token.symbol, +.vs-theme-dark .token.inserted, +.vs-theme-dark .token.unit { + color: #b5cea8; +} + +.vs-theme-dark .token.selector, +.vs-theme-dark .token.attr-name, +.vs-theme-dark .token.string, +.vs-theme-dark .token.char, +.vs-theme-dark .token.builtin, +.vs-theme-dark .token.deleted { + color: #ce9178; +} + +.language-css .vs-theme-dark .token.string.url { + text-decoration: underline; +} + +.vs-theme-dark .token.operator, +.vs-theme-dark .token.entity { + color: #d4d4d4; +} + +.vs-theme-dark .token.operator.arrow { + color: #569CD6; +} + +.vs-theme-dark .token.atrule { + color: #ce9178; +} + +.vs-theme-dark .token.atrule .vs-theme-dark .token.rule { + color: #c586c0; +} + +.vs-theme-dark .token.atrule .vs-theme-dark .token.url { + color: #9cdcfe; +} + +.vs-theme-dark .token.atrule .vs-theme-dark .token.url .vs-theme-dark .token.function { + color: #dcdcaa; +} + +.vs-theme-dark .token.atrule .vs-theme-dark .token.url .vs-theme-dark .token.punctuation { + color: #d4d4d4; +} + +.vs-theme-dark .token.keyword { + color: #569CD6; +} + +.vs-theme-dark .token.keyword.module, +.vs-theme-dark .token.keyword.control-flow { + color: #c586c0; +} + +.vs-theme-dark .token.function, +.vs-theme-dark .token.function .vs-theme-dark .token.maybe-class-name { + color: #dcdcaa; +} + +.vs-theme-dark .token.regex { + color: #d16969; +} + +.vs-theme-dark .token.important { + color: #569cd6; +} + +.vs-theme-dark .token.italic { + font-style: italic; +} + +.vs-theme-dark .token.constant { + color: #9cdcfe; +} + +.vs-theme-dark .token.class-name, +.vs-theme-dark .token.maybe-class-name { + color: #4ec9b0; +} + +.vs-theme-dark .token.console { + color: #9cdcfe; +} + +.vs-theme-dark .token.parameter { + color: #9cdcfe; +} + +.vs-theme-dark .token.interpolation { + color: #9cdcfe; +} + +.vs-theme-dark .token.punctuation.interpolation-punctuation { + color: #569cd6; +} + +.vs-theme-dark .token.boolean { + color: #569cd6; +} + +.vs-theme-dark .token.property, +.vs-theme-dark .token.variable, +.vs-theme-dark .token.imports .vs-theme-dark .token.maybe-class-name, +.vs-theme-dark .token.exports .vs-theme-dark .token.maybe-class-name { + color: #9cdcfe; +} + +.vs-theme-dark .token.selector { + color: #d7ba7d; +} + +.vs-theme-dark .token.escape { + color: #d7ba7d; +} + +.vs-theme-dark .token.tag { + color: #569cd6; +} + +.vs-theme-dark .token.tag .vs-theme-dark .token.punctuation { + color: #808080; +} + +.vs-theme-dark .token.cdata { + color: #808080; +} + +.vs-theme-dark .token.attr-name { + color: #9cdcfe; +} + +.vs-theme-dark .token.attr-value, +.vs-theme-dark .token.attr-value .vs-theme-dark .token.punctuation { + color: #ce9178; +} + +.vs-theme-dark .token.attr-value .vs-theme-dark .token.punctuation.attr-equals { + color: #d4d4d4; +} + +.vs-theme-dark .token.entity { + color: #569cd6; +} + +.vs-theme-dark .token.namespace { + color: #4ec9b0; +} +/********************************************************* +* Language Specific +*/ + +pre[class*="language-javascript"], +code[class*="language-javascript"], +pre[class*="language-jsx"], +code[class*="language-jsx"], +pre[class*="language-typescript"], +code[class*="language-typescript"], +pre[class*="language-tsx"], +code[class*="language-tsx"] { + color: #9cdcfe; +} + +pre[class*="language-css"], +code[class*="language-css"] { + color: #ce9178; +} + +pre[class*="language-html"], +code[class*="language-html"] { + color: #d4d4d4; +} + +.language-regex .vs-theme-dark .token.anchor { + color: #dcdcaa; +} + +.language-html .vs-theme-dark .token.punctuation { + color: #808080; +} +/********************************************************* +* Line highlighting +*/ +pre[class*="language-"].vs-theme-dark > code[class*="language-"].vs-theme-dark { + position: relative; + z-index: 1; +} + +.line-highlight.line-highlight { + background: #f7ebc6; + box-shadow: inset 5px 0 0 #f7d87c; + z-index: 0; +} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-F614177D3155EA8E915B35A3445175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css b/fastn-core/tests/22-http-headers/output/code-theme-F614177D3155EA8E915B35A3445175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css new file mode 100644 index 0000000000..7483c06fc7 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/code-theme-F614177D3155EA8E915B35A3445175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css @@ -0,0 +1,194 @@ +/* + * Based on Plugin: Syntax Highlighter CB + * Plugin URI: http://wp.tutsplus.com/tutorials/plugins/adding-a-syntax-highlighter-shortcode-using-prism-js + * Description: Highlight your code snippets with an easy to use shortcode based on Lea Verou's Prism.js. + * Version: 1.0.0 + * Author: c.bavota + * Author URI: http://bavotasan.comhttp://wp.tutsplus.com/tutorials/plugins/adding-a-syntax-highlighter-shortcode-using-prism-js/ */ +/* http://cbavota.bitbucket.org/syntax-highlighter/ */ + +/* ===== ===== */ +code[class*=language-].fastn-theme-dark, +pre[class*=language-].fastn-theme-dark { + color: #fff; + text-shadow: 0 1px 1px #000; + /*font-family: Menlo, Monaco, "Courier New", monospace;*/ + direction: ltr; + text-align: left; + word-spacing: normal; + white-space: pre; + word-wrap: normal; + /*line-height: 1.4;*/ + background: none; + border: 0; + + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + + -webkit-hyphens: none; + -moz-hyphens: none; + -ms-hyphens: none; + hyphens: none; +} + +pre[class*=language-].fastn-theme-dark code { + float: left; + padding: 0 15px 0 0; +} + +pre[class*=language-].fastn-theme-dark, +:not(pre) > code[class*=language-].fastn-theme-dark { + background: #222; +} + +/* Code blocks */ +pre[class*=language-].fastn-theme-dark { + padding: 15px; + overflow: auto; +} + +/* Inline code */ +:not(pre) > code[class*=language-].fastn-theme-dark { + padding: 5px 10px; + line-height: 1; +} + +/* Fastn Language tokens -------------------------------------------------- */ + +.fastn-theme-dark .token.section-identifier { + color: #d5d7e2; +} + +.fastn-theme-dark .token.section-name { + color: #6791e0; +} + +.fastn-theme-dark .token.section-caption { + color: #2fb170; +} + +.fastn-theme-dark .token.semi-colon { + color: #cecfd2; +} + +.fastn-theme-dark .token.event { + color: #6ae2ff; +} + +.fastn-theme-dark .token.processor { + color: #6ae2ff; +} + +.fastn-theme-dark .token.type-modifier { + color: #54b59e; +} + +.fastn-theme-dark .token.value-type { + color: #54b59e; +} + +.fastn-theme-dark .token.kernel-type { + color: #54b59e; +} + +.fastn-theme-dark .token.header-type { + color: #54b59e; +} + +.fastn-theme-dark .token.header-name { + color: #c973d9; +} + +.fastn-theme-dark .token.header-condition { + color: #9871ff; +} + +.fastn-theme-dark .token.header-value { + color: #d5d7e2; +} + +/* END ----------------------------------------------------------------- */ + +.fastn-theme-dark .token.comment, +.fastn-theme-dark .token.prolog, +.fastn-theme-dark .token.doctype, +.fastn-theme-dark .token.cdata { + color: #d4c8c896; +} + +.fastn-theme-dark .token.selector, +.fastn-theme-dark .token.operator, +.fastn-theme-dark .token.punctuation { + color: #fff; +} + +.fastn-theme-dark .token.namespace { + opacity: .7; +} + +.fastn-theme-dark .token.tag, +.fastn-theme-dark .token.boolean { + color: #ff5cac; +} + +.fastn-theme-dark .token.atrule, +.fastn-theme-dark .token.attr-value, +.fastn-theme-dark .token.hex, +.fastn-theme-dark .token.string { + color: #d5d7e2; +} + +.fastn-theme-dark .token.property, +.fastn-theme-dark .token.entity, +.fastn-theme-dark .token.url, +.fastn-theme-dark .token.attr-name, +.fastn-theme-dark .token.keyword { + color: #ffa05c; +} + +.fastn-theme-dark .token.regex { + color: #c973d9; +} + +.fastn-theme-dark .token.entity { + cursor: help; +} + +.fastn-theme-dark .token.function, +.fastn-theme-dark .token.constant { + color: #6791e0; +} + +.fastn-theme-dark .token.variable { + color: #fdfba8; +} + +.fastn-theme-dark .token.number { + color: #8799B0; +} + +.fastn-theme-dark .token.important, +.fastn-theme-dark .token.deliminator { + color: #2fb170; +} + +/* Line highlight plugin */ +.fastn-theme-dark .line-highlight.line-highlight { + background-color: #0734a533; + box-shadow: inset 2px 0 0 #2a77ff +} + +.fastn-theme-dark .line-highlight.line-highlight:before, +.fastn-theme-dark .line-highlight.line-highlight[data-end]:after { + top: auto; + background-color: #2a77ff; + color: #fff; + border-radius: 50%; +} + +/* for line numbers */ +/* span instead of span:before for a two-toned border */ +.fastn-theme-dark .line-numbers .line-numbers-rows > span { + border-right: 3px #d9d336 solid; +} diff --git a/fastn-core/tests/22-http-headers/output/default-B66C2B8914832538F78C67C1C127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js b/fastn-core/tests/22-http-headers/output/default-B66C2B8914832538F78C67C1C127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js new file mode 100644 index 0000000000..42bd2468ac --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/default-B66C2B8914832538F78C67C1C127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js @@ -0,0 +1,6550 @@ +/* ftd-language.js */ + +Prism.languages.ftd = { + comment: [ + { + pattern: /\/--\s*((?!--)[\S\s])*/g, + greedy: true, + alias: "section-comment", + }, + { + pattern: /[\s]*\/[\w]+(:).*\n/g, + greedy: true, + alias: "header-comment", + }, + { + pattern: /(;;).*\n/g, + greedy: true, + alias: "inline-or-line-comment", + }, + ], + /* + -- [section-type] : [caption] + [header-type]
: [value] + + [block headers] + + [body] -> string + + [children] + + [-- end: ] + */ + string: { + pattern: /^[ \t\n]*--\s+(.*)(\n(?![ \n\t]*--).*)*/g, + inside: { + /* section-identifier */ + "section-identifier": /([ \t\n])*--\s+/g, + /* [section type]
: */ + punctuation: { + pattern: /^(.*):/g, + inside: { + "semi-colon": /:/g, + keyword: /^(component|record|end|or-type)/g, + "value-type": /^(integer|boolean|decimal|string)/g, + "kernel-type": /\s*ftd[\S]+/g, + "type-modifier": { + pattern: /(\s)+list(?=\s)/g, + lookbehind: true, + }, + "section-name": { + pattern: /(\s)*.+/g, + lookbehind: true, + }, + }, + }, + /* section caption */ + "section-caption": /^.+(?=\n)*/g, + /* header name: header value */ + regex: { + pattern: /(?!--\s*).*[:]\s*(.*)(\n)*/g, + inside: { + /* if condition on component */ + "header-condition": /\s*if\s*:(.)+/g, + /* header event */ + event: /\s*\$on(.)+\$(?=:)/g, + /* header processor */ + processor: /\s*\$[^:]+\$(?=:)/g, + /* header name => [header-type] [header-condition] */ + regex: { + pattern: /[^:]+(?=:)/g, + inside: { + /* [header-condition] */ + "header-condition": /if\s*{.+}/g, + /* [header-type] */ + tag: { + pattern: /(.)+(?=if)?/g, + inside: { + "kernel-type": /^\s*ftd[\S]+/g, + "header-type": + /^(record|caption|body|caption or body|body or caption|integer|boolean|decimal|string)/g, + "type-modifier": { + pattern: /(\s)+list(?=\s)/g, + lookbehind: true, + }, + "header-name": { + pattern: /(\s)*(.)+/g, + lookbehind: true, + }, + }, + }, + }, + }, + /* semicolon */ + "semi-colon": /:/g, + /* header value (if any) */ + "header-value": { + pattern: /(\s)*(.+)/g, + lookbehind: true, + }, + }, + }, + }, + }, +}; +/** + * marked v9.1.4 - a markdown parser + * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed) + * https://github.com/markedjs/marked + */ +// Content taken from https://cdn.jsdelivr.net/npm/marked/marked.min.js +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,(function(e){"use strict";function t(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function n(t){e.defaults=t}e.defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};const s=/[&<>"']/,r=new RegExp(s.source,"g"),i=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,l=new RegExp(i.source,"g"),o={"&":"&","<":"<",">":">",'"':""","'":"'"},a=e=>o[e];function c(e,t){if(t){if(s.test(e))return e.replace(r,a)}else if(i.test(e))return e.replace(l,a);return e}const h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;const p=/(^|[^\[])\^/g;function u(e,t){e="string"==typeof e?e:e.source,t=t||"";const n={replace:(t,s)=>(s=(s="object"==typeof s&&"source"in s?s.source:s).replace(p,"$1"),e=e.replace(t,s),n),getRegex:()=>new RegExp(e,t)};return n}function g(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const k={exec:()=>null};function f(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let s=!1,r=t;for(;--r>=0&&"\\"===n[r];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:d(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const s=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=d(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=d(t[0].replace(/^ *>[ \t]?/gm,""),"\n"),n=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const i=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let l="",o="",a=!1;for(;e;){let n=!1;if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;l=t[0],e=e.substring(l.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,o=s.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,o=s.slice(h),h+=t[1].length);let p=!1;if(!s&&/^ *$/.test(c)&&(l+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),r=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),i=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;e;){const a=e.split("\n",1)[0];if(c=a,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),r.test(c))break;if(i.test(c))break;if(t.test(c))break;if(n.test(e))break;if(c.search(/[^ ]/)>=h||!c.trim())o+="\n"+c.slice(h);else{if(p)break;if(s.search(/[^ ]/)>=4)break;if(r.test(s))break;if(i.test(s))break;if(n.test(s))break;o+="\n"+c}p||c.trim()||(p=!0),l+=a+"\n",e=e.substring(a.length+1),s=c.slice(h)}}r.loose||(a?r.loose=!0:/\n *\n *$/.test(l)&&(a=!0));let u,g=null;this.options.gfm&&(g=/^\[[ xX]\] /.exec(o),g&&(u="[ ] "!==g[0],o=o.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:l,task:!!g,checked:u,loose:!1,text:o,tokens:[]}),r.raw+=l}r.items[r.items.length-1].raw=l.trimEnd(),r.items[r.items.length-1].text=o.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(t){if(!/[:|]/.test(t[2]))return;const e={type:"table",raw:t[0],header:f(t[1]).map((e=>({text:e,tokens:[]}))),align:t[2].replace(/^\||\| *$/g,"").split("|"),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){let t,n,s,r,i=e.align.length;for(t=0;t({text:e,tokens:[]})));for(i=e.header.length,n=0;n/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^$/.test(e))return;const t=d(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let s=0;s-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^$/.test(e)?n.slice(1):n.slice(1,-1)),x(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return x(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrong.lDelim.exec(e);if(!s)return;if(s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let r,i,l=n,o=0;const a="*"===s[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+s[0].length-1);null!=(s=a.exec(t));){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(i=[...r].length,s[3]||s[4]){l+=i;continue}if((s[5]||s[6])&&n%3&&!((n+i)%3)){o+=i;continue}if(l-=i,l>0)continue;i=Math.min(i,i+l+o);const t=[...e].slice(0,n+s.index+i+1).join("");if(Math.min(n,i)%2){const e=t.slice(1,-1);return{type:"em",raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}const a=t.slice(2,-2);return{type:"strong",raw:t,text:a,tokens:this.lexer.inlineTokens(a)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return n&&s&&(e=e.substring(1,e.length-1)),e=c(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=c(t[1]),n="mailto:"+e):(e=c(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=c(t[0]),n="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])[0]}while(s!==t[0]);e=c(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:c(t[0]),{type:"text",raw:t[0],text:e}}}}const m={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:k,lheading:/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};m.def=u(m.def).replace("label",m._label).replace("title",m._title).getRegex(),m.bullet=/(?:[*+-]|\d{1,9}[.)])/,m.listItemStart=u(/^( *)(bull) */).replace("bull",m.bullet).getRegex(),m.list=u(m.list).replace(/bull/g,m.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+m.def.source+")").getRegex(),m._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",m._comment=/|$)/,m.html=u(m.html,"i").replace("comment",m._comment).replace("tag",m._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),m.lheading=u(m.lheading).replace(/bull/g,m.bullet).getRegex(),m.paragraph=u(m._paragraph).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.blockquote=u(m.blockquote).replace("paragraph",m.paragraph).getRegex(),m.normal={...m},m.gfm={...m.normal,table:"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"},m.gfm.table=u(m.gfm.table).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.gfm.paragraph=u(m._paragraph).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",m.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.pedantic={...m.normal,html:u("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",m._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:k,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(m.normal._paragraph).replace("hr",m.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",m.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const w={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:k,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:k,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`^|~"};w.punctuation=u(w.punctuation,"u").replace(/punctuation/g,w._punctuation).getRegex(),w.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,w.anyPunctuation=/\\[punct]/g,w._escapes=/\\([punct])/g,w._comment=u(m._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),w.emStrong.lDelim=u(w.emStrong.lDelim,"u").replace(/punct/g,w._punctuation).getRegex(),w.emStrong.rDelimAst=u(w.emStrong.rDelimAst,"gu").replace(/punct/g,w._punctuation).getRegex(),w.emStrong.rDelimUnd=u(w.emStrong.rDelimUnd,"gu").replace(/punct/g,w._punctuation).getRegex(),w.anyPunctuation=u(w.anyPunctuation,"gu").replace(/punct/g,w._punctuation).getRegex(),w._escapes=u(w._escapes,"gu").replace(/punct/g,w._punctuation).getRegex(),w._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,w._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,w.autolink=u(w.autolink).replace("scheme",w._scheme).replace("email",w._email).getRegex(),w._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,w.tag=u(w.tag).replace("comment",w._comment).replace("attribute",w._attribute).getRegex(),w._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,w._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,w._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,w.link=u(w.link).replace("label",w._label).replace("href",w._href).replace("title",w._title).getRegex(),w.reflink=u(w.reflink).replace("label",w._label).replace("ref",m._label).getRegex(),w.nolink=u(w.nolink).replace("ref",m._label).getRegex(),w.reflinkSearch=u(w.reflinkSearch,"g").replace("reflink",w.reflink).replace("nolink",w.nolink).getRegex(),w.normal={...w},w.pedantic={...w.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",w._label).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",w._label).getRegex()},w.gfm={...w.normal,escape:u(w.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(n):(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(s.raw+="\n"+n.raw,s.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(r=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r)))s=t[t.length-1],i&&"paragraph"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),i=r.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,r,i,l,o,a=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(a));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(a));)a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(a));)a=a.slice(0,i.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(o=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,a,o))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(r=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),l=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class y{options;constructor(t){this.options=t||e.defaults}code(e,t,n){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'
'+(n?e:c(e,!0))+"
\n":"
"+(n?e:c(e,!0))+"
\n"}blockquote(e){return`
\n${e}
\n`}html(e,t){return e}heading(e,t,n){return`${e}\n`}hr(){return"
\n"}list(e,t,n){const s=t?"ol":"ul";return"<"+s+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"}listitem(e,t,n){return`
  • ${e}
  • \n`}checkbox(e){return"'}paragraph(e){return`

    ${e}

    \n`}table(e,t){return t&&(t=`${t}`),"\n\n"+e+"\n"+t+"
    \n"}tablerow(e){return`\n${e}\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`\n`}strong(e){return`${e}`}em(e){return`${e}`}codespan(e){return`${e}`}br(){return"
    "}del(e){return`${e}`}link(e,t,n){const s=g(e);if(null===s)return n;let r='",r}image(e,t,n){const s=g(e);if(null===s)return n;let r=`${n}"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")));continue}case"code":{const e=r;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=r;let t="",s="";for(let t=0;t0&&"paragraph"===n.tokens[0].type?(n.tokens[0].text=e+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&"text"===n.tokens[0].tokens[0].type&&(n.tokens[0].tokens[0].text=e+" "+n.tokens[0].tokens[0].text)):n.tokens.unshift({type:"text",text:e+" "}):o+=e+" "}o+=this.parse(n.tokens,i),l+=this.renderer.listitem(o,r,!!s)}n+=this.renderer.list(l,t,s);continue}case"html":{const e=r;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=r;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let i=r,l=i.tokens?this.parseInline(i.tokens):i.text;for(;s+1{n=n.concat(this.walkTokens(e[s],t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=n.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new y(this.defaults);for(const n in e.renderer){const s=e.renderer[n],r=n,i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new b(this.defaults);for(const n in e.tokenizer){const s=e.tokenizer[n],r=n,i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new T;for(const n in e.hooks){const s=e.hooks[n],r=n,i=t[r];T.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(s.call(t,e)).then((e=>i.call(t,e)));const n=s.call(t,e);return i.call(t,n)}:t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(s.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}#e(e,t){return(n,s)=>{const r={...s},i={...this.defaults,...r};!0===this.defaults.async&&!1===r.async&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const l=this.#t(!!i.silent,!!i.async);if(null==n)return l(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then((t=>e(t,i))).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>t(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(l);try{i.hooks&&(n=i.hooks.preprocess(n));const s=e(n,i);i.walkTokens&&this.walkTokens(s,i.walkTokens);let r=t(s,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return l(e)}}}#t(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="

    An error occurred:

    "+c(n.message+"",!0)+"
    ";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}}const S=new R;function A(e,t){return S.parse(e,t)}A.options=A.setOptions=function(e){return S.setOptions(e),A.defaults=S.defaults,n(A.defaults),A},A.getDefaults=t,A.defaults=e.defaults,A.use=function(...e){return S.use(...e),A.defaults=S.defaults,n(A.defaults),A},A.walkTokens=function(e,t){return S.walkTokens(e,t)},A.parseInline=S.parseInline,A.Parser=z,A.parser=z.parse,A.Renderer=y,A.TextRenderer=$,A.Lexer=_,A.lexer=_.lex,A.Tokenizer=b,A.Hooks=T,A.parse=A;const I=A.options,E=A.setOptions,Z=A.use,q=A.walkTokens,L=A.parseInline,D=A,P=z.parse,v=_.lex;e.Hooks=T,e.Lexer=_,e.Marked=R,e.Parser=z,e.Renderer=y,e.TextRenderer=$,e.Tokenizer=b,e.getDefaults=t,e.lexer=v,e.marked=A,e.options=I,e.parse=D,e.parseInline=L,e.parser=P,e.setOptions=E,e.use=Z,e.walkTokens=q})); +const fastn = (function (fastn) { + class Closure { + #cached_value; + #node; + #property; + #formula; + #inherited; + constructor(func, execute = true) { + if (execute) { + this.#cached_value = func(); + } + this.#formula = func; + } + + get() { + return this.#cached_value; + } + getFormula() { + return this.#formula; + } + addNodeProperty(node, property, inherited) { + this.#node = node; + this.#property = property; + this.#inherited = inherited; + this.updateUi(); + + return this; + } + update() { + this.#cached_value = this.#formula(); + this.updateUi(); + } + getNode() { + return this.#node; + } + updateUi() { + if ( + !this.#node || + this.#property === null || + this.#property === undefined || + !this.#node.getNode() + ) { + return; + } + + this.#node.setStaticProperty( + this.#property, + this.#cached_value, + this.#inherited, + ); + } + } + + class Mutable { + #value; + #old_closure; + #closures; + #closureInstance; + constructor(val) { + this.#value = null; + this.#old_closure = null; + this.#closures = []; + this.#closureInstance = fastn.closure(() => + this.#closures.forEach((closure) => closure.update()), + ); + this.set(val); + } + get(key) { + if ( + !fastn_utils.isNull(key) && + (this.#value instanceof RecordInstance || + this.#value instanceof MutableList || + this.#value instanceof Mutable) + ) { + return this.#value.get(key); + } + return this.#value; + } + setWithoutUpdate(value) { + if (this.#old_closure) { + this.#value.removeClosure(this.#old_closure); + } + + if (this.#value instanceof RecordInstance) { + // this.#value.replace(value); will replace the record type + // variable instance created which we don't want. + // color: red + // color if { something }: $orange-green + // The `this.#value.replace(value);` will replace the value of + // `orange-green` with `{light: red, dark: red}` + this.#value = value; + } else { + this.#value = value; + } + + if (this.#value instanceof Mutable) { + this.#old_closure = fastn.closureWithoutExecute(() => + this.#closureInstance.update(), + ); + this.#value.addClosure(this.#old_closure); + } else { + this.#old_closure = null; + } + } + set(value) { + this.setWithoutUpdate(value); + + this.#closureInstance.update(); + } + // we have to unlink all nodes, else they will be kept in memory after the node is removed from DOM + unlinkNode(node) { + this.#closures = this.#closures.filter( + (closure) => closure.getNode() !== node, + ); + } + addClosure(closure) { + this.#closures.push(closure); + } + removeClosure(closure) { + this.#closures = this.#closures.filter((c) => c !== closure); + } + equalMutable(other) { + if (!fastn_utils.deepEqual(this.get(), other.get())) { + return false; + } + const thisClosures = this.#closures; + const otherClosures = other.#closures; + + return thisClosures === otherClosures; + } + getClone() { + return new Mutable(fastn_utils.clone(this.#value)); + } + } + + class Proxy { + #differentiator; + #cached_value; + #closures; + #closureInstance; + constructor(targets, differentiator) { + this.#differentiator = differentiator; + this.#cached_value = this.#differentiator().get(); + this.#closures = []; + + let proxy = this; + for (let idx in targets) { + targets[idx].addClosure( + new Closure(function () { + proxy.update(); + proxy.#closures.forEach((closure) => closure.update()); + }), + ); + targets[idx].addClosure(this); + } + } + addClosure(closure) { + this.#closures.push(closure); + } + removeClosure(closure) { + this.#closures = this.#closures.filter((c) => c !== closure); + } + update() { + this.#cached_value = this.#differentiator().get(); + } + get(key) { + if ( + !!key && + (this.#cached_value instanceof RecordInstance || + this.#cached_value instanceof MutableList || + this.#cached_value instanceof Mutable) + ) { + return this.#cached_value.get(key); + } + return this.#cached_value; + } + set(value) { + // Todo: Optimization removed. Reuse optimization later again + /*if (fastn_utils.deepEqual(this.#cached_value, value)) { + return; + }*/ + this.#differentiator().set(value); + } + } + + class MutableList { + #list; + #watchers; + #closures; + constructor(list) { + this.#list = []; + for (let idx in list) { + this.#list.push({ + item: fastn.wrapMutable(list[idx]), + index: new Mutable(parseInt(idx)), + }); + } + this.#watchers = []; + this.#closures = []; + } + addClosure(closure) { + this.#closures.push(closure); + } + unlinkNode(node) { + this.#closures = this.#closures.filter( + (closure) => closure.getNode() !== node, + ); + } + forLoop(root, dom_constructor) { + let l = fastn_dom.forLoop(root, dom_constructor, this); + this.#watchers.push(l); + return l; + } + getList() { + return this.#list; + } + getLength() { + return this.#list.length; + } + get(idx) { + if (fastn_utils.isNull(idx)) { + return this.getList(); + } + return this.#list[idx]; + } + set(index, value) { + if (value === undefined) { + value = index; + if (!(value instanceof MutableList)) { + if (!Array.isArray(value)) { + value = [value]; + } + value = new MutableList(value); + } + + let list = value.#list; + this.#list = []; + for (let i in list) { + this.#list.push(list[i]); + } + + for (let i in this.#watchers) { + this.#watchers[i].createAllNode(); + } + } else { + index = fastn_utils.getFlattenStaticValue(index); + this.#list[index].item.set(value); + } + + this.#closures.forEach((closure) => closure.update()); + } + insertAt(index, value) { + index = fastn_utils.getFlattenStaticValue(index); + let mutable = fastn.wrapMutable(value); + this.#list.splice(index, 0, { + item: mutable, + index: new Mutable(index), + }); + // for every item after the inserted item, update the index + for (let i = index + 1; i < this.#list.length; i++) { + this.#list[i].index.set(i); + } + + for (let i in this.#watchers) { + this.#watchers[i].createNode(index); + } + this.#closures.forEach((closure) => closure.update()); + } + push(value) { + this.insertAt(this.#list.length, value); + } + deleteAt(index) { + index = fastn_utils.getFlattenStaticValue(index); + this.#list.splice(index, 1); + // for every item after the deleted item, update the index + for (let i = index; i < this.#list.length; i++) { + this.#list[i].index.set(i); + } + + for (let i in this.#watchers) { + let forLoop = this.#watchers[i]; + forLoop.deleteNode(index); + } + this.#closures.forEach((closure) => closure.update()); + } + clearAll() { + this.#list = []; + for (let i in this.#watchers) { + this.#watchers[i].deleteAllNode(); + } + this.#closures.forEach((closure) => closure.update()); + } + pop() { + this.deleteAt(this.#list.length - 1); + } + getClone() { + let current_list = this.#list; + let new_list = []; + for (let idx in current_list) { + new_list.push(fastn_utils.clone(current_list[idx].item)); + } + return new MutableList(new_list); + } + } + + fastn.mutable = function (val) { + return new Mutable(val); + }; + + fastn.closure = function (func) { + return new Closure(func); + }; + + fastn.closureWithoutExecute = function (func) { + return new Closure(func, false); + }; + + fastn.formula = function (deps, func) { + let closure = fastn.closure(func); + let mutable = new Mutable(closure.get()); + for (let idx in deps) { + if (fastn_utils.isNull(deps[idx]) || !deps[idx].addClosure) { + continue; + } + deps[idx].addClosure( + new Closure(function () { + closure.update(); + mutable.set(closure.get()); + }), + ); + } + + return mutable; + }; + + fastn.proxy = function (targets, differentiator) { + return new Proxy(targets, differentiator); + }; + + fastn.wrapMutable = function (obj) { + if ( + !(obj instanceof Mutable) && + !(obj instanceof RecordInstance) && + !(obj instanceof MutableList) + ) { + obj = new Mutable(obj); + } + return obj; + }; + + fastn.mutableList = function (list) { + return new MutableList(list); + }; + + class RecordInstance { + #fields; + #closures; + constructor(obj) { + this.#fields = {}; + this.#closures = []; + + for (let key in obj) { + if (obj[key] instanceof fastn.mutableClass) { + this.#fields[key] = fastn.mutable(null); + this.#fields[key].setWithoutUpdate(obj[key]); + } else { + this.#fields[key] = fastn.mutable(obj[key]); + } + } + } + getAllFields() { + return this.#fields; + } + getClonedFields() { + let clonedFields = {}; + for (let key in this.#fields) { + let field_value = this.#fields[key]; + if ( + field_value instanceof fastn.recordInstanceClass || + field_value instanceof fastn.mutableClass || + field_value instanceof fastn.mutableListClass + ) { + clonedFields[key] = this.#fields[key].getClone(); + } else { + clonedFields[key] = this.#fields[key]; + } + } + return clonedFields; + } + addClosure(closure) { + this.#closures.push(closure); + } + unlinkNode(node) { + this.#closures = this.#closures.filter( + (closure) => closure.getNode() !== node, + ); + } + get(key) { + return this.#fields[key]; + } + set(key, value) { + if (value === undefined) { + value = key; + if (!(value instanceof RecordInstance)) { + value = new RecordInstance(value); + } + + let fields = {}; + for (let key in value.#fields) { + fields[key] = value.#fields[key]; + } + + this.#fields = fields; + } else if (this.#fields[key] === undefined) { + this.#fields[key] = fastn.mutable(null); + this.#fields[key].setWithoutUpdate(value); + } else { + this.#fields[key].set(value); + } + this.#closures.forEach((closure) => closure.update()); + } + setAndReturn(key, value) { + this.set(key, value); + return this; + } + replace(obj) { + for (let key in this.#fields) { + if (!(key in obj.#fields)) { + throw new Error( + "RecordInstance.replace: key " + + key + + " not present in new object", + ); + } + this.#fields[key] = fastn.wrapMutable(obj.#fields[key]); + } + this.#closures.forEach((closure) => closure.update()); + } + toObject() { + return Object.fromEntries( + Object.entries(this.#fields).map(([key, value]) => [ + key, + fastn_utils.getFlattenStaticValue(value), + ]), + ); + } + getClone() { + let current_fields = this.#fields; + let cloned_fields = {}; + for (let key in current_fields) { + let value = fastn_utils.clone(current_fields[key]); + if (value instanceof fastn.mutableClass) { + value = value.get(); + } + cloned_fields[key] = value; + } + return new RecordInstance(cloned_fields); + } + } + + class Module { + #name; + #global; + constructor(name, global) { + this.#name = name; + this.#global = global; + } + + getName() { + return this.#name; + } + + get(function_name) { + return this.#global[`${this.#name}__${function_name}`]; + } + } + + fastn.recordInstance = function (obj) { + return new RecordInstance(obj); + }; + + fastn.color = function (r, g, b) { + return `rgb(${r},${g},${b})`; + }; + + fastn.mutableClass = Mutable; + fastn.mutableListClass = MutableList; + fastn.recordInstanceClass = RecordInstance; + fastn.module = function (name, global) { + return new Module(name, global); + }; + fastn.moduleClass = Module; + + return fastn; +})({}); +let fastn_dom = {}; + +fastn_dom.styleClasses = ""; + +fastn_dom.InternalClass = { + FT_COLUMN: "ft_column", + FT_ROW: "ft_row", + FT_FULL_SIZE: "ft_full_size", +}; + +fastn_dom.codeData = { + availableThemes: {}, + addedCssFile: [], +}; + +fastn_dom.externalCss = new Set(); +fastn_dom.externalJs = new Set(); + +// Todo: Object (key, value) pair (counter type key) +fastn_dom.webComponent = []; + +fastn_dom.commentNode = "comment"; +fastn_dom.wrapperNode = "wrapper"; +fastn_dom.commentMessage = "***FASTN***"; +fastn_dom.webComponentArgument = "args"; + +fastn_dom.classes = {}; +fastn_dom.unsanitised_classes = {}; +fastn_dom.class_count = 0; +fastn_dom.propertyMap = { + "align-items": "ali", + "align-self": "as", + "background-color": "bgc", + "background-image": "bgi", + "background-position": "bgp", + "background-repeat": "bgr", + "background-size": "bgs", + "border-bottom-color": "bbc", + "border-bottom-left-radius": "bblr", + "border-bottom-right-radius": "bbrr", + "border-bottom-style": "bbs", + "border-bottom-width": "bbw", + "border-color": "bc", + "border-left-color": "blc", + "border-left-style": "bls", + "border-left-width": "blw", + "border-radius": "br", + "border-right-color": "brc", + "border-right-style": "brs", + "border-right-width": "brw", + "border-style": "bs", + "border-top-color": "btc", + "border-top-left-radius": "btlr", + "border-top-right-radius": "btrr", + "border-top-style": "bts", + "border-top-width": "btw", + "border-width": "bw", + bottom: "b", + color: "c", + shadow: "sh", + "text-shadow": "tsh", + cursor: "cur", + display: "d", + "flex-wrap": "fw", + "font-style": "fst", + "font-weight": "fwt", + gap: "g", + height: "h", + "justify-content": "jc", + left: "l", + link: "lk", + "link-color": "lkc", + margin: "m", + "margin-bottom": "mb", + "margin-horizontal": "mh", + "margin-left": "ml", + "margin-right": "mr", + "margin-top": "mt", + "margin-vertical": "mv", + "max-height": "mxh", + "max-width": "mxw", + "min-height": "mnh", + "min-width": "mnw", + opacity: "op", + overflow: "o", + "overflow-x": "ox", + "overflow-y": "oy", + "object-fit": "of", + padding: "p", + "padding-bottom": "pb", + "padding-horizontal": "ph", + "padding-left": "pl", + "padding-right": "pr", + "padding-top": "pt", + "padding-vertical": "pv", + position: "pos", + resize: "res", + role: "rl", + right: "r", + sticky: "s", + "text-align": "ta", + "text-decoration": "td", + "text-transform": "tt", + top: "t", + width: "w", + "z-index": "z", + "-webkit-box-orient": "wbo", + "-webkit-line-clamp": "wlc", + "backdrop-filter": "bdf", + "mask-image": "mi", + "-webkit-mask-image": "wmi", + "mask-size": "ms", + "-webkit-mask-size": "wms", + "mask-repeat": "mre", + "-webkit-mask-repeat": "wmre", + "mask-position": "mp", + "-webkit-mask-position": "wmp", + "fetch-priority": "ftp", +}; + +// dynamic-class-css.md +fastn_dom.getClassesAsString = function () { + return ``; +}; + +fastn_dom.getClassesAsStringWithoutStyleTag = function () { + let classes = Object.entries(fastn_dom.classes).map((entry) => { + return getClassAsString(entry[0], entry[1]); + }); + + /*.ft_text { + padding: 0; + }*/ + return classes.join("\n\t"); +}; + +function getClassAsString(className, obj) { + if (typeof obj.value === "object" && obj.value !== null) { + let value = ""; + for (let key in obj.value) { + if (obj.value[key] === undefined || obj.value[key] === null) { + continue; + } + value = `${value} ${key}: ${obj.value[key]}${ + key === "color" ? " !important" : "" + };`; + } + return `${className} { ${value} }`; + } else { + return `${className} { ${obj.property}: ${obj.value}${ + obj.property === "color" ? " !important" : "" + }; }`; + } +} + +fastn_dom.ElementKind = { + Row: 0, + Column: 1, + Integer: 2, + Decimal: 3, + Boolean: 4, + Text: 5, + Image: 6, + IFrame: 7, + // To create parent for dynamic DOM + Comment: 8, + CheckBox: 9, + TextInput: 10, + ContainerElement: 11, + Rive: 12, + Document: 13, + Wrapper: 14, + Code: 15, + // Note: This is called internally, it gives `code` as tagName. This is used + // along with the Code: 15. + CodeChild: 16, + // Note: 'arguments' cant be used as function parameter name bcoz it has + // internal usage in js functions. + WebComponent: (webcomponent, args) => { + return [17, [webcomponent, args]]; + }, + Video: 18, +}; + +fastn_dom.PropertyKind = { + Color: 0, + IntegerValue: 1, + StringValue: 2, + DecimalValue: 3, + BooleanValue: 4, + Width: 5, + Padding: 6, + Height: 7, + Id: 8, + BorderWidth: 9, + BorderStyle: 10, + Margin: 11, + Background: 12, + PaddingHorizontal: 13, + PaddingVertical: 14, + PaddingLeft: 15, + PaddingRight: 16, + PaddingTop: 17, + PaddingBottom: 18, + MarginHorizontal: 19, + MarginVertical: 20, + MarginLeft: 21, + MarginRight: 22, + MarginTop: 23, + MarginBottom: 24, + Role: 25, + ZIndex: 26, + Sticky: 27, + Top: 28, + Bottom: 29, + Left: 30, + Right: 31, + Overflow: 32, + OverflowX: 33, + OverflowY: 34, + Spacing: 35, + Wrap: 36, + TextTransform: 37, + TextIndent: 38, + TextAlign: 39, + LineClamp: 40, + Opacity: 41, + Cursor: 42, + Resize: 43, + MinHeight: 44, + MaxHeight: 45, + MinWidth: 46, + MaxWidth: 47, + WhiteSpace: 48, + BorderTopWidth: 49, + BorderBottomWidth: 50, + BorderLeftWidth: 51, + BorderRightWidth: 52, + BorderRadius: 53, + BorderTopLeftRadius: 54, + BorderTopRightRadius: 55, + BorderBottomLeftRadius: 56, + BorderBottomRightRadius: 57, + BorderStyleVertical: 58, + BorderStyleHorizontal: 59, + BorderLeftStyle: 60, + BorderRightStyle: 61, + BorderTopStyle: 62, + BorderBottomStyle: 63, + BorderColor: 64, + BorderLeftColor: 65, + BorderRightColor: 66, + BorderTopColor: 67, + BorderBottomColor: 68, + AlignSelf: 69, + Classes: 70, + Anchor: 71, + Link: 72, + Children: 73, + OpenInNewTab: 74, + TextStyle: 75, + Region: 76, + AlignContent: 77, + Display: 78, + Checked: 79, + Enabled: 80, + TextInputType: 81, + Placeholder: 82, + Multiline: 83, + DefaultTextInputValue: 84, + Loading: 85, + Src: 86, + YoutubeSrc: 87, + Code: 88, + ImageSrc: 89, + Alt: 90, + DocumentProperties: { + MetaTitle: 91, + MetaOGTitle: 92, + MetaTwitterTitle: 93, + MetaDescription: 94, + MetaOGDescription: 95, + MetaTwitterDescription: 96, + MetaOGImage: 97, + MetaTwitterImage: 98, + MetaThemeColor: 99, + MetaFacebookDomainVerification: 123, + }, + Shadow: 100, + CodeTheme: 101, + CodeLanguage: 102, + CodeShowLineNumber: 103, + Css: 104, + Js: 105, + LinkRel: 106, + InputMaxLength: 107, + Favicon: 108, + Fit: 109, + VideoSrc: 110, + Autoplay: 111, + Poster: 112, + LoopVideo: 113, + Controls: 114, + Muted: 115, + LinkColor: 116, + TextShadow: 117, + Selectable: 118, + BackdropFilter: 119, + Mask: 120, + TextInputValue: 121, + FetchPriority: 122, +}; + +fastn_dom.Loading = { + Lazy: "lazy", + Eager: "eager", +}; + +fastn_dom.LinkRel = { + NoFollow: "nofollow", + Sponsored: "sponsored", + Ugc: "ugc", +}; + +fastn_dom.TextInputType = { + Text: "text", + Email: "email", + Password: "password", + Url: "url", + DateTime: "datetime", + Date: "date", + Time: "time", + Month: "month", + Week: "week", + Color: "color", + File: "file", +}; + +fastn_dom.AlignContent = { + TopLeft: "top-left", + TopCenter: "top-center", + TopRight: "top-right", + Right: "right", + Left: "left", + Center: "center", + BottomLeft: "bottom-left", + BottomRight: "bottom-right", + BottomCenter: "bottom-center", +}; + +fastn_dom.Region = { + H1: "h1", + H2: "h2", + H3: "h3", + H4: "h4", + H5: "h5", + H6: "h6", +}; + +fastn_dom.Anchor = { + Window: [1, "fixed"], + Parent: [2, "absolute"], + Id: (value) => { + return [3, value]; + }, +}; + +fastn_dom.DeviceData = { + Desktop: "desktop", + Mobile: "mobile", +}; + +fastn_dom.TextStyle = { + Underline: "underline", + Italic: "italic", + Strike: "line-through", + Heavy: "900", + Extrabold: "800", + Bold: "700", + SemiBold: "600", + Medium: "500", + Regular: "400", + Light: "300", + ExtraLight: "200", + Hairline: "100", +}; + +fastn_dom.Resizing = { + FillContainer: "100%", + HugContent: "fit-content", + Auto: "auto", + Fixed: (value) => { + return value; + }, +}; + +fastn_dom.Spacing = { + SpaceEvenly: [1, "space-evenly"], + SpaceBetween: [2, "space-between"], + SpaceAround: [3, "space-around"], + Fixed: (value) => { + return [4, value]; + }, +}; + +fastn_dom.BorderStyle = { + Solid: "solid", + Dashed: "dashed", + Dotted: "dotted", + Double: "double", + Ridge: "ridge", + Groove: "groove", + Inset: "inset", + Outset: "outset", +}; + +fastn_dom.Fit = { + none: "none", + fill: "fill", + contain: "contain", + cover: "cover", + scaleDown: "scale-down", +}; + +fastn_dom.FetchPriority = { + auto: "auto", + high: "high", + low: "low", +}; + +fastn_dom.Overflow = { + Scroll: "scroll", + Visible: "visible", + Hidden: "hidden", + Auto: "auto", +}; + +fastn_dom.Display = { + Block: "block", + Inline: "inline", + InlineBlock: "inline-block", +}; + +fastn_dom.AlignSelf = { + Start: "start", + Center: "center", + End: "end", +}; + +fastn_dom.TextTransform = { + None: "none", + Capitalize: "capitalize", + Uppercase: "uppercase", + Lowercase: "lowercase", + Inherit: "inherit", + Initial: "initial", +}; + +fastn_dom.TextAlign = { + Start: "start", + Center: "center", + End: "end", + Justify: "justify", +}; + +fastn_dom.Cursor = { + None: "none", + Default: "default", + ContextMenu: "context-menu", + Help: "help", + Pointer: "pointer", + Progress: "progress", + Wait: "wait", + Cell: "cell", + CrossHair: "crosshair", + Text: "text", + VerticalText: "vertical-text", + Alias: "alias", + Copy: "copy", + Move: "move", + NoDrop: "no-drop", + NotAllowed: "not-allowed", + Grab: "grab", + Grabbing: "grabbing", + EResize: "e-resize", + NResize: "n-resize", + NeResize: "ne-resize", + SResize: "s-resize", + SeResize: "se-resize", + SwResize: "sw-resize", + Wresize: "w-resize", + Ewresize: "ew-resize", + NsResize: "ns-resize", + NeswResize: "nesw-resize", + NwseResize: "nwse-resize", + ColResize: "col-resize", + RowResize: "row-resize", + AllScroll: "all-scroll", + ZoomIn: "zoom-in", + ZoomOut: "zoom-out", +}; + +fastn_dom.Resize = { + Vertical: "vertical", + Horizontal: "horizontal", + Both: "both", +}; + +fastn_dom.WhiteSpace = { + Normal: "normal", + NoWrap: "nowrap", + Pre: "pre", + PreLine: "pre-line", + PreWrap: "pre-wrap", + BreakSpaces: "break-spaces", +}; + +fastn_dom.BackdropFilter = { + Blur: (value) => { + return [1, value]; + }, + Brightness: (value) => { + return [2, value]; + }, + Contrast: (value) => { + return [3, value]; + }, + Grayscale: (value) => { + return [4, value]; + }, + Invert: (value) => { + return [5, value]; + }, + Opacity: (value) => { + return [6, value]; + }, + Sepia: (value) => { + return [7, value]; + }, + Saturate: (value) => { + return [8, value]; + }, + Multi: (value) => { + return [9, value]; + }, +}; + +fastn_dom.BackgroundStyle = { + Solid: (value) => { + return [1, value]; + }, + Image: (value) => { + return [2, value]; + }, + LinearGradient: (value) => { + return [3, value]; + }, +}; + +fastn_dom.BackgroundRepeat = { + Repeat: "repeat", + RepeatX: "repeat-x", + RepeatY: "repeat-y", + NoRepeat: "no-repeat", + Space: "space", + Round: "round", +}; + +fastn_dom.BackgroundSize = { + Auto: "auto", + Cover: "cover", + Contain: "contain", + Length: (value) => { + return value; + }, +}; + +fastn_dom.BackgroundPosition = { + Left: "left", + Right: "right", + Center: "center", + LeftTop: "left top", + LeftCenter: "left center", + LeftBottom: "left bottom", + CenterTop: "center top", + CenterCenter: "center center", + CenterBottom: "center bottom", + RightTop: "right top", + RightCenter: "right center", + RightBottom: "right bottom", + Length: (value) => { + return value; + }, +}; + +fastn_dom.LinearGradientDirection = { + Angle: (value) => { + return `${value}deg`; + }, + Turn: (value) => { + return `${value}turn`; + }, + Left: "270deg", + Right: "90deg", + Top: "0deg", + Bottom: "180deg", + TopLeft: "315deg", + TopRight: "45deg", + BottomLeft: "225deg", + BottomRight: "135deg", +}; + +fastn_dom.FontSize = { + Px: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${value.get()}px`; + }); + } + return `${value}px`; + }, + Em: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${value.get()}em`; + }); + } + return `${value}em`; + }, + Rem: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${value.get()}rem`; + }); + } + return `${value}rem`; + }, +}; + +fastn_dom.Length = { + Px: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}px`; + }); + } + return `${value}px`; + }, + Em: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}em`; + }); + } + return `${value}em`; + }, + Rem: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}rem`; + }); + } + return `${value}rem`; + }, + Percent: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}%`; + }); + } + return `${value}%`; + }, + Calc: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `calc(${fastn_utils.getStaticValue(value)})`; + }); + } + return `calc(${value})`; + }, + Vh: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}vh`; + }); + } + return `${value}vh`; + }, + Vw: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}vw`; + }); + } + return `${value}vw`; + }, + Dvh: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}dvh`; + }); + } + return `${value}dvh`; + }, + Lvh: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}lvh`; + }); + } + return `${value}lvh`; + }, + Svh: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}svh`; + }); + } + return `${value}svh`; + }, + + Vmin: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}vmin`; + }); + } + return `${value}vmin`; + }, + Vmax: (value) => { + if (value instanceof fastn.mutableClass) { + return fastn.formula([value], function () { + return `${fastn_utils.getStaticValue(value)}vmax`; + }); + } + return `${value}vmax`; + }, + Responsive: (length) => { + return new PropertyValueAsClosure(() => { + if (ftd.device.get() === "desktop") { + return length.get("desktop"); + } else { + let mobile = length.get("mobile"); + let desktop = length.get("desktop"); + return mobile ? mobile : desktop; + } + }, [ftd.device, length]); + }, +}; + +fastn_dom.Mask = { + Image: (value) => { + return [1, value]; + }, + Multi: (value) => { + return [2, value]; + }, +}; + +fastn_dom.MaskSize = { + Auto: "auto", + Cover: "cover", + Contain: "contain", + Fixed: (value) => { + return value; + }, +}; + +fastn_dom.MaskRepeat = { + Repeat: "repeat", + RepeatX: "repeat-x", + RepeatY: "repeat-y", + NoRepeat: "no-repeat", + Space: "space", + Round: "round", +}; + +fastn_dom.MaskPosition = { + Left: "left", + Right: "right", + Center: "center", + LeftTop: "left top", + LeftCenter: "left center", + LeftBottom: "left bottom", + CenterTop: "center top", + CenterCenter: "center center", + CenterBottom: "center bottom", + RightTop: "right top", + RightCenter: "right center", + RightBottom: "right bottom", + Length: (value) => { + return value; + }, +}; + +fastn_dom.Event = { + Click: 0, + MouseEnter: 1, + MouseLeave: 2, + ClickOutside: 3, + GlobalKey: (val) => { + return [4, val]; + }, + GlobalKeySeq: (val) => { + return [5, val]; + }, + Input: 6, + Change: 7, + Blur: 8, + Focus: 9, +}; + +class PropertyValueAsClosure { + closureFunction; + deps; + constructor(closureFunction, deps) { + this.closureFunction = closureFunction; + this.deps = deps; + } +} + +// Node2 -> Intermediate node +// Node -> similar to HTML DOM node (Node2.#node) +class Node2 { + #node; + #kind; + #parent; + #tagName; + #rawInnerValue; + /** + * This is where we store all the attached closures, so we can free them + * when we are done. + */ + #mutables; + /** + * This is where we store the extraData related to node. This is + * especially useful to store data for integrated external library (like + * rive). + */ + #extraData; + #children; + constructor(parentOrSibiling, kind) { + this.#kind = kind; + this.#parent = parentOrSibiling; + this.#children = []; + this.#rawInnerValue = null; + + let sibiling = undefined; + + if (parentOrSibiling instanceof ParentNodeWithSibiling) { + this.#parent = parentOrSibiling.getParent(); + while (this.#parent instanceof ParentNodeWithSibiling) { + this.#parent = this.#parent.getParent(); + } + sibiling = parentOrSibiling.getSibiling(); + } + + this.createNode(kind); + + this.#mutables = []; + this.#extraData = {}; + /*if (!!parent.parent) { + parent = parent.parent(); + }*/ + + if (this.#parent.getNode) { + this.#parent = this.#parent.getNode(); + } + + if (fastn_utils.isWrapperNode(this.#tagName)) { + this.#parent = parentOrSibiling; + return; + } + if (sibiling) { + this.#parent.insertBefore( + this.#node, + fastn_utils.nextSibling(sibiling, this.#parent), + ); + } else { + this.#parent.appendChild(this.#node); + } + } + createNode(kind) { + if (kind === fastn_dom.ElementKind.Code) { + let [node, classes, attributes] = fastn_utils.htmlNode(kind); + [this.#tagName, this.#node] = fastn_utils.createNodeHelper( + node, + classes, + attributes, + ); + let codeNode = new Node2( + this.#node, + fastn_dom.ElementKind.CodeChild, + ); + this.#children.push(codeNode); + } else { + let [node, classes, attributes] = fastn_utils.htmlNode(kind); + [this.#tagName, this.#node] = fastn_utils.createNodeHelper( + node, + classes, + attributes, + ); + } + } + getTagName() { + return this.#tagName; + } + getParent() { + return this.#parent; + } + removeAllFaviconLinks() { + if (doubleBuffering) { + const links = document.head.querySelectorAll( + 'link[rel="shortcut icon"]', + ); + links.forEach((link) => { + link.parentNode.removeChild(link); + }); + } + } + setFavicon(url) { + if (doubleBuffering) { + if (url instanceof fastn.recordInstanceClass) url = url.get("src"); + while (true) { + if (url instanceof fastn.mutableClass) url = url.get(); + else break; + } + + let link_element = document.createElement("link"); + link_element.rel = "shortcut icon"; + link_element.href = url; + + this.removeAllFaviconLinks(); + document.head.appendChild(link_element); + } + } + updateTextInputValue() { + if (fastn_utils.isNull(this.#rawInnerValue)) { + this.attachAttribute("value"); + return; + } + if (!ssr && this.#node.tagName.toLowerCase() === "textarea") { + this.#node.innerHTML = this.#rawInnerValue; + } else { + this.attachAttribute("value", this.#rawInnerValue); + } + } + // for attaching inline attributes + attachAttribute(property, value) { + // If the value is null, undefined, or false, the attribute will be removed. + // For example, if attributes like checked, muted, or autoplay have been assigned a "false" value. + if (fastn_utils.isNull(value)) { + this.#node.removeAttribute(property); + return; + } + this.#node.setAttribute(property, value); + } + removeAttribute(property) { + this.#node.removeAttribute(property); + } + updateTagName(name) { + if (ssr) { + this.#node.updateTagName(name); + } else { + let newElement = document.createElement(name); + newElement.innerHTML = this.#node.innerHTML; + newElement.className = this.#node.className; + newElement.style = this.#node.style; + for (var i = 0; i < this.#node.attributes.length; i++) { + var attr = this.#node.attributes[i]; + newElement.setAttribute(attr.name, attr.value); + } + var eventListeners = fastn_utils.getEventListeners(this.#node); + for (var eventType in eventListeners) { + newElement[eventType] = eventListeners[eventType]; + } + this.#parent.replaceChild(newElement, this.#node); + this.#node = newElement; + } + } + updateToAnchor(url) { + let node_kind = this.#kind; + if (ssr) { + if (node_kind !== fastn_dom.ElementKind.Image) { + this.updateTagName("a"); + this.attachAttribute("href", url); + } + return; + } + if (node_kind === fastn_dom.ElementKind.Image) { + let anchorElement = document.createElement("a"); + anchorElement.href = url; + anchorElement.appendChild(this.#node); + this.#parent.appendChild(anchorElement); + this.#node = anchorElement; + } else { + this.updateTagName("a"); + this.#node.href = url; + } + } + updatePositionForNodeById(node_id, value) { + if (!ssr) { + const target_node = fastnVirtual.root.querySelector( + `[id="${node_id}"]`, + ); + if (!fastn_utils.isNull(target_node)) + target_node.style["position"] = value; + } + } + updateParentPosition(value) { + if (ssr) { + let parent = this.#parent; + if (parent.style) parent.style["position"] = value; + } + if (!ssr) { + let current_node = this.#node; + if (current_node) { + let parent_node = current_node.parentNode; + parent_node.style["position"] = value; + } + } + } + updateMetaTitle(value) { + if (!ssr && doubleBuffering) { + if (!fastn_utils.isNull(value)) window.document.title = value; + } + } + addMetaTagByName(name, value) { + if (value === null || value === undefined) { + this.removeMetaTagByName(name); + return; + } + if (!ssr && doubleBuffering) { + const metaTag = window.document.createElement("meta"); + metaTag.setAttribute("name", name); + metaTag.setAttribute("content", value); + document.head.appendChild(metaTag); + } + } + addMetaTagByProperty(property, value) { + if (value === null || value === undefined) { + this.removeMetaTagByProperty(property); + return; + } + if (!ssr && doubleBuffering) { + const metaTag = window.document.createElement("meta"); + metaTag.setAttribute("property", property); + metaTag.setAttribute("content", value); + document.head.appendChild(metaTag); + } + } + removeMetaTagByName(name) { + if (!ssr && doubleBuffering) { + const metaTags = document.getElementsByTagName("meta"); + for (let i = 0; i < metaTags.length; i++) { + const metaTag = metaTags[i]; + if (metaTag.getAttribute("name") === name) { + metaTag.remove(); + break; + } + } + } + } + removeMetaTagByProperty(property) { + if (!ssr && doubleBuffering) { + const metaTags = document.getElementsByTagName("meta"); + for (let i = 0; i < metaTags.length; i++) { + const metaTag = metaTags[i]; + if (metaTag.getAttribute("property") === property) { + metaTag.remove(); + break; + } + } + } + } + // dynamic-class-css + attachCss(property, value, createClass, className) { + let propertyShort = fastn_dom.propertyMap[property] || property; + propertyShort = `__${propertyShort}`; + let cls = `${propertyShort}-${fastn_dom.class_count}`; + if (!!className) { + cls = className; + } else { + if (!fastn_dom.unsanitised_classes[cls]) { + fastn_dom.unsanitised_classes[cls] = ++fastn_dom.class_count; + } + cls = `${propertyShort}-${fastn_dom.unsanitised_classes[cls]}`; + } + let cssClass = className ? cls : `.${cls}`; + + const obj = { property, value }; + + if (value === undefined) { + if (!ssr) { + for (const className of this.#node.classList.values()) { + if (className.startsWith(`${propertyShort}-`)) { + this.#node.classList.remove(className); + } + } + this.#node.style[property] = null; + } + return cls; + } + + if (!ssr && !doubleBuffering) { + if (!!className) { + if (!fastn_dom.classes[cssClass]) { + fastn_dom.classes[cssClass] = + fastn_dom.classes[cssClass] || obj; + fastn_utils.createStyle(cssClass, obj); + } + return cls; + } + + for (const className of this.#node.classList.values()) { + if (className.startsWith(`${propertyShort}-`)) { + this.#node.classList.remove(className); + } + } + + if (createClass) { + if (!fastn_dom.classes[cssClass]) { + fastn_dom.classes[cssClass] = + fastn_dom.classes[cssClass] || obj; + fastn_utils.createStyle(cssClass, obj); + } + this.#node.style.removeProperty(property); + this.#node.classList.add(cls); + } else if (!fastn_dom.classes[cssClass]) { + if (typeof value === "object" && value !== null) { + for (let key in value) { + this.#node.style[key] = value[key]; + } + } else { + this.#node.style[property] = value; + } + } else { + this.#node.style.removeProperty(property); + this.#node.classList.add(cls); + } + + return cls; + } + + fastn_dom.classes[cssClass] = fastn_dom.classes[cssClass] || obj; + + if (!!className) { + return cls; + } + + this.#node.classList.add(cls); + return cls; + } + attachShadow(value) { + if (fastn_utils.isNull(value)) { + this.attachCss("box-shadow", value); + return; + } + + const color = value.get("color"); + + const lightColor = fastn_utils.getStaticValue(color.get("light")); + const darkColor = fastn_utils.getStaticValue(color.get("dark")); + + const blur = fastn_utils.getStaticValue(value.get("blur")); + const xOffset = fastn_utils.getStaticValue(value.get("x_offset")); + const yOffset = fastn_utils.getStaticValue(value.get("y_offset")); + const spread = fastn_utils.getStaticValue(value.get("spread")); + const inset = fastn_utils.getStaticValue(value.get("inset")); + + const shadowCommonCss = `${ + inset ? "inset " : "" + }${xOffset} ${yOffset} ${blur} ${spread}`; + const lightShadowCss = `${shadowCommonCss} ${lightColor}`; + const darkShadowCss = `${shadowCommonCss} ${darkColor}`; + + if (lightShadowCss === darkShadowCss) { + this.attachCss("box-shadow", lightShadowCss, false); + } else { + let lightClass = this.attachCss("box-shadow", lightShadowCss, true); + this.attachCss( + "box-shadow", + darkShadowCss, + true, + `body.dark .${lightClass}`, + ); + } + } + attachBackdropMultiFilter(value) { + const filters = { + blur: fastn_utils.getStaticValue(value.get("blur")), + brightness: fastn_utils.getStaticValue(value.get("brightness")), + contrast: fastn_utils.getStaticValue(value.get("contrast")), + grayscale: fastn_utils.getStaticValue(value.get("grayscale")), + invert: fastn_utils.getStaticValue(value.get("invert")), + opacity: fastn_utils.getStaticValue(value.get("opacity")), + sepia: fastn_utils.getStaticValue(value.get("sepia")), + saturate: fastn_utils.getStaticValue(value.get("saturate")), + }; + + const filterString = Object.entries(filters) + .filter(([_, value]) => !fastn_utils.isNull(value)) + .map(([name, value]) => `${name}(${value})`) + .join(" "); + + this.attachCss("backdrop-filter", filterString, false); + } + attachTextShadow(value) { + if (fastn_utils.isNull(value)) { + this.attachCss("text-shadow", value); + return; + } + + const color = value.get("color"); + + const lightColor = fastn_utils.getStaticValue(color.get("light")); + const darkColor = fastn_utils.getStaticValue(color.get("dark")); + + const blur = fastn_utils.getStaticValue(value.get("blur")); + const xOffset = fastn_utils.getStaticValue(value.get("x_offset")); + const yOffset = fastn_utils.getStaticValue(value.get("y_offset")); + + const shadowCommonCss = `${xOffset} ${yOffset} ${blur}`; + const lightShadowCss = `${shadowCommonCss} ${lightColor}`; + const darkShadowCss = `${shadowCommonCss} ${darkColor}`; + + if (lightShadowCss === darkShadowCss) { + this.attachCss("text-shadow", lightShadowCss, false); + } else { + let lightClass = this.attachCss("box-shadow", lightShadowCss, true); + this.attachCss( + "text-shadow", + darkShadowCss, + true, + `body.dark .${lightClass}`, + ); + } + } + getLinearGradientString(value) { + var lightGradientString = ""; + var darkGradientString = ""; + + let colorsList = value.get("colors").get().getList(); + colorsList.map(function (element) { + // LinearGradient RecordInstance + let lg_color = element.item; + + let color = lg_color.get("color").get(); + let lightColor = fastn_utils.getStaticValue(color.get("light")); + let darkColor = fastn_utils.getStaticValue(color.get("dark")); + + lightGradientString = `${lightGradientString} ${lightColor}`; + darkGradientString = `${darkGradientString} ${darkColor}`; + + let start = fastn_utils.getStaticValue(lg_color.get("start")); + if (start !== undefined && start !== null) { + lightGradientString = `${lightGradientString} ${start}`; + darkGradientString = `${darkGradientString} ${start}`; + } + + let end = fastn_utils.getStaticValue(lg_color.get("end")); + if (end !== undefined && end !== null) { + lightGradientString = `${lightGradientString} ${end}`; + darkGradientString = `${darkGradientString} ${end}`; + } + + let stop_position = fastn_utils.getStaticValue( + lg_color.get("stop_position"), + ); + if (stop_position !== undefined && stop_position !== null) { + lightGradientString = `${lightGradientString}, ${stop_position}`; + darkGradientString = `${darkGradientString}, ${stop_position}`; + } + + lightGradientString = `${lightGradientString},`; + darkGradientString = `${darkGradientString},`; + }); + + lightGradientString = lightGradientString.trim().slice(0, -1); + darkGradientString = darkGradientString.trim().slice(0, -1); + + return [lightGradientString, darkGradientString]; + } + attachLinearGradientCss(value) { + if (fastn_utils.isNull(value)) { + this.attachCss("background-image", value); + return; + } + + const closure = fastn + .closure(() => { + let direction = fastn_utils.getStaticValue( + value.get("direction"), + ); + + const [lightGradientString, darkGradientString] = + this.getLinearGradientString(value); + + if (lightGradientString === darkGradientString) { + this.attachCss( + "background-image", + `linear-gradient(${direction}, ${lightGradientString})`, + false, + ); + } else { + let lightClass = this.attachCss( + "background-image", + `linear-gradient(${direction}, ${lightGradientString})`, + true, + ); + this.attachCss( + "background-image", + `linear-gradient(${direction}, ${darkGradientString})`, + true, + `body.dark .${lightClass}`, + ); + } + }) + .addNodeProperty(this, null, inherited); + + const colorsList = value.get("colors").get().getList(); + + colorsList.forEach(({ item }) => { + const color = item.get("color"); + + [color.get("light"), color.get("dark")].forEach((variant) => { + variant.addClosure(closure); + this.#mutables.push(variant); + }); + }); + } + attachBackgroundImageCss(value) { + if (fastn_utils.isNull(value)) { + this.attachCss("background-repeat", value); + this.attachCss("background-position", value); + this.attachCss("background-size", value); + this.attachCss("background-image", value); + return; + } + + let src = fastn_utils.getStaticValue(value.get("src")); + let lightValue = fastn_utils.getStaticValue(src.get("light")); + let darkValue = fastn_utils.getStaticValue(src.get("dark")); + + let position = fastn_utils.getStaticValue(value.get("position")); + let positionX = null; + let positionY = null; + if (position !== null && position instanceof Object) { + positionX = fastn_utils.getStaticValue(position.get("x")); + positionY = fastn_utils.getStaticValue(position.get("y")); + + if (positionX !== null) position = `${positionX}`; + if (positionY !== null) { + if (positionX === null) position = `0px ${positionY}`; + else position = `${position} ${positionY}`; + } + } + let repeat = fastn_utils.getStaticValue(value.get("repeat")); + let size = fastn_utils.getStaticValue(value.get("size")); + let sizeX = null; + let sizeY = null; + if (size !== null && size instanceof Object) { + sizeX = fastn_utils.getStaticValue(size.get("x")); + sizeY = fastn_utils.getStaticValue(size.get("y")); + + if (sizeX !== null) size = `${sizeX}`; + if (sizeY !== null) { + if (sizeX === null) size = `0px ${sizeY}`; + else size = `${size} ${sizeY}`; + } + } + + if (repeat !== null) this.attachCss("background-repeat", repeat); + if (position !== null) this.attachCss("background-position", position); + if (size !== null) this.attachCss("background-size", size); + + if (lightValue === darkValue) { + this.attachCss("background-image", `url(${lightValue})`, false); + } else { + let lightClass = this.attachCss( + "background-image", + `url(${lightValue})`, + true, + ); + this.attachCss( + "background-image", + `url(${darkValue})`, + true, + `body.dark .${lightClass}`, + ); + } + } + attachMaskImageCss(value, vendorPrefix) { + const propertyWithPrefix = vendorPrefix + ? `${vendorPrefix}-mask-image` + : "mask-image"; + + if (fastn_utils.isNull(value)) { + this.attachCss(propertyWithPrefix, value); + return; + } + + let src = fastn_utils.getStaticValue(value.get("src")); + let linearGradient = fastn_utils.getStaticValue( + value.get("linear_gradient"), + ); + let color = fastn_utils.getStaticValue(value.get("color")); + + const maskLightImageValues = []; + const maskDarkImageValues = []; + + if (!fastn_utils.isNull(src)) { + let lightValue = fastn_utils.getStaticValue(src.get("light")); + let darkValue = fastn_utils.getStaticValue(src.get("dark")); + + const lightUrl = `url(${lightValue})`; + const darkUrl = `url(${darkValue})`; + + if (!fastn_utils.isNull(linearGradient)) { + const lightImageValues = [lightUrl]; + const darkImageValues = [darkUrl]; + + if (!fastn_utils.isNull(color)) { + const lightColor = fastn_utils.getStaticValue( + color.get("light"), + ); + const darkColor = fastn_utils.getStaticValue( + color.get("dark"), + ); + + lightImageValues.push(lightColor); + darkImageValues.push(darkColor); + } + maskLightImageValues.push( + `image(${lightImageValues.join(", ")})`, + ); + maskDarkImageValues.push( + `image(${darkImageValues.join(", ")})`, + ); + } else { + maskLightImageValues.push(lightUrl); + maskDarkImageValues.push(darkUrl); + } + } + + if (!fastn_utils.isNull(linearGradient)) { + let direction = fastn_utils.getStaticValue( + linearGradient.get("direction"), + ); + + const [lightGradientString, darkGradientString] = + this.getLinearGradientString(linearGradient); + + maskLightImageValues.push( + `linear-gradient(${direction}, ${lightGradientString})`, + ); + maskDarkImageValues.push( + `linear-gradient(${direction}, ${darkGradientString})`, + ); + } + + const maskLightImageString = maskLightImageValues.join(", "); + const maskDarkImageString = maskDarkImageValues.join(", "); + + if (maskLightImageString === maskDarkImageString) { + this.attachCss(propertyWithPrefix, maskLightImageString, true); + } else { + let lightClass = this.attachCss( + propertyWithPrefix, + maskLightImageString, + true, + ); + this.attachCss( + propertyWithPrefix, + maskDarkImageString, + true, + `body.dark .${lightClass}`, + ); + } + } + attachMaskSizeCss(value, vendorPrefix) { + const propertyNameWithPrefix = vendorPrefix + ? `${vendorPrefix}-mask-size` + : "mask-size"; + if (fastn_utils.isNull(value)) { + this.attachCss(propertyNameWithPrefix, value); + } + const [size, ...two_values] = ["size", "size_x", "size_y"].map((size) => + fastn_utils.getStaticValue(value.get(size)), + ); + + if (!fastn_utils.isNull(size)) { + this.attachCss(propertyNameWithPrefix, size, true); + } else { + const [size_x, size_y] = two_values.map((value) => value || "auto"); + this.attachCss(propertyNameWithPrefix, `${size_x} ${size_y}`, true); + } + } + attachMaskMultiCss(value, vendorPrefix) { + if (fastn_utils.isNull(value)) { + this.attachCss("mask-repeat", value); + this.attachCss("mask-position", value); + this.attachCss("mask-size", value); + this.attachCss("mask-image", value); + return; + } + + const maskImage = fastn_utils.getStaticValue(value.get("image")); + this.attachMaskImageCss(maskImage); + this.attachMaskImageCss(maskImage, vendorPrefix); + this.attachMaskSizeCss(value); + this.attachMaskSizeCss(value, vendorPrefix); + const maskRepeatValue = fastn_utils.getStaticValue(value.get("repeat")); + if (fastn_utils.isNull(maskRepeatValue)) { + this.attachCss("mask-repeat", maskRepeatValue, true); + this.attachCss("-webkit-mask-repeat", maskRepeatValue, true); + } else { + this.attachCss("mask-repeat", maskRepeatValue, true); + this.attachCss("-webkit-mask-repeat", maskRepeatValue, true); + } + const maskPositionValue = fastn_utils.getStaticValue( + value.get("position"), + ); + if (fastn_utils.isNull(maskPositionValue)) { + this.attachCss("mask-position", maskPositionValue, true); + this.attachCss("-webkit-mask-position", maskPositionValue, true); + } else { + this.attachCss("mask-position", maskPositionValue, true); + this.attachCss("-webkit-mask-position", maskPositionValue, true); + } + } + attachExternalCss(css) { + if (!ssr) { + let css_tag = document.createElement("link"); + css_tag.rel = "stylesheet"; + css_tag.type = "text/css"; + css_tag.href = css; + + let head = + document.head || document.getElementsByTagName("head")[0]; + if (!fastn_dom.externalCss.has(css)) { + head.appendChild(css_tag); + fastn_dom.externalCss.add(css); + } + } + } + attachExternalJs(js) { + if (!ssr) { + let js_tag = document.createElement("script"); + js_tag.src = js; + + let head = + document.head || document.getElementsByTagName("head")[0]; + if (!fastn_dom.externalJs.has(js)) { + head.appendChild(js_tag); + fastn_dom.externalCss.add(js); + } + } + } + attachColorCss(property, value, visited) { + if (fastn_utils.isNull(value)) { + this.attachCss(property, value); + return; + } + value = value instanceof fastn.mutableClass ? value.get() : value; + + const lightValue = value.get("light"); + const darkValue = value.get("dark"); + + const closure = fastn + .closure(() => { + let lightValueStatic = fastn_utils.getStaticValue(lightValue); + let darkValueStatic = fastn_utils.getStaticValue(darkValue); + + if (lightValueStatic === darkValueStatic) { + this.attachCss(property, lightValueStatic, false); + } else { + let lightClass = this.attachCss( + property, + lightValueStatic, + true, + ); + this.attachCss( + property, + darkValueStatic, + true, + `body.dark .${lightClass}`, + ); + if (visited) { + this.attachCss( + property, + lightValueStatic, + true, + `.${lightClass}:visited`, + ); + this.attachCss( + property, + darkValueStatic, + true, + `body.dark .${lightClass}:visited`, + ); + } + } + }) + .addNodeProperty(this, null, inherited); + + [lightValue, darkValue].forEach((modeValue) => { + modeValue.addClosure(closure); + this.#mutables.push(modeValue); + }); + } + attachRoleCss(value) { + if (fastn_utils.isNull(value)) { + this.attachCss("role", value); + return; + } + value.addClosure( + fastn + .closure(() => { + let desktopValue = value.get("desktop"); + let mobileValue = value.get("mobile"); + if ( + fastn_utils.sameResponsiveRole( + desktopValue, + mobileValue, + ) + ) { + this.attachCss( + "role", + fastn_utils.getRoleValues(desktopValue), + true, + ); + } else { + let desktopClass = this.attachCss( + "role", + fastn_utils.getRoleValues(desktopValue), + true, + ); + this.attachCss( + "role", + fastn_utils.getRoleValues(mobileValue), + true, + `body.mobile .${desktopClass}`, + ); + } + }) + .addNodeProperty(this, null, inherited), + ); + this.#mutables.push(value); + } + attachTextStyles(styles) { + if (fastn_utils.isNull(styles)) { + this.attachCss("font-style", styles); + this.attachCss("font-weight", styles); + this.attachCss("text-decoration", styles); + return; + } + for (var s of styles) { + switch (s) { + case "italic": + this.attachCss("font-style", s); + break; + case "underline": + case "line-through": + this.attachCss("text-decoration", s); + break; + default: + this.attachCss("font-weight", s); + } + } + } + attachAlignContent(value, node_kind) { + if (fastn_utils.isNull(value)) { + this.attachCss("align-items", value); + this.attachCss("justify-content", value); + return; + } + if (node_kind === fastn_dom.ElementKind.Column) { + switch (value) { + case "top-left": + this.attachCss("justify-content", "start"); + this.attachCss("align-items", "start"); + break; + case "top-center": + this.attachCss("justify-content", "start"); + this.attachCss("align-items", "center"); + break; + case "top-right": + this.attachCss("justify-content", "start"); + this.attachCss("align-items", "end"); + break; + case "left": + this.attachCss("justify-content", "center"); + this.attachCss("align-items", "start"); + break; + case "center": + this.attachCss("justify-content", "center"); + this.attachCss("align-items", "center"); + break; + case "right": + this.attachCss("justify-content", "center"); + this.attachCss("align-items", "end"); + break; + case "bottom-left": + this.attachCss("justify-content", "end"); + this.attachCss("align-items", "left"); + break; + case "bottom-center": + this.attachCss("justify-content", "end"); + this.attachCss("align-items", "center"); + break; + case "bottom-right": + this.attachCss("justify-content", "end"); + this.attachCss("align-items", "end"); + break; + } + } + + if (node_kind === fastn_dom.ElementKind.Row) { + switch (value) { + case "top-left": + this.attachCss("justify-content", "start"); + this.attachCss("align-items", "start"); + break; + case "top-center": + this.attachCss("justify-content", "center"); + this.attachCss("align-items", "start"); + break; + case "top-right": + this.attachCss("justify-content", "end"); + this.attachCss("align-items", "start"); + break; + case "left": + this.attachCss("justify-content", "start"); + this.attachCss("align-items", "center"); + break; + case "center": + this.attachCss("justify-content", "center"); + this.attachCss("align-items", "center"); + break; + case "right": + this.attachCss("justify-content", "right"); + this.attachCss("align-items", "center"); + break; + case "bottom-left": + this.attachCss("justify-content", "start"); + this.attachCss("align-items", "end"); + break; + case "bottom-center": + this.attachCss("justify-content", "center"); + this.attachCss("align-items", "end"); + break; + case "bottom-right": + this.attachCss("justify-content", "end"); + this.attachCss("align-items", "end"); + break; + } + } + } + attachLinkColor(value) { + ftd.dark_mode.addClosure( + fastn + .closure(() => { + if (!ssr) { + const anchors = + this.#node.tagName.toLowerCase() === "a" + ? [this.#node] + : Array.from(this.#node.querySelectorAll("a")); + let propertyShort = `__${fastn_dom.propertyMap["link-color"]}`; + + if (fastn_utils.isNull(value)) { + anchors.forEach((a) => { + a.classList.values().forEach((className) => { + if ( + className.startsWith( + `${propertyShort}-`, + ) + ) { + a.classList.remove(className); + } + }); + }); + } else { + const lightValue = fastn_utils.getStaticValue( + value.get("light"), + ); + const darkValue = fastn_utils.getStaticValue( + value.get("dark"), + ); + let cls = `${propertyShort}-${JSON.stringify( + lightValue, + )}`; + + if (!fastn_dom.unsanitised_classes[cls]) { + fastn_dom.unsanitised_classes[cls] = + ++fastn_dom.class_count; + } + + cls = `${propertyShort}-${fastn_dom.unsanitised_classes[cls]}`; + + const cssClass = `.${cls}`; + + if (!fastn_dom.classes[cssClass]) { + const obj = { + property: "color", + value: lightValue, + }; + fastn_dom.classes[cssClass] = + fastn_dom.classes[cssClass] || obj; + let styles = document.getElementById("styles"); + styles.innerHTML = `${ + styles.innerHTML + }${getClassAsString(cssClass, obj)}\n`; + } + + if (lightValue !== darkValue) { + const obj = { + property: "color", + value: darkValue, + }; + let darkCls = `body.dark ${cssClass}`; + if (!fastn_dom.classes[darkCls]) { + fastn_dom.classes[darkCls] = + fastn_dom.classes[darkCls] || obj; + let styles = + document.getElementById("styles"); + styles.innerHTML = `${ + styles.innerHTML + }${getClassAsString(darkCls, obj)}\n`; + } + } + + anchors.forEach((a) => a.classList.add(cls)); + } + } + }) + .addNodeProperty(this, null, inherited), + ); + this.#mutables.push(ftd.dark_mode); + } + setStaticProperty(kind, value, inherited) { + // value can be either static or mutable + let staticValue = fastn_utils.getStaticValue(value); + if (kind === fastn_dom.PropertyKind.Children) { + if (fastn_utils.isWrapperNode(this.#tagName)) { + let parentWithSibiling = this.#parent; + if (Array.isArray(staticValue)) { + staticValue.forEach((func, index) => { + if (index !== 0) { + parentWithSibiling = new ParentNodeWithSibiling( + this.#parent.getParent(), + this.#children[index - 1], + ); + } + this.#children.push( + fastn_utils.getStaticValue(func.item)( + parentWithSibiling, + inherited, + ), + ); + }); + } else { + this.#children.push( + staticValue(parentWithSibiling, inherited), + ); + } + } else { + if (Array.isArray(staticValue)) { + staticValue.forEach((func) => + this.#children.push( + fastn_utils.getStaticValue(func.item)( + this, + inherited, + ), + ), + ); + } else { + this.#children.push(staticValue(this, inherited)); + } + } + } else if (kind === fastn_dom.PropertyKind.Id) { + this.#node.id = staticValue; + } else if (kind === fastn_dom.PropertyKind.BreakpointWidth) { + if (fastn_utils.isNull(staticValue)) { + return; + } + ftd.breakpoint_width.set(fastn_utils.getStaticValue(staticValue)); + } else if (kind === fastn_dom.PropertyKind.Css) { + let css_list = staticValue.map((obj) => + fastn_utils.getStaticValue(obj.item), + ); + css_list.forEach((css) => { + this.attachExternalCss(css); + }); + } else if (kind === fastn_dom.PropertyKind.Js) { + let js_list = staticValue.map((obj) => + fastn_utils.getStaticValue(obj.item), + ); + js_list.forEach((js) => { + this.attachExternalJs(js); + }); + } else if (kind === fastn_dom.PropertyKind.Width) { + this.attachCss("width", staticValue); + } else if (kind === fastn_dom.PropertyKind.Height) { + fastn_utils.resetFullHeight(); + this.attachCss("height", staticValue); + fastn_utils.setFullHeight(); + } else if (kind === fastn_dom.PropertyKind.Padding) { + this.attachCss("padding", staticValue); + } else if (kind === fastn_dom.PropertyKind.PaddingHorizontal) { + this.attachCss("padding-left", staticValue); + this.attachCss("padding-right", staticValue); + } else if (kind === fastn_dom.PropertyKind.PaddingVertical) { + this.attachCss("padding-top", staticValue); + this.attachCss("padding-bottom", staticValue); + } else if (kind === fastn_dom.PropertyKind.PaddingLeft) { + this.attachCss("padding-left", staticValue); + } else if (kind === fastn_dom.PropertyKind.PaddingRight) { + this.attachCss("padding-right", staticValue); + } else if (kind === fastn_dom.PropertyKind.PaddingTop) { + this.attachCss("padding-top", staticValue); + } else if (kind === fastn_dom.PropertyKind.PaddingBottom) { + this.attachCss("padding-bottom", staticValue); + } else if (kind === fastn_dom.PropertyKind.Margin) { + this.attachCss("margin", staticValue); + } else if (kind === fastn_dom.PropertyKind.MarginHorizontal) { + this.attachCss("margin-left", staticValue); + this.attachCss("margin-right", staticValue); + } else if (kind === fastn_dom.PropertyKind.MarginVertical) { + this.attachCss("margin-top", staticValue); + this.attachCss("margin-bottom", staticValue); + } else if (kind === fastn_dom.PropertyKind.MarginLeft) { + this.attachCss("margin-left", staticValue); + } else if (kind === fastn_dom.PropertyKind.MarginRight) { + this.attachCss("margin-right", staticValue); + } else if (kind === fastn_dom.PropertyKind.MarginTop) { + this.attachCss("margin-top", staticValue); + } else if (kind === fastn_dom.PropertyKind.MarginBottom) { + this.attachCss("margin-bottom", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderWidth) { + this.attachCss("border-width", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderTopWidth) { + this.attachCss("border-top-width", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderBottomWidth) { + this.attachCss("border-bottom-width", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderLeftWidth) { + this.attachCss("border-left-width", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderRightWidth) { + this.attachCss("border-right-width", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderRadius) { + this.attachCss("border-radius", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderTopLeftRadius) { + this.attachCss("border-top-left-radius", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderTopRightRadius) { + this.attachCss("border-top-right-radius", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderBottomLeftRadius) { + this.attachCss("border-bottom-left-radius", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderBottomRightRadius) { + this.attachCss("border-bottom-right-radius", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderStyle) { + this.attachCss("border-style", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderStyleVertical) { + this.attachCss("border-top-style", staticValue); + this.attachCss("border-bottom-style", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderStyleHorizontal) { + this.attachCss("border-left-style", staticValue); + this.attachCss("border-right-style", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderLeftStyle) { + this.attachCss("border-left-style", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderRightStyle) { + this.attachCss("border-right-style", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderTopStyle) { + this.attachCss("border-top-style", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderBottomStyle) { + this.attachCss("border-bottom-style", staticValue); + } else if (kind === fastn_dom.PropertyKind.ZIndex) { + this.attachCss("z-index", staticValue); + } else if (kind === fastn_dom.PropertyKind.Shadow) { + this.attachShadow(staticValue); + } else if (kind === fastn_dom.PropertyKind.TextShadow) { + this.attachTextShadow(staticValue); + } else if (kind === fastn_dom.PropertyKind.BackdropFilter) { + if (fastn_utils.isNull(staticValue)) { + this.attachCss("backdrop-filter", staticValue); + return; + } + + let backdropType = staticValue[0]; + switch (backdropType) { + case 1: + this.attachCss( + "backdrop-filter", + `blur(${fastn_utils.getStaticValue(staticValue[1])})`, + ); + break; + case 2: + this.attachCss( + "backdrop-filter", + `brightness(${fastn_utils.getStaticValue( + staticValue[1], + )})`, + ); + break; + case 3: + this.attachCss( + "backdrop-filter", + `contrast(${fastn_utils.getStaticValue( + staticValue[1], + )})`, + ); + break; + case 4: + this.attachCss( + "backdrop-filter", + `greyscale(${fastn_utils.getStaticValue( + staticValue[1], + )})`, + ); + break; + case 5: + this.attachCss( + "backdrop-filter", + `invert(${fastn_utils.getStaticValue(staticValue[1])})`, + ); + break; + case 6: + this.attachCss( + "backdrop-filter", + `opacity(${fastn_utils.getStaticValue( + staticValue[1], + )})`, + ); + break; + case 7: + this.attachCss( + "backdrop-filter", + `sepia(${fastn_utils.getStaticValue(staticValue[1])})`, + ); + break; + case 8: + this.attachCss( + "backdrop-filter", + `saturate(${fastn_utils.getStaticValue( + staticValue[1], + )})`, + ); + break; + case 9: + this.attachBackdropMultiFilter(staticValue[1]); + break; + } + } else if (kind === fastn_dom.PropertyKind.Mask) { + if (fastn_utils.isNull(staticValue)) { + this.attachCss("mask-image", staticValue); + return; + } + + const [backgroundType, value] = staticValue; + + switch (backgroundType) { + case fastn_dom.Mask.Image()[0]: + this.attachMaskImageCss(value); + this.attachMaskImageCss(value, "-webkit"); + break; + case fastn_dom.Mask.Multi()[0]: + this.attachMaskMultiCss(value); + this.attachMaskMultiCss(value, "-webkit"); + break; + } + } else if (kind === fastn_dom.PropertyKind.Classes) { + fastn_utils.removeNonFastnClasses(this); + if (!fastn_utils.isNull(staticValue)) { + let cls = staticValue.map((obj) => + fastn_utils.getStaticValue(obj.item), + ); + cls.forEach((c) => { + this.#node.classList.add(c); + }); + } + } else if (kind === fastn_dom.PropertyKind.Anchor) { + // todo: this needs fixed for anchor.id = v + // need to change position of element with id = v to relative + if (fastn_utils.isNull(staticValue)) { + this.attachCss("position", staticValue); + return; + } + + let anchorType = staticValue[0]; + switch (anchorType) { + case 1: + this.attachCss("position", staticValue[1]); + break; + case 2: + this.attachCss("position", staticValue[1]); + this.updateParentPosition("relative"); + break; + case 3: + const parent_node_id = staticValue[1]; + this.attachCss("position", "absolute"); + this.updatePositionForNodeById(parent_node_id, "relative"); + break; + } + } else if (kind === fastn_dom.PropertyKind.Sticky) { + // sticky is boolean type + switch (staticValue) { + case "true": + case true: + this.attachCss("position", "sticky"); + break; + case "false": + case false: + this.attachCss("position", "static"); + break; + default: + this.attachCss("position", staticValue); + } + } else if (kind === fastn_dom.PropertyKind.Top) { + this.attachCss("top", staticValue); + } else if (kind === fastn_dom.PropertyKind.Bottom) { + this.attachCss("bottom", staticValue); + } else if (kind === fastn_dom.PropertyKind.Left) { + this.attachCss("left", staticValue); + } else if (kind === fastn_dom.PropertyKind.Right) { + this.attachCss("right", staticValue); + } else if (kind === fastn_dom.PropertyKind.Overflow) { + this.attachCss("overflow", staticValue); + } else if (kind === fastn_dom.PropertyKind.OverflowX) { + this.attachCss("overflow-x", staticValue); + } else if (kind === fastn_dom.PropertyKind.OverflowY) { + this.attachCss("overflow-y", staticValue); + } else if (kind === fastn_dom.PropertyKind.Spacing) { + if (fastn_utils.isNull(staticValue)) { + this.attachCss("justify-content", staticValue); + this.attachCss("gap", staticValue); + return; + } + + let spacingType = staticValue[0]; + switch (spacingType) { + case fastn_dom.Spacing.SpaceEvenly[0]: + case fastn_dom.Spacing.SpaceBetween[0]: + case fastn_dom.Spacing.SpaceAround[0]: + this.attachCss("justify-content", staticValue[1]); + break; + case fastn_dom.Spacing.Fixed()[0]: + this.attachCss( + "gap", + fastn_utils.getStaticValue(staticValue[1]), + ); + break; + } + } else if (kind === fastn_dom.PropertyKind.Wrap) { + // sticky is boolean type + switch (staticValue) { + case "true": + case true: + this.attachCss("flex-wrap", "wrap"); + break; + case "false": + case false: + this.attachCss("flex-wrap", "no-wrap"); + break; + default: + this.attachCss("flex-wrap", staticValue); + } + } else if (kind === fastn_dom.PropertyKind.TextTransform) { + this.attachCss("text-transform", staticValue); + } else if (kind === fastn_dom.PropertyKind.TextIndent) { + this.attachCss("text-indent", staticValue); + } else if (kind === fastn_dom.PropertyKind.TextAlign) { + this.attachCss("text-align", staticValue); + } else if (kind === fastn_dom.PropertyKind.LineClamp) { + // -webkit-line-clamp: staticValue + // display: -webkit-box, overflow: hidden + // -webkit-box-orient: vertical + this.attachCss("-webkit-line-clamp", staticValue); + this.attachCss("display", "-webkit-box"); + this.attachCss("overflow", "hidden"); + this.attachCss("-webkit-box-orient", "vertical"); + } else if (kind === fastn_dom.PropertyKind.Opacity) { + this.attachCss("opacity", staticValue); + } else if (kind === fastn_dom.PropertyKind.Cursor) { + this.attachCss("cursor", staticValue); + } else if (kind === fastn_dom.PropertyKind.Resize) { + // overflow: auto, resize: staticValue + this.attachCss("resize", staticValue); + this.attachCss("overflow", "auto"); + } else if (kind === fastn_dom.PropertyKind.Selectable) { + if (staticValue === false) { + this.attachCss("user-select", "none"); + } else { + this.attachCss("user-select", null); + } + } else if (kind === fastn_dom.PropertyKind.MinHeight) { + this.attachCss("min-height", staticValue); + } else if (kind === fastn_dom.PropertyKind.MaxHeight) { + this.attachCss("max-height", staticValue); + } else if (kind === fastn_dom.PropertyKind.MinWidth) { + this.attachCss("min-width", staticValue); + } else if (kind === fastn_dom.PropertyKind.MaxWidth) { + this.attachCss("max-width", staticValue); + } else if (kind === fastn_dom.PropertyKind.WhiteSpace) { + this.attachCss("white-space", staticValue); + } else if (kind === fastn_dom.PropertyKind.AlignSelf) { + this.attachCss("align-self", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderColor) { + this.attachColorCss("border-color", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderLeftColor) { + this.attachColorCss("border-left-color", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderRightColor) { + this.attachColorCss("border-right-color", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderTopColor) { + this.attachColorCss("border-top-color", staticValue); + } else if (kind === fastn_dom.PropertyKind.BorderBottomColor) { + this.attachColorCss("border-bottom-color", staticValue); + } else if (kind === fastn_dom.PropertyKind.LinkColor) { + this.attachLinkColor(staticValue); + } else if (kind === fastn_dom.PropertyKind.Color) { + this.attachColorCss("color", staticValue, true); + } else if (kind === fastn_dom.PropertyKind.Background) { + if (fastn_utils.isNull(staticValue)) { + this.attachColorCss("background-color", staticValue); + this.attachBackgroundImageCss(staticValue); + this.attachLinearGradientCss(staticValue); + return; + } + + let backgroundType = staticValue[0]; + switch (backgroundType) { + case fastn_dom.BackgroundStyle.Solid()[0]: + this.attachColorCss("background-color", staticValue[1]); + break; + case fastn_dom.BackgroundStyle.Image()[0]: + this.attachBackgroundImageCss(staticValue[1]); + break; + case fastn_dom.BackgroundStyle.LinearGradient()[0]: + this.attachLinearGradientCss(staticValue[1]); + break; + } + } else if (kind === fastn_dom.PropertyKind.Display) { + this.attachCss("display", staticValue); + } else if (kind === fastn_dom.PropertyKind.Checked) { + switch (staticValue) { + case "true": + case true: + this.attachAttribute("checked", ""); + break; + case "false": + case false: + this.removeAttribute("checked"); + break; + default: + this.attachAttribute("checked", staticValue); + } + if (!ssr) this.#node.checked = staticValue; + } else if (kind === fastn_dom.PropertyKind.Enabled) { + switch (staticValue) { + case "false": + case false: + this.attachAttribute("disabled", ""); + break; + case "true": + case true: + this.removeAttribute("disabled"); + break; + default: + this.attachAttribute("disabled", staticValue); + } + } else if (kind === fastn_dom.PropertyKind.TextInputType) { + this.attachAttribute("type", staticValue); + } else if (kind === fastn_dom.PropertyKind.TextInputValue) { + this.#rawInnerValue = staticValue; + this.updateTextInputValue(); + } else if (kind === fastn_dom.PropertyKind.DefaultTextInputValue) { + if (!fastn_utils.isNull(this.#rawInnerValue)) { + return; + } + this.#rawInnerValue = staticValue; + this.updateTextInputValue(); + } else if (kind === fastn_dom.PropertyKind.InputMaxLength) { + this.attachAttribute("maxlength", staticValue); + } else if (kind === fastn_dom.PropertyKind.Placeholder) { + this.attachAttribute("placeholder", staticValue); + } else if (kind === fastn_dom.PropertyKind.Multiline) { + switch (staticValue) { + case "true": + case true: + this.updateTagName("textarea"); + break; + case "false": + case false: + this.updateTagName("input"); + break; + } + this.updateTextInputValue(); + } else if (kind === fastn_dom.PropertyKind.Link) { + // Changing node type to `a` for link + // todo: needs fix for image links + if (fastn_utils.isNull(staticValue)) { + return; + } + this.updateToAnchor(staticValue); + } else if (kind === fastn_dom.PropertyKind.LinkRel) { + if (fastn_utils.isNull(staticValue)) { + this.removeAttribute("rel"); + } + let rel_list = staticValue.map((obj) => + fastn_utils.getStaticValue(obj.item), + ); + this.attachAttribute("rel", rel_list.join(" ")); + } else if (kind === fastn_dom.PropertyKind.OpenInNewTab) { + // open_in_new_tab is boolean type + switch (staticValue) { + case "true": + case true: + this.attachAttribute("target", "_blank"); + break; + default: + this.attachAttribute("target", staticValue); + } + } else if (kind === fastn_dom.PropertyKind.TextStyle) { + let styles = staticValue?.map((obj) => + fastn_utils.getStaticValue(obj.item), + ); + this.attachTextStyles(styles); + } else if (kind === fastn_dom.PropertyKind.Region) { + this.updateTagName(staticValue); + if (this.#node.innerHTML) { + this.#node.id = fastn_utils.slugify(this.#rawInnerValue); + } + } else if (kind === fastn_dom.PropertyKind.AlignContent) { + let node_kind = this.#kind; + this.attachAlignContent(staticValue, node_kind); + } else if (kind === fastn_dom.PropertyKind.Loading) { + this.attachAttribute("loading", staticValue); + } else if (kind === fastn_dom.PropertyKind.Src) { + this.attachAttribute("src", staticValue); + } else if (kind === fastn_dom.PropertyKind.ImageSrc) { + ftd.dark_mode.addClosure( + fastn + .closure(() => { + if (fastn_utils.isNull(staticValue)) { + this.attachAttribute("src", staticValue); + return; + } + const is_dark_mode = ftd.dark_mode.get(); + const src = staticValue.get( + is_dark_mode ? "dark" : "light", + ); + if (!ssr) { + let image_node = this.#node; + if (!fastn_utils.isNull(image_node)) { + if (image_node.nodeName.toLowerCase() === "a") { + let childNodes = image_node.childNodes; + childNodes.forEach(function (child) { + if ( + child.nodeName.toLowerCase() === + "img" + ) + image_node = child; + }); + } + image_node.setAttribute( + "src", + fastn_utils.getStaticValue(src), + ); + } + } else { + this.attachAttribute( + "src", + fastn_utils.getStaticValue(src), + ); + } + }) + .addNodeProperty(this, null, inherited), + ); + this.#mutables.push(ftd.dark_mode); + } else if (kind === fastn_dom.PropertyKind.Alt) { + this.attachAttribute("alt", staticValue); + } else if (kind === fastn_dom.PropertyKind.VideoSrc) { + ftd.dark_mode.addClosure( + fastn + .closure(() => { + if (fastn_utils.isNull(staticValue)) { + this.attachAttribute("src", staticValue); + return; + } + const is_dark_mode = ftd.dark_mode.get(); + const src = staticValue.get( + is_dark_mode ? "dark" : "light", + ); + + this.attachAttribute( + "src", + fastn_utils.getStaticValue(src), + ); + }) + .addNodeProperty(this, null, inherited), + ); + this.#mutables.push(ftd.dark_mode); + } else if (kind === fastn_dom.PropertyKind.Autoplay) { + if (staticValue) { + this.attachAttribute("autoplay", staticValue); + } else { + this.removeAttribute("autoplay"); + } + } else if (kind === fastn_dom.PropertyKind.Muted) { + if (staticValue) { + this.attachAttribute("muted", staticValue); + } else { + this.removeAttribute("muted"); + } + } else if (kind === fastn_dom.PropertyKind.Controls) { + if (staticValue) { + this.attachAttribute("controls", staticValue); + } else { + this.removeAttribute("controls"); + } + } else if (kind === fastn_dom.PropertyKind.LoopVideo) { + if (staticValue) { + this.attachAttribute("loop", staticValue); + } else { + this.removeAttribute("loop"); + } + } else if (kind === fastn_dom.PropertyKind.Poster) { + ftd.dark_mode.addClosure( + fastn + .closure(() => { + if (fastn_utils.isNull(staticValue)) { + this.attachAttribute("poster", staticValue); + return; + } + const is_dark_mode = ftd.dark_mode.get(); + const posterSrc = staticValue.get( + is_dark_mode ? "dark" : "light", + ); + + this.attachAttribute( + "poster", + fastn_utils.getStaticValue(posterSrc), + ); + }) + .addNodeProperty(this, null, inherited), + ); + this.#mutables.push(ftd.dark_mode); + } else if (kind === fastn_dom.PropertyKind.Fit) { + this.attachCss("object-fit", staticValue); + } else if (kind === fastn_dom.PropertyKind.FetchPriority) { + this.attachAttribute("fetchpriority", staticValue); + } else if (kind === fastn_dom.PropertyKind.YoutubeSrc) { + if (fastn_utils.isNull(staticValue)) { + this.attachAttribute("src", staticValue); + return; + } + const id_pattern = "^([a-zA-Z0-9_-]{11})$"; + let id = staticValue.match(id_pattern); + if (!fastn_utils.isNull(id)) { + this.attachAttribute( + "src", + `https:\/\/youtube.com/embed/${id[0]}`, + ); + } else { + this.attachAttribute("src", staticValue); + } + } else if (kind === fastn_dom.PropertyKind.Role) { + this.attachRoleCss(staticValue); + } else if (kind === fastn_dom.PropertyKind.Code) { + if (!fastn_utils.isNull(staticValue)) { + let { modifiedText, highlightedLines } = + fastn_utils.findAndRemoveHighlighter(staticValue); + if (highlightedLines.length !== 0) { + this.attachAttribute("data-line", highlightedLines); + } + staticValue = modifiedText; + } + let codeNode = this.#children[0].getNode(); + let codeText = fastn_utils.escapeHtmlInCode(staticValue); + codeNode.innerHTML = codeText; + this.#extraData.code = this.#extraData.code + ? this.#extraData.code + : {}; + fastn_utils.highlightCode(codeNode, this.#extraData.code); + } else if (kind === fastn_dom.PropertyKind.CodeShowLineNumber) { + if (staticValue) { + this.#node.classList.add("line-numbers"); + } else { + this.#node.classList.remove("line-numbers"); + } + } else if (kind === fastn_dom.PropertyKind.CodeTheme) { + this.#extraData.code = this.#extraData.code + ? this.#extraData.code + : {}; + if (fastn_utils.isNull(staticValue)) { + if (!fastn_utils.isNull(this.#extraData.code.theme)) { + this.#node.classList.remove(this.#extraData.code.theme); + } + return; + } + if (!ssr) { + fastn_utils.addCodeTheme(staticValue); + } + staticValue = fastn_utils.getStaticValue(staticValue); + let theme = staticValue.replace(".", "-"); + if (this.#extraData.code.theme !== theme) { + let codeNode = this.#children[0].getNode(); + this.#node.classList.remove(this.#extraData.code.theme); + codeNode.classList.remove(this.#extraData.code.theme); + this.#extraData.code.theme = theme; + this.#node.classList.add(theme); + codeNode.classList.add(theme); + fastn_utils.highlightCode(codeNode, this.#extraData.code); + } + } else if (kind === fastn_dom.PropertyKind.CodeLanguage) { + let language = `language-${staticValue}`; + this.#extraData.code = this.#extraData.code + ? this.#extraData.code + : {}; + if (this.#extraData.code.language) { + this.#node.classList.remove(language); + } + this.#extraData.code.language = language; + this.#node.classList.add(language); + let codeNode = this.#children[0].getNode(); + codeNode.classList.add(language); + fastn_utils.highlightCode(codeNode, this.#extraData.code); + } else if (kind === fastn_dom.PropertyKind.Favicon) { + if (fastn_utils.isNull(staticValue)) return; + this.setFavicon(staticValue); + } else if ( + kind === fastn_dom.PropertyKind.DocumentProperties.MetaTitle + ) { + this.updateMetaTitle(staticValue); + } else if ( + kind === fastn_dom.PropertyKind.DocumentProperties.MetaOGTitle + ) { + this.addMetaTagByProperty("og:title", staticValue); + } else if ( + kind === fastn_dom.PropertyKind.DocumentProperties.MetaTwitterTitle + ) { + this.addMetaTagByName("twitter:title", staticValue); + } else if ( + kind === fastn_dom.PropertyKind.DocumentProperties.MetaDescription + ) { + this.addMetaTagByName("description", staticValue); + } else if ( + kind === fastn_dom.PropertyKind.DocumentProperties.MetaOGDescription + ) { + this.addMetaTagByProperty("og:description", staticValue); + } else if ( + kind === + fastn_dom.PropertyKind.DocumentProperties.MetaTwitterDescription + ) { + this.addMetaTagByName("twitter:description", staticValue); + } else if ( + kind === fastn_dom.PropertyKind.DocumentProperties.MetaOGImage + ) { + // staticValue is of ftd.raw-image-src RecordInstance type + if (fastn_utils.isNull(staticValue)) { + this.removeMetaTagByProperty("og:image"); + return; + } + this.addMetaTagByProperty( + "og:image", + fastn_utils.getStaticValue(staticValue.get("src")), + ); + } else if ( + kind === fastn_dom.PropertyKind.DocumentProperties.MetaTwitterImage + ) { + // staticValue is of ftd.raw-image-src RecordInstance type + if (fastn_utils.isNull(staticValue)) { + this.removeMetaTagByName("twitter:image"); + return; + } + this.addMetaTagByName( + "twitter:image", + fastn_utils.getStaticValue(staticValue.get("src")), + ); + } else if ( + kind === fastn_dom.PropertyKind.DocumentProperties.MetaThemeColor + ) { + // staticValue is of ftd.color RecordInstance type + if (fastn_utils.isNull(staticValue)) { + this.removeMetaTagByName("theme-color"); + return; + } + this.addMetaTagByName( + "theme-color", + fastn_utils.getStaticValue(staticValue.get("light")), + ); + } else if ( + kind === + fastn_dom.PropertyKind.DocumentProperties + .MetaFacebookDomainVerification + ) { + if (fastn_utils.isNull(staticValue)) { + this.removeMetaTagByName("facebook-domain-verification"); + return; + } + this.addMetaTagByName( + "facebook-domain-verification", + fastn_utils.getStaticValue(staticValue), + ); + } else if ( + kind === fastn_dom.PropertyKind.IntegerValue || + kind === fastn_dom.PropertyKind.DecimalValue || + kind === fastn_dom.PropertyKind.BooleanValue + ) { + this.#node.innerHTML = staticValue; + this.#rawInnerValue = staticValue; + } else if (kind === fastn_dom.PropertyKind.StringValue) { + this.#rawInnerValue = staticValue; + staticValue = fastn_utils.markdown_inline( + fastn_utils.escapeHtmlInMarkdown(staticValue), + ); + staticValue = fastn_utils.process_post_markdown( + this.#node, + staticValue, + ); + if (!fastn_utils.isNull(staticValue)) { + this.#node.innerHTML = staticValue; + } else { + this.#node.innerHTML = ""; + } + } else { + throw "invalid fastn_dom.PropertyKind: " + kind; + } + } + setProperty(kind, value, inherited) { + if (value instanceof fastn.mutableClass) { + this.setDynamicProperty( + kind, + [value], + () => { + return value.get(); + }, + inherited, + ); + } else if (value instanceof PropertyValueAsClosure) { + this.setDynamicProperty( + kind, + value.deps, + value.closureFunction, + inherited, + ); + } else { + this.setStaticProperty(kind, value, inherited); + } + } + setDynamicProperty(kind, deps, func, inherited) { + let closure = fastn + .closure(func) + .addNodeProperty(this, kind, inherited); + for (let dep in deps) { + if (fastn_utils.isNull(deps[dep]) || !deps[dep].addClosure) { + continue; + } + deps[dep].addClosure(closure); + this.#mutables.push(deps[dep]); + } + } + getNode() { + return this.#node; + } + getExtraData() { + return this.#extraData; + } + getChildren() { + return this.#children; + } + mergeFnCalls(current, newFunc) { + return () => { + if (current instanceof Function) current(); + if (newFunc instanceof Function) newFunc(); + }; + } + addEventHandler(event, func) { + if (event === fastn_dom.Event.Click) { + let onclickEvents = this.mergeFnCalls(this.#node.onclick, func); + if (fastn_utils.isNull(this.#node.onclick)) + this.attachCss("cursor", "pointer"); + this.#node.onclick = onclickEvents; + } else if (event === fastn_dom.Event.MouseEnter) { + let mouseEnterEvents = this.mergeFnCalls( + this.#node.onmouseenter, + func, + ); + this.#node.onmouseenter = mouseEnterEvents; + } else if (event === fastn_dom.Event.MouseLeave) { + let mouseLeaveEvents = this.mergeFnCalls( + this.#node.onmouseleave, + func, + ); + this.#node.onmouseleave = mouseLeaveEvents; + } else if (event === fastn_dom.Event.ClickOutside) { + ftd.clickOutsideEvents.push([this, func]); + } else if (!!event[0] && event[0] === fastn_dom.Event.GlobalKey()[0]) { + ftd.globalKeyEvents.push([this, func, event[1]]); + } else if ( + !!event[0] && + event[0] === fastn_dom.Event.GlobalKeySeq()[0] + ) { + ftd.globalKeySeqEvents.push([this, func, event[1]]); + } else if (event === fastn_dom.Event.Input) { + let onInputEvents = this.mergeFnCalls(this.#node.oninput, func); + this.#node.oninput = onInputEvents; + } else if (event === fastn_dom.Event.Change) { + let onChangeEvents = this.mergeFnCalls(this.#node.onchange, func); + this.#node.onchange = onChangeEvents; + } else if (event === fastn_dom.Event.Blur) { + let onBlurEvents = this.mergeFnCalls(this.#node.onblur, func); + this.#node.onblur = onBlurEvents; + } else if (event === fastn_dom.Event.Focus) { + let onFocusEvents = this.mergeFnCalls(this.#node.onfocus, func); + this.#node.onfocus = onFocusEvents; + } + } + destroy() { + for (let i = 0; i < this.#mutables.length; i++) { + this.#mutables[i].unlinkNode(this); + } + // Todo: We don't need this condition as after destroying this node + // ConditionalDom reset this.#conditionUI to null or some different + // value. Not sure why this is still needed. + if (!fastn_utils.isNull(this.#node)) { + this.#node.remove(); + } + this.#mutables = []; + this.#parent = null; + this.#node = null; + } +} + +class ConditionalDom { + #marker; + #parent; + #node_constructor; + #condition; + #mutables; + #conditionUI; + + constructor(parent, deps, condition, node_constructor) { + this.#marker = fastn_dom.createKernel( + parent, + fastn_dom.ElementKind.Comment, + ); + this.#parent = parent; + + this.#conditionUI = null; + let closure = fastn.closure(() => { + fastn_utils.resetFullHeight(); + if (condition()) { + if (this.#conditionUI) { + let conditionUI = fastn_utils.flattenArray( + this.#conditionUI, + ); + while (conditionUI.length > 0) { + let poppedElement = conditionUI.pop(); + poppedElement.destroy(); + } + } + this.#conditionUI = node_constructor( + new ParentNodeWithSibiling(this.#parent, this.#marker), + ); + if ( + !Array.isArray(this.#conditionUI) && + fastn_utils.isWrapperNode(this.#conditionUI.getTagName()) + ) { + this.#conditionUI = this.#conditionUI.getChildren(); + } + } else if (this.#conditionUI) { + let conditionUI = fastn_utils.flattenArray(this.#conditionUI); + while (conditionUI.length > 0) { + let poppedElement = conditionUI.pop(); + poppedElement.destroy(); + } + this.#conditionUI = null; + } + fastn_utils.setFullHeight(); + }); + deps.forEach((dep) => { + if (!fastn_utils.isNull(dep) && dep.addClosure) { + dep.addClosure(closure); + } + }); + + this.#node_constructor = node_constructor; + this.#condition = condition; + this.#mutables = []; + } + + getParent() { + let nodes = [this.#marker]; + if (this.#conditionUI) { + nodes.push(this.#conditionUI); + } + return nodes; + } +} + +fastn_dom.createKernel = function (parent, kind) { + return new Node2(parent, kind); +}; + +fastn_dom.conditionalDom = function ( + parent, + deps, + condition, + node_constructor, +) { + return new ConditionalDom(parent, deps, condition, node_constructor); +}; + +class ParentNodeWithSibiling { + #parent; + #sibiling; + constructor(parent, sibiling) { + this.#parent = parent; + this.#sibiling = sibiling; + } + getParent() { + return this.#parent; + } + getSibiling() { + return this.#sibiling; + } +} + +class ForLoop { + #node_constructor; + #list; + #wrapper; + #parent; + #nodes; + constructor(parent, node_constructor, list) { + this.#wrapper = fastn_dom.createKernel( + parent, + fastn_dom.ElementKind.Comment, + ); + this.#parent = parent; + this.#node_constructor = node_constructor; + this.#list = list; + this.#nodes = []; + + fastn_utils.resetFullHeight(); + for (let idx in list.getList()) { + this.createNode(idx, false); + } + fastn_utils.setFullHeight(); + } + createNode(index, resizeBodyHeight = true) { + if (resizeBodyHeight) { + fastn_utils.resetFullHeight(); + } + let parentWithSibiling = new ParentNodeWithSibiling( + this.#parent, + this.#wrapper, + ); + if (index !== 0) { + parentWithSibiling = new ParentNodeWithSibiling( + this.#parent, + this.#nodes[index - 1], + ); + } + let v = this.#list.get(index); + let node = this.#node_constructor(parentWithSibiling, v.item, v.index); + this.#nodes.splice(index, 0, node); + if (resizeBodyHeight) { + fastn_utils.setFullHeight(); + } + return node; + } + createAllNode() { + fastn_utils.resetFullHeight(); + this.deleteAllNode(false); + for (let idx in this.#list.getList()) { + this.createNode(idx, false); + } + fastn_utils.setFullHeight(); + } + deleteAllNode(resizeBodyHeight = true) { + if (resizeBodyHeight) { + fastn_utils.resetFullHeight(); + } + while (this.#nodes.length > 0) { + this.#nodes.pop().destroy(); + } + if (resizeBodyHeight) { + fastn_utils.setFullHeight(); + } + } + getWrapper() { + return this.#wrapper; + } + deleteNode(index) { + fastn_utils.resetFullHeight(); + let node = this.#nodes.splice(index, 1)[0]; + node.destroy(); + fastn_utils.setFullHeight(); + } + getParent() { + return this.#parent; + } +} + +fastn_dom.forLoop = function (parent, node_constructor, list) { + return new ForLoop(parent, node_constructor, list); +}; +let fastn_utils = { + htmlNode(kind) { + let node = "div"; + let css = []; + let attributes = {}; + if (kind === fastn_dom.ElementKind.Column) { + css.push(fastn_dom.InternalClass.FT_COLUMN); + } else if (kind === fastn_dom.ElementKind.Document) { + css.push(fastn_dom.InternalClass.FT_COLUMN); + css.push(fastn_dom.InternalClass.FT_FULL_SIZE); + } else if (kind === fastn_dom.ElementKind.Row) { + css.push(fastn_dom.InternalClass.FT_ROW); + } else if (kind === fastn_dom.ElementKind.IFrame) { + node = "iframe"; + // To allow fullscreen support + // Reference: https://stackoverflow.com/questions/27723423/youtube-iframe-embed-full-screen + attributes["allowfullscreen"] = ""; + } else if (kind === fastn_dom.ElementKind.Image) { + node = "img"; + } else if (kind === fastn_dom.ElementKind.Video) { + node = "video"; + } else if ( + kind === fastn_dom.ElementKind.ContainerElement || + kind === fastn_dom.ElementKind.Text + ) { + node = "div"; + } else if (kind === fastn_dom.ElementKind.Rive) { + node = "canvas"; + } else if (kind === fastn_dom.ElementKind.CheckBox) { + node = "input"; + attributes["type"] = "checkbox"; + } else if (kind === fastn_dom.ElementKind.TextInput) { + node = "input"; + } else if (kind === fastn_dom.ElementKind.Comment) { + node = fastn_dom.commentNode; + } else if (kind === fastn_dom.ElementKind.Wrapper) { + node = fastn_dom.wrapperNode; + } else if (kind === fastn_dom.ElementKind.Code) { + node = "pre"; + } else if (kind === fastn_dom.ElementKind.CodeChild) { + node = "code"; + } else if (kind[0] === fastn_dom.ElementKind.WebComponent()[0]) { + let [webcomponent, args] = kind[1]; + node = `${webcomponent}`; + fastn_dom.webComponent.push(args); + attributes[fastn_dom.webComponentArgument] = + fastn_dom.webComponent.length - 1; + } + return [node, css, attributes]; + }, + createStyle(cssClass, obj) { + if (doubleBuffering) { + fastn_dom.styleClasses = `${ + fastn_dom.styleClasses + }${getClassAsString(cssClass, obj)}\n`; + } else { + let styles = document.getElementById("styles"); + let newClasses = getClassAsString(cssClass, obj); + let textNode = document.createTextNode(newClasses); + if (styles.styleSheet) { + styles.styleSheet.cssText = newClasses; + } else { + styles.appendChild(textNode); + } + } + }, + getStaticValue(obj) { + if (obj instanceof fastn.mutableClass) { + return this.getStaticValue(obj.get()); + } else if (obj instanceof fastn.mutableListClass) { + return obj.getList(); + } /* + Todo: Make this work + else if (obj instanceof fastn.recordInstanceClass) { + return obj.getAllFields(); + }*/ else { + return obj; + } + }, + getInheritedValues(default_args, inherited, function_args) { + let record_fields = { + colors: ftd.default_colors.getClone().setAndReturn("is_root", true), + types: ftd.default_types.getClone().setAndReturn("is_root", true), + }; + Object.assign(record_fields, default_args); + let fields = {}; + if (inherited instanceof fastn.recordInstanceClass) { + fields = inherited.getClonedFields(); + if (fastn_utils.getStaticValue(fields["colors"].get("is_root"))) { + delete fields.colors; + } + if (fastn_utils.getStaticValue(fields["types"].get("is_root"))) { + delete fields.types; + } + } + Object.assign(record_fields, fields); + Object.assign(record_fields, function_args); + return fastn.recordInstance({ + ...record_fields, + }); + }, + removeNonFastnClasses(node) { + let classList = node.getNode().classList; + let extraCodeData = node.getExtraData().code; + let iterativeClassList = classList; + if (ssr) { + iterativeClassList = iterativeClassList.getClasses(); + } + const internalClassNames = Object.values(fastn_dom.InternalClass); + const classesToRemove = []; + + for (const className of iterativeClassList) { + if ( + !className.startsWith("__") && + !internalClassNames.includes(className) && + className !== extraCodeData?.language && + className !== extraCodeData?.theme + ) { + classesToRemove.push(className); + } + } + + for (const classNameToRemove of classesToRemove) { + classList.remove(classNameToRemove); + } + }, + staticToMutables(obj) { + if ( + !(obj instanceof fastn.mutableClass) && + !(obj instanceof fastn.mutableListClass) && + !(obj instanceof fastn.recordInstanceClass) + ) { + if (Array.isArray(obj)) { + let list = []; + for (let index in obj) { + list.push(fastn_utils.staticToMutables(obj[index])); + } + return fastn.mutableList(list); + } else if (obj instanceof Object) { + let fields = {}; + for (let objKey in obj) { + fields[objKey] = fastn_utils.staticToMutables(obj[objKey]); + } + return fastn.recordInstance(fields); + } else { + return fastn.mutable(obj); + } + } else { + return obj; + } + }, + getFlattenStaticValue(obj) { + let staticValue = fastn_utils.getStaticValue(obj); + if (Array.isArray(staticValue)) { + return staticValue.map((func) => + fastn_utils.getFlattenStaticValue(func.item), + ); + } /* + Todo: Make this work + else if (typeof staticValue === 'object' && fastn_utils.isNull(staticValue)) { + return Object.fromEntries( + Object.entries(staticValue).map(([k,v]) => + [k, fastn_utils.getFlattenStaticValue(v)] + ) + ); + }*/ + return staticValue; + }, + getter(value) { + if (value instanceof fastn.mutableClass) { + return value.get(); + } else { + return value; + } + }, + // Todo: Merge getterByKey with getter + getterByKey(value, index) { + if ( + value instanceof fastn.mutableClass || + value instanceof fastn.recordInstanceClass + ) { + return value.get(index); + } else if (value instanceof fastn.mutableListClass) { + return value.get(index).item; + } else { + return value; + } + }, + setter(variable, value) { + if (!fastn_utils.isNull(variable) && variable.set) { + variable.set(value); + return true; + } + return false; + }, + defaultPropertyValue(_propertyValue) { + return null; + }, + sameResponsiveRole(desktop, mobile) { + return ( + desktop.get("font_family") === mobile.get("font_family") && + desktop.get("letter_spacing") === mobile.get("letter_spacing") && + desktop.get("line_height") === mobile.get("line_height") && + desktop.get("size") === mobile.get("size") && + desktop.get("weight") === mobile.get("weight") + ); + }, + getRoleValues(value) { + let font_families = fastn_utils.getStaticValue( + value.get("font_family"), + ); + if (Array.isArray(font_families)) + font_families = font_families + .map((obj) => fastn_utils.getStaticValue(obj.item)) + .join(", "); + return { + "font-family": font_families, + "letter-spacing": fastn_utils.getStaticValue( + value.get("letter_spacing"), + ), + "font-size": fastn_utils.getStaticValue(value.get("size")), + "font-weight": fastn_utils.getStaticValue(value.get("weight")), + "line-height": fastn_utils.getStaticValue(value.get("line_height")), + }; + }, + clone(value) { + if (value === null || value === undefined) { + return value; + } + if ( + value instanceof fastn.mutableClass || + value instanceof fastn.mutableListClass + ) { + return value.getClone(); + } + if (value instanceof fastn.recordInstanceClass) { + return value.getClone(); + } + return value; + }, + getListItem(value) { + if (value === undefined) { + return null; + } + if (value instanceof Object && value.hasOwnProperty("item")) { + value = value.item; + } + return value; + }, + getEventKey(event) { + if (65 <= event.keyCode && event.keyCode <= 90) { + return String.fromCharCode(event.keyCode).toLowerCase(); + } else { + return event.key; + } + }, + createNestedObject(currentObject, path, value) { + const properties = path.split("."); + + for (let i = 0; i < properties.length - 1; i++) { + let property = fastn_utils.private.addUnderscoreToStart( + properties[i], + ); + if (currentObject instanceof fastn.recordInstanceClass) { + if (currentObject.get(property) === undefined) { + currentObject.set(property, fastn.recordInstance({})); + } + currentObject = currentObject.get(property).get(); + } else { + if (!currentObject.hasOwnProperty(property)) { + currentObject[property] = fastn.recordInstance({}); + } + currentObject = currentObject[property]; + } + } + + const innermostProperty = properties[properties.length - 1]; + if (currentObject instanceof fastn.recordInstanceClass) { + currentObject.set(innermostProperty, value); + } else { + currentObject[innermostProperty] = value; + } + }, + /** + * Takes an input string and processes it as inline markdown using the + * 'marked' library. The function removes the last occurrence of + * wrapping

    tags (i.e.

    tag found at the end) from the result and + * adjusts spaces around the content. + * + * @param {string} i - The input string to be processed as inline markdown. + * @returns {string} - The processed string with inline markdown. + */ + markdown_inline(i) { + if (fastn_utils.isNull(i)) return; + i = i.toString(); + const { space_before, space_after } = fastn_utils.private.spaces(i); + const o = (() => { + let g = fastn_utils.private.replace_last_occurrence( + marked.parse(i), + "

    ", + "", + ); + g = fastn_utils.private.replace_last_occurrence(g, "

    ", ""); + return g; + })(); + return `${fastn_utils.private.repeated_space( + space_before, + )}${o}${fastn_utils.private.repeated_space(space_after)}`.replace( + /\n+$/, + "", + ); + }, + + process_post_markdown(node, body) { + if (!ssr) { + const divElement = document.createElement("div"); + divElement.innerHTML = body; + + const current_node = node; + const colorClasses = Array.from(current_node.classList).filter( + (className) => className.startsWith("__c"), + ); + const roleClasses = Array.from(current_node.classList).filter( + (className) => className.startsWith("__rl"), + ); + const tableElements = Array.from( + divElement.getElementsByTagName("table"), + ); + const codeElements = Array.from( + divElement.getElementsByTagName("code"), + ); + + tableElements.forEach((table) => { + colorClasses.forEach((colorClass) => { + table.classList.add(colorClass); + }); + }); + + codeElements.forEach((code) => { + roleClasses.forEach((roleClass) => { + var roleCls = "." + roleClass; + let role = fastn_dom.classes[roleCls]; + let roleValue = role["value"]; + let fontFamily = roleValue["font-family"]; + code.style.fontFamily = fontFamily; + }); + }); + + body = divElement.innerHTML; + } + return body; + }, + isNull(a) { + return a === null || a === undefined; + }, + isCommentNode(node) { + return node === fastn_dom.commentNode; + }, + isWrapperNode(node) { + return node === fastn_dom.wrapperNode; + }, + nextSibling(node, parent) { + // For Conditional DOM + while (Array.isArray(node)) { + node = node[node.length - 1]; + } + if (node.nextSibling) { + return node.nextSibling; + } + if (node.getNode && node.getNode().nextSibling !== undefined) { + return node.getNode().nextSibling; + } + return parent.getChildren().indexOf(node.getNode()) + 1; + }, + createNodeHelper(node, classes, attributes) { + let tagName = node; + let element = fastnVirtual.document.createElement(node); + for (let key in attributes) { + element.setAttribute(key, attributes[key]); + } + for (let c in classes) { + element.classList.add(classes[c]); + } + + return [tagName, element]; + }, + addCssFile(url) { + // Create a new link element + const linkElement = document.createElement("link"); + + // Set the attributes of the link element + linkElement.rel = "stylesheet"; + linkElement.href = url; + + // Append the link element to the head section of the document + document.head.appendChild(linkElement); + }, + addCodeTheme(theme) { + if (!fastn_dom.codeData.addedCssFile.includes(theme)) { + let themeCssUrl = fastn_dom.codeData.availableThemes[theme]; + fastn_utils.addCssFile(themeCssUrl); + fastn_dom.codeData.addedCssFile.push(theme); + } + }, + /** + * Searches for highlighter occurrences in the text, removes them, + * and returns the modified text along with highlighted line numbers. + * + * @param {string} text - The input text to process. + * @returns {{ modifiedText: string, highlightedLines: number[] }} + * Object containing modified text and an array of highlighted line numbers. + * + * @example + * const text = `/-- ftd.text: Hello ;; hello + * + * -- some-component: caption-value + * attr-name: attr-value ;; + * + * + * -- other-component: caption-value ;; + * attr-name: attr-value`; + * + * const result = findAndRemoveHighlighter(text); + * console.log(result.modifiedText); + * console.log(result.highlightedLines); + */ + findAndRemoveHighlighter(text) { + const lines = text.split("\n"); + const highlighter = ";; "; + const result = { + modifiedText: "", + highlightedLines: "", + }; + + let highlightedLines = []; + for (let i = 0; i < lines.length; i++) { + const line = lines[i]; + const highlighterIndex = line.indexOf(highlighter); + + if (highlighterIndex !== -1) { + highlightedLines.push(i + 1); // Adding 1 to convert to human-readable line numbers + result.modifiedText += + line.substring(0, highlighterIndex) + + line.substring(highlighterIndex + highlighter.length) + + "\n"; + } else { + result.modifiedText += line + "\n"; + } + } + + result.highlightedLines = + fastn_utils.private.mergeNumbers(highlightedLines); + + return result; + }, + getNodeValue(node) { + return node.getNode().value; + }, + getNodeCheckedState(node) { + return node.getNode().checked; + }, + setFullHeight() { + if (!ssr) { + document.body.style.height = `max(${document.documentElement.scrollHeight}px, 100%)`; + } + }, + resetFullHeight() { + if (!ssr) { + document.body.style.height = `100%`; + } + }, + highlightCode(codeElement, extraCodeData) { + if ( + !ssr && + !fastn_utils.isNull(extraCodeData.language) && + !fastn_utils.isNull(extraCodeData.theme) + ) { + Prism.highlightElement(codeElement); + } + }, + + //Taken from: https://byby.dev/js-slugify-string + slugify(str) { + return String(str) + .normalize("NFKD") // split accented characters into their base characters and diacritical marks + .replace(".", "-") + .replace(/[\u0300-\u036f]/g, "") // remove all the accents, which happen to be all in the \u03xx UNICODE block. + .trim() // trim leading or trailing whitespace + .toLowerCase() // convert to lowercase + .replace(/[^a-z0-9 -]/g, "") // remove non-alphanumeric characters + .replace(/\s+/g, "-") // replace spaces with hyphens + .replace(/-+/g, "-"); // remove consecutive hyphens + }, + + getEventListeners(node) { + return { + onclick: node.onclick, + onmouseleave: node.onmouseleave, + onmouseenter: node.onmouseenter, + oninput: node.oninput, + onblur: node.onblur, + onfocus: node.onfocus, + }; + }, + + flattenArray(arr) { + return fastn_utils.private.flattenArray([arr]); + }, + toSnakeCase(value) { + return value + .trim() + .split("") + .map((v, i) => { + const lowercased = v.toLowerCase(); + if (v == " ") { + return "_"; + } + if (v != lowercased && i > 0) { + return `_${lowercased}`; + } + return lowercased; + }) + .join(""); + }, + escapeHtmlInCode(str) { + return str.replace(/[<]/g, "<"); + }, + + escapeHtmlInMarkdown(str) { + if (typeof str !== "string") { + return str; + } + + let result = ""; + let ch_map = { + "<": "<", + ">": ">", + "&": "&", + '"': """, + "'": "'", + "/": "/", + }; + let foundBackTick = false; + for (var i = 0; i < str.length; i++) { + let current = str[i]; + if (current === "`") { + foundBackTick = !foundBackTick; + } + // Ignore escaping html inside backtick (as marked function + // escape html for backtick content): + // For instance: In `hello `, `<` and `>` should not be + // escaped. (`foundBackTick`) + // Also the `/` which is followed by `<` should be escaped. + // For instance: `</` should be escaped but `http://` should not + // be escaped. (`(current === '/' && !(i > 0 && str[i-1] === "<"))`) + if ( + foundBackTick || + (current === "/" && !(i > 0 && str[i - 1] === "<")) + ) { + result += current; + continue; + } + result += ch_map[current] ?? current; + } + return result; + }, + + // Used to initialize __args__ inside component and UDF js functions + getArgs(default_args, passed_args) { + // Note: arguments as variable name not allowed in strict mode + let args = default_args; + for (var arg in passed_args) { + if (!default_args.hasOwnProperty(arg)) { + args[arg] = passed_args[arg]; + continue; + } + if ( + default_args.hasOwnProperty(arg) && + fastn_utils.getStaticValue(passed_args[arg]) !== undefined + ) { + args[arg] = passed_args[arg]; + } + } + return args; + }, + + /** + * Replaces the children of `document.body` with the children from + * newChildrenWrapper and updates the styles based on the + * `fastn_dom.styleClasses`. + * + * @param {HTMLElement} newChildrenWrapper - The wrapper element + * containing the new children. + */ + replaceBodyStyleAndChildren(newChildrenWrapper) { + // Update styles based on `fastn_dom.styleClasses` + let styles = document.getElementById("styles"); + styles.innerHTML = fastn_dom.getClassesAsStringWithoutStyleTag(); + + // Replace the children of document.body with the children from + // newChildrenWrapper + fastn_utils.private.replaceChildren(document.body, newChildrenWrapper); + }, +}; + +fastn_utils.private = { + flattenArray(arr) { + return arr.reduce((acc, item) => { + return acc.concat( + Array.isArray(item) + ? fastn_utils.private.flattenArray(item) + : item, + ); + }, []); + }, + /** + * Helper function for `fastn_utils.markdown_inline` to find the number of + * spaces before and after the content. + * + * @param {string} s - The input string. + * @returns {Object} - An object with 'space_before' and 'space_after' properties + * representing the number of spaces before and after the content. + */ + spaces(s) { + let space_before = 0; + for (let i = 0; i < s.length; i++) { + if (s[i] !== " ") { + space_before = i; + break; + } + space_before = i + 1; + } + if (space_before === s.length) { + return { space_before, space_after: 0 }; + } + + let space_after = 0; + for (let i = s.length - 1; i >= 0; i--) { + if (s[i] !== " ") { + space_after = s.length - 1 - i; + break; + } + space_after = i + 1; + } + + return { space_before, space_after }; + }, + /** + * Helper function for `fastn_utils.markdown_inline` to replace the last + * occurrence of a substring in a string. + * + * @param {string} s - The input string. + * @param {string} old_word - The substring to be replaced. + * @param {string} new_word - The replacement substring. + * @returns {string} - The string with the last occurrence of 'old_word' replaced by 'new_word'. + */ + replace_last_occurrence(s, old_word, new_word) { + if (!s.includes(old_word)) { + return s; + } + + const idx = s.lastIndexOf(old_word); + return s.slice(0, idx) + new_word + s.slice(idx + old_word.length); + }, + /** + * Helper function for `fastn_utils.markdown_inline` to generate a string + * containing a specified number of spaces. + * + * @param {number} n - The number of spaces to be generated. + * @returns {string} - A string with 'n' spaces concatenated together. + */ + repeated_space(n) { + return Array.from({ length: n }, () => " ").join(""); + }, + /** + * Merges consecutive numbers in a comma-separated list into ranges. + * + * @param {string} input - Comma-separated list of numbers. + * @returns {string} Merged number ranges. + * + * @example + * const input = '1,2,3,5,6,7,8,9,11'; + * const output = mergeNumbers(input); + * console.log(output); // Output: '1-3,5-9,11' + */ + mergeNumbers(numbers) { + if (numbers.length === 0) { + return ""; + } + const mergedRanges = []; + + let start = numbers[0]; + let end = numbers[0]; + + for (let i = 1; i < numbers.length; i++) { + if (numbers[i] === end + 1) { + end = numbers[i]; + } else { + if (start === end) { + mergedRanges.push(start.toString()); + } else { + mergedRanges.push(`${start}-${end}`); + } + start = end = numbers[i]; + } + } + + if (start === end) { + mergedRanges.push(start.toString()); + } else { + mergedRanges.push(`${start}-${end}`); + } + + return mergedRanges.join(","); + }, + addUnderscoreToStart(text) { + if (/^\d/.test(text)) { + return "_" + text; + } + return text; + }, + + /** + * Replaces the children of a parent element with the children from a + * new children wrapper. + * + * @param {HTMLElement} parent - The parent element whose children will + * be replaced. + * @param {HTMLElement} newChildrenWrapper - The wrapper element + * containing the new children. + * @returns {void} + */ + replaceChildren(parent, newChildrenWrapper) { + // Remove existing children of the parent + var children = parent.children; + // Loop through the direct children and remove those with tagName 'div' + for (var i = children.length - 1; i >= 0; i--) { + var child = children[i]; + if (child.tagName === "DIV") { + parent.removeChild(child); + } + } + + // Cut and append the children from newChildrenWrapper to the parent + while (newChildrenWrapper.firstChild) { + parent.appendChild(newChildrenWrapper.firstChild); + } + }, + + // Cookie related functions ---------------------------------------------- + setCookie(cookieName, cookieValue) { + cookieName = fastn_utils.getStaticValue(cookieName); + cookieValue = fastn_utils.getStaticValue(cookieValue); + + // Default expiration period of 30 days + var expires = ""; + var expirationDays = 30; + if (expirationDays) { + var date = new Date(); + date.setTime(date.getTime() + expirationDays * 24 * 60 * 60 * 1000); + expires = "; expires=" + date.toUTCString(); + } + + document.cookie = + cookieName + + "=" + + encodeURIComponent(cookieValue) + + expires + + "; path=/"; + }, + getCookie(cookieName) { + cookieName = fastn_utils.getStaticValue(cookieName); + var name = cookieName + "="; + var decodedCookie = decodeURIComponent(document.cookie); + var cookieArray = decodedCookie.split(";"); + + for (var i = 0; i < cookieArray.length; i++) { + var cookie = cookieArray[i].trim(); + if (cookie.indexOf(name) === 0) { + return cookie.substring(name.length, cookie.length); + } + } + + return "None"; + }, +}; + +/*Object.prototype.get = function(index) { + return this[index]; +}*/ +let fastnVirtual = {}; + +let id_counter = 0; +let ssr = false; +let doubleBuffering = false; + +class ClassList { + #classes = []; + add(item) { + this.#classes.push(item); + } + + remove(itemToRemove) { + this.#classes.filter((item) => item !== itemToRemove); + } + toString() { + return this.#classes.join(" "); + } + getClasses() { + return this.#classes; + } +} + +class Node { + id; + #dataId; + #tagName; + #children; + #attributes; + constructor(id, tagName) { + this.#tagName = tagName; + this.#dataId = id; + this.classList = new ClassList(); + this.#children = []; + this.#attributes = {}; + this.innerHTML = ""; + this.style = {}; + this.onclick = null; + this.id = null; + } + appendChild(c) { + this.#children.push(c); + } + + insertBefore(node, index) { + this.#children.splice(index, 0, node); + } + + getChildren() { + return this.#children; + } + + setAttribute(attribute, value) { + this.#attributes[attribute] = value; + } + + getAttribute(attribute) { + return this.#attributes[attribute]; + } + + removeAttribute(attribute) { + if (attribute in this.#attributes) delete this.#attributes[attribute]; + } + + // Caution: This is only supported in ssr mode + updateTagName(tagName) { + this.#tagName = tagName; + } + // Caution: This is only supported in ssr mode + toHtmlAsString() { + const openingTag = `<${ + this.#tagName + }${this.getDataIdString()}${this.getIdString()}${this.getAttributesString()}${this.getClassString()}${this.getStyleString()}>`; + const closingTag = `</${this.#tagName}>`; + const innerHTML = this.innerHTML; + const childNodes = this.#children + .map((child) => child.toHtmlAsString()) + .join(""); + + return `${openingTag}${innerHTML}${childNodes}${closingTag}`; + } + // Caution: This is only supported in ssr mode + getDataIdString() { + return ` data-id="${this.#dataId}"`; + } + // Caution: This is only supported in ssr mode + getIdString() { + return fastn_utils.isNull(this.id) ? "" : ` id="${this.id}"`; + } + // Caution: This is only supported in ssr mode + getClassString() { + const classList = this.classList.toString(); + return classList ? ` class="${classList}"` : ""; + } + // Caution: This is only supported in ssr mode + getStyleString() { + const styleProperties = Object.entries(this.style) + .map(([prop, value]) => `${prop}:${value}`) + .join(";"); + return styleProperties ? ` style="${styleProperties}"` : ""; + } + // Caution: This is only supported in ssr mode + getAttributesString() { + const nodeAttributes = Object.entries(this.#attributes) + .map(([attribute, value]) => { + if (value !== undefined && value !== null && value !== "") { + return `${attribute}=\"${value}\"`; + } + return `${attribute}`; + }) + .join(" "); + return nodeAttributes ? ` ${nodeAttributes}` : ""; + } +} + +class Document2 { + createElement(tagName) { + id_counter++; + + if (ssr) { + return new Node(id_counter, tagName); + } + + if (tagName === "body") { + return window.document.body; + } + + if (fastn_utils.isWrapperNode(tagName)) { + return window.document.createComment(fastn_dom.commentMessage); + } + if (fastn_utils.isCommentNode(tagName)) { + return window.document.createComment(fastn_dom.commentMessage); + } + return window.document.createElement(tagName); + } +} + +fastnVirtual.document = new Document2(); + +function addClosureToBreakpointWidth() { + let closure = fastn.closureWithoutExecute(function () { + let current = ftd.get_device(); + let lastDevice = ftd.device.get(); + if (current === lastDevice) { + return; + } + console.log("last_device", lastDevice, "current_device", current); + ftd.device.set(current); + }); + + ftd.breakpoint_width.addClosure(closure); +} + +fastnVirtual.doubleBuffer = function (main) { + addClosureToBreakpointWidth(); + let parent = document.createElement("div"); + let current_device = ftd.get_device(); + ftd.device = fastn.mutable(current_device); + doubleBuffering = true; + fastnVirtual.root = parent; + main(parent); + fastn_utils.replaceBodyStyleAndChildren(parent); + doubleBuffering = false; + fastnVirtual.root = document.body; +}; + +fastnVirtual.ssr = function (main) { + ssr = true; + let body = fastnVirtual.document.createElement("body"); + main(body); + ssr = false; + id_counter = 0; + return body.toHtmlAsString() + fastn_dom.getClassesAsString(); +}; +class MutableVariable { + #value; + constructor(value) { + this.#value = value; + } + + get() { + return fastn_utils.getStaticValue(this.#value); + } + + set(value) { + this.#value.set(value); + } + // Todo: Remove closure when node is removed. + on_change(func) { + this.#value.addClosure(fastn.closureWithoutExecute(func)); + } +} + +class MutableListVariable { + #value; + constructor(value) { + this.#value = value; + } + get() { + return fastn_utils.getStaticValue(this.#value); + } + set(index, list) { + if (list === undefined) { + this.#value.set(fastn_utils.staticToMutables(index)); + return; + } + this.#value.set(index, fastn_utils.staticToMutables(list)); + } + insertAt(index, value) { + this.#value.insertAt(index, fastn_utils.staticToMutables(value)); + } + deleteAt(index) { + this.#value.deleteAt(index); + } + push(value) { + this.#value.push(value); + } + pop() { + this.#value.pop(); + } + clearAll() { + this.#value.clearAll(); + } + on_change(func) { + this.#value.addClosure(fastn.closureWithoutExecute(func)); + } +} + +class RecordVariable { + #value; + constructor(value) { + this.#value = value; + } + + get() { + return fastn_utils.getStaticValue(this.#value); + } + + set(record) { + this.#value.set(fastn_utils.staticToMutables(record)); + } + + on_change(func) { + this.#value.addClosure(fastn.closureWithoutExecute(func)); + } +} +class StaticVariable { + #value; + #closures; + constructor(value) { + this.#value = value; + this.#closures = []; + if (this.#value instanceof fastn.mutableClass) { + this.#value.addClosure( + fastn.closure(() => + this.#closures.forEach((closure) => closure.update()), + ), + ); + } + } + + get() { + return fastn_utils.getStaticValue(this.#value); + } + + on_change(func) { + if (this.#value instanceof fastn.mutableClass) { + this.#value.addClosure(fastn.closure(func)); + } + } +} + +fastn.webComponentVariable = { + mutable: (value) => { + return new MutableVariable(value); + }, + mutableList: (value) => { + return new MutableListVariable(value); + }, + static: (value) => { + return new StaticVariable(value); + }, + record: (value) => { + return new RecordVariable(value); + }, +}; +const ftd = (function () { + const exports = {}; + + const riveNodes = {}; + + const global = {}; + + const onLoadListeners = new Set(); + + let fastnLoaded = false; + + exports.global = global; + + exports.riveNodes = riveNodes; + + exports.is_empty = (value) => { + value = fastn_utils.getFlattenStaticValue(value); + return fastn_utils.isNull(value) || value.length === 0; + }; + + exports.len = (data) => { + if (!!data && data instanceof fastn.mutableListClass) { + if (data.getLength) return data.getLength(); + return -1; + } + if (!!data && data instanceof fastn.mutableClass) { + let inner_data = data.get(); + return exports.len(inner_data); + } + if (!!data && data.length) { + return data.length; + } + return -2; + }; + + exports.copy_to_clipboard = (args) => { + let text = args.a; + if (text instanceof fastn.mutableClass) + text = fastn_utils.getStaticValue(text); + if (text.startsWith("\\", 0)) { + text = text.substring(1); + } + if (!navigator.clipboard) { + fallbackCopyTextToClipboard(text); + return; + } + navigator.clipboard.writeText(text).then( + function () { + console.log("Async: Copying to clipboard was successful!"); + }, + function (err) { + console.error("Async: Could not copy text: ", err); + }, + ); + }; + + // Todo: Implement this (Remove highlighter) + exports.clean_code = (args) => args.a; + + exports.set_rive_boolean = (args, node) => { + if (!!args.rive) { + let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; + node = riveNode ? riveNode : node; + } + let riveConst = node.getExtraData().rive; + const stateMachineName = riveConst.stateMachineNames[0]; + const inputs = riveConst.stateMachineInputs(stateMachineName); + const bumpTrigger = inputs.find((i) => i.name === args.input); + bumpTrigger.value = args.value; + }; + + exports.toggle_rive_boolean = (args, node) => { + if (!!args.rive) { + let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; + node = riveNode ? riveNode : node; + } + let riveConst = node.getExtraData().rive; + const stateMachineName = riveConst.stateMachineNames[0]; + const inputs = riveConst.stateMachineInputs(stateMachineName); + const trigger = inputs.find((i) => i.name === args.input); + trigger.value = !trigger.value; + }; + + exports.set_rive_integer = (args, node) => { + if (!!args.rive) { + let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; + node = riveNode ? riveNode : node; + } + let riveConst = node.getExtraData().rive; + const stateMachineName = riveConst.stateMachineNames[0]; + const inputs = riveConst.stateMachineInputs(stateMachineName); + const trigger = inputs.find((i) => i.name === args.input); + trigger.value = args.value; + }; + + exports.fire_rive = (args, node) => { + if (!!args.rive) { + let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; + node = riveNode ? riveNode : node; + } + let riveConst = node.getExtraData().rive; + const stateMachineName = riveConst.stateMachineNames[0]; + const inputs = riveConst.stateMachineInputs(stateMachineName); + const trigger = inputs.find((i) => i.name === args.input); + trigger.fire(); + }; + + exports.play_rive = (args, node) => { + if (!!args.rive) { + let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; + node = riveNode ? riveNode : node; + } + node.getExtraData().rive.play(args.input); + }; + + exports.pause_rive = (args, node) => { + if (!!args.rive) { + let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; + node = riveNode ? riveNode : node; + } + node.getExtraData().rive.pause(args.input); + }; + + exports.toggle_play_rive = (args, node) => { + if (!!args.rive) { + let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; + node = riveNode ? riveNode : node; + } + let riveConst = node.getExtraData().rive; + riveConst.playingAnimationNames.includes(args.input) + ? riveConst.pause(args.input) + : riveConst.play(args.input); + }; + + exports.get = (value, index) => { + return fastn_utils.getStaticValue( + fastn_utils.getterByKey(value, index), + ); + }; + + exports.component_data = (component) => { + let attributesIndex = component.getAttribute( + fastn_dom.webComponentArgument, + ); + let attributes = fastn_dom.webComponent[attributesIndex]; + return Object.fromEntries( + Object.entries(attributes).map(([k, v]) => { + // Todo: check if argument is mutable reference or not + if (v instanceof fastn.mutableClass) { + v = fastn.webComponentVariable.mutable(v); + } else if (v instanceof fastn.mutableListClass) { + v = fastn.webComponentVariable.mutableList(v); + } else if (v instanceof fastn.recordInstanceClass) { + v = fastn.webComponentVariable.record(v); + } else { + v = fastn.webComponentVariable.static(v); + } + return [k, v]; + }), + ); + }; + + exports.append = function (list, item) { + list.push(item); + }; + exports.pop = function (list) { + list.pop(); + }; + exports.insert_at = function (list, index, item) { + list.insertAt(index, item); + }; + exports.delete_at = function (list, index) { + list.deleteAt(index); + }; + exports.clear_all = function (list) { + list.clearAll(); + }; + exports.clear = exports.clear_all; + exports.set_list = function (list, value) { + list.set(value); + }; + + exports.http = function (url, opts, ...body) { + if ((!opts) instanceof fastn.recordInstanceClass) { + console.info(`opts must be a record instance of + -- record ftd.http-options: + string method: GET + string redirect: manual + string fastn-module: + `); + throw new Error("invalid opts"); + } + + let method = opts.get("method").get(); + let fastn_module = opts.get("fastn_module").get(); + let redirect = opts.get("redirect").get(); + + if (!["manual", "follow", "error"].includes(redirect)) { + throw new Error( + `redirect must be one of "manual", "follow", "error"`, + ); + } + + if (url instanceof fastn.mutableClass) url = url.get(); + method = method.trim().toUpperCase(); + let request_json = {}; + + const init = { + method, + headers: { "Content-Type": "application/json" }, + json: null, + redirect, + }; + + if (method === "GET") { + console.warn("Method `GET` is not yet supported."); + return; + } + + if (body && method !== "GET") { + if (body[0] instanceof fastn.recordInstanceClass) { + if (body.length !== 1) { + console.warn( + "body is a record instance, but has more than 1 element, ignoring", + ); + } + request_json = body[0].toObject(); + } else { + let json = body[0]; + if ( + body.length !== 1 || + (body[0].length === 2 && Array.isArray(body[0])) + ) { + let new_json = {}; + // @ts-ignore + for (let [header, value] of Object.entries(body)) { + let [key, val] = + value.length === 2 ? value : [header, value]; + new_json[key] = fastn_utils.getStaticValue(val); + } + json = new_json; + } + request_json = json; + } + } + + init.body = JSON.stringify(request_json); + + let json; + fetch(url, init) + .then((res) => { + if (res.redirected) { + window.location.href = res.url; + return; + } + + if (!res.ok) { + return new Error("[http]: Request failed", res); + } + + return res.json(); + }) + .then((response) => { + console.log("[http]: Response OK", response); + if (response.redirect) { + window.location.href = response.redirect; + } else if (!!response && !!response.reload) { + window.location.reload(); + } else { + let data = {}; + if (!!response.errors) { + for (let key of Object.keys(response.errors)) { + let value = response.errors[key]; + if (Array.isArray(value)) { + // django returns a list of strings + value = value.join(" "); + } + // also django does not append `-error` + key = key + "-error"; + key = fastn_module + "#" + key; + data[key] = value; + } + } + if (!!response.data) { + if (Object.keys(data).length !== 0) { + console.log( + "both .errors and .data are present in response, ignoring .data", + ); + } else { + data = response.data; + } + } + for (let ftd_variable of Object.keys(data)) { + // @ts-ignore + window.ftd.set_value(ftd_variable, data[ftd_variable]); + } + } + }) + .catch(console.error); + return json; + }; + + exports.navigate = function (url, request_data) { + let query_parameters = new URLSearchParams(); + if (request_data instanceof fastn.recordInstanceClass) { + // @ts-ignore + for (let [header, value] of Object.entries( + request_data.toObject(), + )) { + let [key, val] = value.length === 2 ? value : [header, value]; + query_parameters.set(key, val); + } + } + let query_string = query_parameters.toString(); + if (query_string) { + window.location.href = url + "?" + query_parameters.toString(); + } else { + window.location.href = url; + } + }; + + exports.toggle_dark_mode = function () { + const is_dark_mode = exports.get(exports.dark_mode); + if (is_dark_mode) { + enable_light_mode(); + } else { + enable_dark_mode(); + } + }; + + exports.local_storage = { + _get_key(key) { + if (key instanceof fastn.mutableClass) { + key = key.get(); + } + const packageNamePrefix = __fastn_package_name__ + ? `${__fastn_package_name__}_` + : ""; + const snakeCaseKey = fastn_utils.toSnakeCase(key); + + return `${packageNamePrefix}${snakeCaseKey}`; + }, + set(key, value) { + key = this._get_key(key); + value = fastn_utils.getFlattenStaticValue(value); + localStorage.setItem( + key, + value && typeof value === "object" + ? JSON.stringify(value) + : value, + ); + }, + get(key) { + key = this._get_key(key); + if (ssr) { + return; + } + const item = localStorage.getItem(key); + if (!item) { + return; + } + try { + const obj = JSON.parse(item); + + return fastn_utils.staticToMutables(obj); + } catch { + return item; + } + }, + delete(key) { + key = this._get_key(key); + localStorage.removeItem(key); + }, + }; + + exports.on_load = (listener) => { + if (typeof listener !== "function") { + throw new Error("listener must be a function"); + } + + if (fastnLoaded) { + listener(); + return; + } + + onLoadListeners.add(listener); + }; + + exports.emit_on_load = () => { + if (fastnLoaded) return; + + fastnLoaded = true; + onLoadListeners.forEach((listener) => listener()); + }; + + // LEGACY + + function legacyNameToJS(s) { + let name = s.toString(); + + if (name[0].charCodeAt(0) >= 48 && name[0].charCodeAt(0) <= 57) { + name = "_" + name; + } + + return name + .replaceAll("#", "__") + .replaceAll("-", "_") + .replaceAll(":", "___") + .replaceAll(",", "$") + .replaceAll("\\", "/") + .replaceAll("/", "_") + .replaceAll(".", "_"); + } + + function getDocNameAndRemaining(s) { + let part1 = ""; + let patternToSplitAt = s; + + const split1 = s.split("#"); + if (split1.length === 2) { + part1 = split1[0] + "#"; + patternToSplitAt = split1[1]; + } + + const split2 = patternToSplitAt.split("."); + if (split2.length === 2) { + return [part1 + split2[0], split2[1]]; + } else { + return [s, null]; + } + } + + function isMutable(obj) { + return ( + obj instanceof fastn.mutableClass || + obj instanceof fastn.mutableListClass || + obj instanceof fastn.recordInstanceClass + ); + } + + exports.set_value = function (variable, value) { + const [var_name, remaining] = getDocNameAndRemaining(variable); + let name = legacyNameToJS(var_name); + if (global[name] === undefined) { + console.log( + `[ftd-legacy]: ${variable} is not in global map, ignoring`, + ); + return; + } + const mutable = global[name]; + if (!isMutable(mutable)) { + console.log(`[ftd-legacy]: ${variable} is not a mutable, ignoring`); + return; + } + if (remaining) { + mutable.get(remaining).set(value); + } else { + mutable.set(value); + } + }; + + exports.get_value = function (variable) { + const [var_name, remaining] = getDocNameAndRemaining(variable); + let name = legacyNameToJS(var_name); + if (global[name] === undefined) { + console.log( + `[ftd-legacy]: ${variable} is not in global map, ignoring`, + ); + return; + } + const value = global[name]; + if (isMutable(value)) { + if (remaining) { + return value.get(remaining); + } else { + return value.get(); + } + } else { + return value; + } + }; + + // Language related functions --------------------------------------------- + exports.set_current_language = function (language) { + language = fastn_utils.getStaticValue(language); + fastn_utils.private.setCookie("fastn-lang", language); + location.reload(); + }; + + exports.get_current_language = function () { + return fastn_utils.private.getCookie("fastn-lang"); + }; + + return exports; +})(); + +const len = ftd.len; + +const global = ftd.global; +ftd.clickOutsideEvents = []; +ftd.globalKeyEvents = []; +ftd.globalKeySeqEvents = []; + +ftd.get_device = function () { + const MOBILE_CLASS = "mobile"; + // not at all sure about this function logic. + let width = window.innerWidth; + // In the future, we may want to have more than one break points, and + // then we may also want the theme builders to decide where the + // breakpoints should go. we should be able to fetch fpm variables + // here, or maybe simply pass the width, user agent etc. to fpm and + // let people put the checks on width user agent etc., but it would + // be good if we can standardize few breakpoints. or maybe we should + // do both, some standard breakpoints and pass the raw data. + // we would then rename this function to detect_device() which will + // return one of "desktop", "mobile". and also maybe have another + // function detect_orientation(), "landscape" and "portrait" etc., + // and instead of setting `ftd#mobile: boolean` we set `ftd#device` + // and `ftd#view-port-orientation` etc. + let mobile_breakpoint = fastn_utils.getStaticValue( + ftd.breakpoint_width.get("mobile"), + ); + if (width <= mobile_breakpoint) { + document.body.classList.add(MOBILE_CLASS); + return fastn_dom.DeviceData.Mobile; + } + if (document.body.classList.contains(MOBILE_CLASS)) { + document.body.classList.remove(MOBILE_CLASS); + } + return fastn_dom.DeviceData.Desktop; +}; + +ftd.post_init = function () { + const DARK_MODE_COOKIE = "fastn-dark-mode"; + const COOKIE_SYSTEM_LIGHT = "system-light"; + const COOKIE_SYSTEM_DARK = "system-dark"; + const COOKIE_DARK_MODE = "dark"; + const COOKIE_LIGHT_MODE = "light"; + const DARK_MODE_CLASS = "dark"; + let last_device = ftd.device.get(); + + window.onresize = function () { + initialise_device(); + }; + function initialise_click_outside_events() { + document.addEventListener("click", function (event) { + ftd.clickOutsideEvents.forEach(([ftdNode, func]) => { + let node = ftdNode.getNode(); + if ( + !!node && + node.style.display !== "none" && + !node.contains(event.target) + ) { + func(); + } + }); + }); + } + function initialise_global_key_events() { + let globalKeys = {}; + let buffer = []; + let lastKeyTime = Date.now(); + + document.addEventListener("keydown", function (event) { + let eventKey = fastn_utils.getEventKey(event); + globalKeys[eventKey] = true; + const currentTime = Date.now(); + if (currentTime - lastKeyTime > 1000) { + buffer = []; + } + lastKeyTime = currentTime; + if ( + (event.target.nodeName === "INPUT" || + event.target.nodeName === "TEXTAREA") && + eventKey !== "ArrowDown" && + eventKey !== "ArrowUp" && + eventKey !== "ArrowRight" && + eventKey !== "ArrowLeft" && + event.target.nodeName === "INPUT" && + eventKey !== "Enter" + ) { + return; + } + buffer.push(eventKey); + + ftd.globalKeyEvents.forEach(([_ftdNode, func, array]) => { + let globalKeysPresent = array.reduce( + (accumulator, currentValue) => + accumulator && !!globalKeys[currentValue], + true, + ); + if ( + globalKeysPresent && + buffer.join(",").includes(array.join(",")) + ) { + func(); + globalKeys[eventKey] = false; + buffer = []; + } + return; + }); + + ftd.globalKeySeqEvents.forEach(([_ftdNode, func, array]) => { + if (buffer.join(",").includes(array.join(","))) { + func(); + globalKeys[eventKey] = false; + buffer = []; + } + return; + }); + }); + + document.addEventListener("keyup", function (event) { + globalKeys[fastn_utils.getEventKey(event)] = false; + }); + } + function initialise_device() { + let current = ftd.get_device(); + if (current === last_device) { + return; + } + console.log("last_device", last_device, "current_device", current); + ftd.device.set(current); + last_device = current; + } + + /* + ftd.dark-mode behaviour: + + ftd.dark-mode is a boolean, default false, it tells the UI to show + the UI in dark or light mode. Themes should use this variable to decide + which mode to show in UI. + + ftd.follow-system-dark-mode, boolean, default true, keeps track if + we are reading the value of `dark-mode` from system preference, or user + has overridden the system preference. + + These two variables must not be set by ftd code directly, but they must + use `$on-click$: message-host enable-dark-mode`, to ignore system + preference and use dark mode. `$on-click$: message-host + disable-dark-mode` to ignore system preference and use light mode and + `$on-click$: message-host follow-system-dark-mode` to ignore user + preference and start following system preference. + + we use a cookie: `ftd-dark-mode` to store the preference. The cookie can + have three values: + + cookie missing / user wants us to honour system preference + system-light and currently its light. + + system-dark follow system and currently its dark. + + light: user prefers light + + dark: user prefers light + + We use cookie instead of localstorage so in future `fpm-repo` can see + users preferences up front and renders the HTML on service wide + following user's preference. + + */ + window.enable_dark_mode = function () { + // TODO: coalesce the two set_bool-s into one so there is only one DOM + // update + ftd.dark_mode.set(true); + ftd.follow_system_dark_mode.set(false); + ftd.system_dark_mode.set(system_dark_mode()); + document.body.classList.add(DARK_MODE_CLASS); + set_cookie(DARK_MODE_COOKIE, COOKIE_DARK_MODE); + }; + window.enable_light_mode = function () { + // TODO: coalesce the two set_bool-s into one so there is only one DOM + // update + ftd.dark_mode.set(false); + ftd.follow_system_dark_mode.set(false); + ftd.system_dark_mode.set(system_dark_mode()); + if (document.body.classList.contains(DARK_MODE_CLASS)) { + document.body.classList.remove(DARK_MODE_CLASS); + } + set_cookie(DARK_MODE_COOKIE, COOKIE_LIGHT_MODE); + }; + window.enable_system_mode = function () { + // TODO: coalesce the two set_bool-s into one so there is only one DOM + // update + let systemMode = system_dark_mode(); + ftd.follow_system_dark_mode.set(true); + ftd.system_dark_mode.set(systemMode); + if (systemMode) { + ftd.dark_mode.set(true); + document.body.classList.add(DARK_MODE_CLASS); + set_cookie(DARK_MODE_COOKIE, COOKIE_SYSTEM_DARK); + } else { + ftd.dark_mode.set(false); + if (document.body.classList.contains(DARK_MODE_CLASS)) { + document.body.classList.remove(DARK_MODE_CLASS); + } + set_cookie(DARK_MODE_COOKIE, COOKIE_SYSTEM_LIGHT); + } + }; + function set_cookie(name, value) { + document.cookie = name + "=" + value + "; path=/"; + } + function system_dark_mode() { + return !!( + window.matchMedia && + window.matchMedia("(prefers-color-scheme: dark)").matches + ); + } + function initialise_dark_mode() { + update_dark_mode(); + start_watching_dark_mode_system_preference(); + } + function get_cookie(name, def) { + // source: https://stackoverflow.com/questions/5639346/ + let regex = document.cookie.match( + "(^|;)\\s*" + name + "\\s*=\\s*([^;]+)", + ); + return regex !== null ? regex.pop() : def; + } + function update_dark_mode() { + let current_dark_mode_cookie = get_cookie( + DARK_MODE_COOKIE, + COOKIE_SYSTEM_LIGHT, + ); + switch (current_dark_mode_cookie) { + case COOKIE_SYSTEM_LIGHT: + case COOKIE_SYSTEM_DARK: + window.enable_system_mode(); + break; + case COOKIE_LIGHT_MODE: + window.enable_light_mode(); + break; + case COOKIE_DARK_MODE: + window.enable_dark_mode(); + break; + default: + console_log("cookie value is wrong", current_dark_mode_cookie); + window.enable_system_mode(); + } + } + function start_watching_dark_mode_system_preference() { + window + .matchMedia("(prefers-color-scheme: dark)") + .addEventListener("change", update_dark_mode); + } + initialise_device(); + initialise_dark_mode(); + initialise_click_outside_events(); + initialise_global_key_events(); + fastn_utils.resetFullHeight(); + fastn_utils.setFullHeight(); +}; + +window.ftd = ftd; + +ftd.toggle = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + let fastn_utils_val___args___a = fastn_utils.clone(!fastn_utils.getStaticValue(__args__.a)); + if (fastn_utils_val___args___a instanceof fastn.mutableClass) { + fastn_utils_val___args___a = fastn_utils_val___args___a.get(); + } + if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { + __args__.a = fastn_utils_val___args___a; + } + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.increment = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + let fastn_utils_val___args___a = fastn_utils.clone(fastn_utils.getStaticValue(__args__.a) + 1); + if (fastn_utils_val___args___a instanceof fastn.mutableClass) { + fastn_utils_val___args___a = fastn_utils_val___args___a.get(); + } + if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { + __args__.a = fastn_utils_val___args___a; + } + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.increment_by = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + let fastn_utils_val___args___a = fastn_utils.clone(fastn_utils.getStaticValue(__args__.a) + fastn_utils.getStaticValue(__args__.v)); + if (fastn_utils_val___args___a instanceof fastn.mutableClass) { + fastn_utils_val___args___a = fastn_utils_val___args___a.get(); + } + if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { + __args__.a = fastn_utils_val___args___a; + } + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.decrement = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + let fastn_utils_val___args___a = fastn_utils.clone(fastn_utils.getStaticValue(__args__.a) - 1); + if (fastn_utils_val___args___a instanceof fastn.mutableClass) { + fastn_utils_val___args___a = fastn_utils_val___args___a.get(); + } + if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { + __args__.a = fastn_utils_val___args___a; + } + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.decrement_by = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + let fastn_utils_val___args___a = fastn_utils.clone(fastn_utils.getStaticValue(__args__.a) - fastn_utils.getStaticValue(__args__.v)); + if (fastn_utils_val___args___a instanceof fastn.mutableClass) { + fastn_utils_val___args___a = fastn_utils_val___args___a.get(); + } + if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { + __args__.a = fastn_utils_val___args___a; + } + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.enable_light_mode = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + return (enable_light_mode()); + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.enable_dark_mode = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + return (enable_dark_mode()); + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.enable_system_mode = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + return (enable_system_mode()); + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.set_bool = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + let fastn_utils_val___args___a = fastn_utils.clone(__args__.v); + if (fastn_utils_val___args___a instanceof fastn.mutableClass) { + fastn_utils_val___args___a = fastn_utils_val___args___a.get(); + } + if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { + __args__.a = fastn_utils_val___args___a; + } + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.set_boolean = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + let fastn_utils_val___args___a = fastn_utils.clone(__args__.v); + if (fastn_utils_val___args___a instanceof fastn.mutableClass) { + fastn_utils_val___args___a = fastn_utils_val___args___a.get(); + } + if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { + __args__.a = fastn_utils_val___args___a; + } + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.set_string = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + let fastn_utils_val___args___a = fastn_utils.clone(__args__.v); + if (fastn_utils_val___args___a instanceof fastn.mutableClass) { + fastn_utils_val___args___a = fastn_utils_val___args___a.get(); + } + if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { + __args__.a = fastn_utils_val___args___a; + } + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.set_integer = function (args) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + let fastn_utils_val___args___a = fastn_utils.clone(__args__.v); + if (fastn_utils_val___args___a instanceof fastn.mutableClass) { + fastn_utils_val___args___a = fastn_utils_val___args___a.get(); + } + if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { + __args__.a = fastn_utils_val___args___a; + } + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +ftd.dark_mode = fastn.mutable(false); +ftd.empty = ""; +ftd.space = " "; +ftd.nbsp = " "; +ftd.non_breaking_space = " "; +ftd.system_dark_mode = fastn.mutable(false); +ftd.follow_system_dark_mode = fastn.mutable(true); +ftd.font_display = fastn.mutable("sans-serif"); +ftd.font_copy = fastn.mutable("sans-serif"); +ftd.font_code = fastn.mutable("sans-serif"); +ftd.default_types = function () { + let record = fastn.recordInstance({ + }); + record.set("heading_large", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(50)); + record.set("line_height", fastn_dom.FontSize.Px(65)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(36)); + record.set("line_height", fastn_dom.FontSize.Px(54)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + record.set("heading_medium", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(38)); + record.set("line_height", fastn_dom.FontSize.Px(57)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(26)); + record.set("line_height", fastn_dom.FontSize.Px(40)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + record.set("heading_small", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(24)); + record.set("line_height", fastn_dom.FontSize.Px(31)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(22)); + record.set("line_height", fastn_dom.FontSize.Px(29)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + record.set("heading_hero", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(80)); + record.set("line_height", fastn_dom.FontSize.Px(104)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(48)); + record.set("line_height", fastn_dom.FontSize.Px(64)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + record.set("heading_tiny", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(20)); + record.set("line_height", fastn_dom.FontSize.Px(26)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(18)); + record.set("line_height", fastn_dom.FontSize.Px(24)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + record.set("copy_small", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(14)); + record.set("line_height", fastn_dom.FontSize.Px(24)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_copy); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(12)); + record.set("line_height", fastn_dom.FontSize.Px(16)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_copy); + return record; + }()); + return record; + }()); + record.set("copy_regular", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(18)); + record.set("line_height", fastn_dom.FontSize.Px(30)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_copy); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(16)); + record.set("line_height", fastn_dom.FontSize.Px(24)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_copy); + return record; + }()); + return record; + }()); + record.set("copy_large", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(22)); + record.set("line_height", fastn_dom.FontSize.Px(34)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_copy); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(18)); + record.set("line_height", fastn_dom.FontSize.Px(28)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_copy); + return record; + }()); + return record; + }()); + record.set("fine_print", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(12)); + record.set("line_height", fastn_dom.FontSize.Px(16)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_code); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(12)); + record.set("line_height", fastn_dom.FontSize.Px(16)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_code); + return record; + }()); + return record; + }()); + record.set("blockquote", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(16)); + record.set("line_height", fastn_dom.FontSize.Px(21)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_code); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(16)); + record.set("line_height", fastn_dom.FontSize.Px(21)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_code); + return record; + }()); + return record; + }()); + record.set("source_code", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(18)); + record.set("line_height", fastn_dom.FontSize.Px(30)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_code); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(16)); + record.set("line_height", fastn_dom.FontSize.Px(21)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_code); + return record; + }()); + return record; + }()); + record.set("button_small", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(14)); + record.set("line_height", fastn_dom.FontSize.Px(19)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(14)); + record.set("line_height", fastn_dom.FontSize.Px(19)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + record.set("button_medium", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(16)); + record.set("line_height", fastn_dom.FontSize.Px(21)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(16)); + record.set("line_height", fastn_dom.FontSize.Px(21)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + record.set("button_large", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(18)); + record.set("line_height", fastn_dom.FontSize.Px(24)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(18)); + record.set("line_height", fastn_dom.FontSize.Px(24)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + record.set("link", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(14)); + record.set("line_height", fastn_dom.FontSize.Px(19)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(14)); + record.set("line_height", fastn_dom.FontSize.Px(19)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + record.set("label_large", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(14)); + record.set("line_height", fastn_dom.FontSize.Px(19)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(14)); + record.set("line_height", fastn_dom.FontSize.Px(19)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + record.set("label_small", function () { + let record = fastn.recordInstance({ + }); + record.set("desktop", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(12)); + record.set("line_height", fastn_dom.FontSize.Px(16)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + record.set("mobile", function () { + let record = fastn.recordInstance({ + }); + record.set("size", fastn_dom.FontSize.Px(12)); + record.set("line_height", fastn_dom.FontSize.Px(16)); + record.set("letter_spacing", null); + record.set("weight", 400); + record.set("font_family", ftd.font_display); + return record; + }()); + return record; + }()); + return record; +}(); +ftd.default_colors = function () { + let record = fastn.recordInstance({ + }); + record.set("background", function () { + let record = fastn.recordInstance({ + }); + record.set("base", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#e7e7e4"); + record.set("dark", "#18181b"); + return record; + }()); + record.set("step_1", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#f3f3f3"); + record.set("dark", "#141414"); + return record; + }()); + record.set("step_2", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#c9cece"); + record.set("dark", "#585656"); + return record; + }()); + record.set("overlay", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "rgba(0, 0, 0, 0.8)"); + record.set("dark", "rgba(0, 0, 0, 0.8)"); + return record; + }()); + record.set("code", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#F5F5F5"); + record.set("dark", "#21222C"); + return record; + }()); + return record; + }()); + record.set("border", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#434547"); + record.set("dark", "#434547"); + return record; + }()); + record.set("border_strong", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#919192"); + record.set("dark", "#919192"); + return record; + }()); + record.set("text", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#584b42"); + record.set("dark", "#a8a29e"); + return record; + }()); + record.set("text_strong", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#141414"); + record.set("dark", "#ffffff"); + return record; + }()); + record.set("shadow", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#007f9b"); + record.set("dark", "#007f9b"); + return record; + }()); + record.set("scrim", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#007f9b"); + record.set("dark", "#007f9b"); + return record; + }()); + record.set("cta_primary", function () { + let record = fastn.recordInstance({ + }); + record.set("base", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#2dd4bf"); + record.set("dark", "#2dd4bf"); + return record; + }()); + record.set("hover", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#2c9f90"); + record.set("dark", "#2c9f90"); + return record; + }()); + record.set("pressed", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#2cc9b5"); + record.set("dark", "#2cc9b5"); + return record; + }()); + record.set("disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "rgba(44, 201, 181, 0.1)"); + record.set("dark", "rgba(44, 201, 181, 0.1)"); + return record; + }()); + record.set("focused", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#2cbfac"); + record.set("dark", "#2cbfac"); + return record; + }()); + record.set("border", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#2b8074"); + record.set("dark", "#2b8074"); + return record; + }()); + record.set("border_disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#65b693"); + record.set("dark", "#65b693"); + return record; + }()); + record.set("text", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#feffff"); + record.set("dark", "#feffff"); + return record; + }()); + record.set("text_disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#65b693"); + record.set("dark", "#65b693"); + return record; + }()); + return record; + }()); + record.set("cta_secondary", function () { + let record = fastn.recordInstance({ + }); + record.set("base", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#4fb2df"); + record.set("dark", "#4fb2df"); + return record; + }()); + record.set("hover", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#40afe1"); + record.set("dark", "#40afe1"); + return record; + }()); + record.set("pressed", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#4fb2df"); + record.set("dark", "#4fb2df"); + return record; + }()); + record.set("disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "rgba(79, 178, 223, 0.1)"); + record.set("dark", "rgba(79, 178, 223, 0.1)"); + return record; + }()); + record.set("focused", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#4fb1df"); + record.set("dark", "#4fb1df"); + return record; + }()); + record.set("border", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#209fdb"); + record.set("dark", "#209fdb"); + return record; + }()); + record.set("border_disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#65b693"); + record.set("dark", "#65b693"); + return record; + }()); + record.set("text", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#584b42"); + record.set("dark", "#ffffff"); + return record; + }()); + record.set("text_disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#65b693"); + record.set("dark", "#65b693"); + return record; + }()); + return record; + }()); + record.set("cta_tertiary", function () { + let record = fastn.recordInstance({ + }); + record.set("base", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#556375"); + record.set("dark", "#556375"); + return record; + }()); + record.set("hover", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#c7cbd1"); + record.set("dark", "#c7cbd1"); + return record; + }()); + record.set("pressed", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#3b4047"); + record.set("dark", "#3b4047"); + return record; + }()); + record.set("disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "rgba(85, 99, 117, 0.1)"); + record.set("dark", "rgba(85, 99, 117, 0.1)"); + return record; + }()); + record.set("focused", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#e0e2e6"); + record.set("dark", "#e0e2e6"); + return record; + }()); + record.set("border", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#e2e4e7"); + record.set("dark", "#e2e4e7"); + return record; + }()); + record.set("border_disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#65b693"); + record.set("dark", "#65b693"); + return record; + }()); + record.set("text", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#ffffff"); + record.set("dark", "#ffffff"); + return record; + }()); + record.set("text_disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#65b693"); + record.set("dark", "#65b693"); + return record; + }()); + return record; + }()); + record.set("cta_danger", function () { + let record = fastn.recordInstance({ + }); + record.set("base", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#1C1B1F"); + record.set("dark", "#1C1B1F"); + return record; + }()); + record.set("hover", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#1C1B1F"); + record.set("dark", "#1C1B1F"); + return record; + }()); + record.set("pressed", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#1C1B1F"); + record.set("dark", "#1C1B1F"); + return record; + }()); + record.set("disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#1C1B1F"); + record.set("dark", "#1C1B1F"); + return record; + }()); + record.set("focused", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#1C1B1F"); + record.set("dark", "#1C1B1F"); + return record; + }()); + record.set("border", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#1C1B1F"); + record.set("dark", "#1C1B1F"); + return record; + }()); + record.set("border_disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#feffff"); + record.set("dark", "#feffff"); + return record; + }()); + record.set("text", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#1C1B1F"); + record.set("dark", "#1C1B1F"); + return record; + }()); + record.set("text_disabled", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#feffff"); + record.set("dark", "#feffff"); + return record; + }()); + return record; + }()); + record.set("accent", function () { + let record = fastn.recordInstance({ + }); + record.set("primary", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#2dd4bf"); + record.set("dark", "#2dd4bf"); + return record; + }()); + record.set("secondary", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#4fb2df"); + record.set("dark", "#4fb2df"); + return record; + }()); + record.set("tertiary", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#c5cbd7"); + record.set("dark", "#c5cbd7"); + return record; + }()); + return record; + }()); + record.set("error", function () { + let record = fastn.recordInstance({ + }); + record.set("base", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#f5bdbb"); + record.set("dark", "#311b1f"); + return record; + }()); + record.set("text", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#c62a21"); + record.set("dark", "#c62a21"); + return record; + }()); + record.set("border", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#df2b2b"); + record.set("dark", "#df2b2b"); + return record; + }()); + return record; + }()); + record.set("success", function () { + let record = fastn.recordInstance({ + }); + record.set("base", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#e3f0c4"); + record.set("dark", "#405508ad"); + return record; + }()); + record.set("text", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#467b28"); + record.set("dark", "#479f16"); + return record; + }()); + record.set("border", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#3d741f"); + record.set("dark", "#3d741f"); + return record; + }()); + return record; + }()); + record.set("info", function () { + let record = fastn.recordInstance({ + }); + record.set("base", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#c4edfd"); + record.set("dark", "#15223a"); + return record; + }()); + record.set("text", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#205694"); + record.set("dark", "#1f6feb"); + return record; + }()); + record.set("border", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#205694"); + record.set("dark", "#205694"); + return record; + }()); + return record; + }()); + record.set("warning", function () { + let record = fastn.recordInstance({ + }); + record.set("base", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#fbefba"); + record.set("dark", "#544607a3"); + return record; + }()); + record.set("text", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#966220"); + record.set("dark", "#d07f19"); + return record; + }()); + record.set("border", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#966220"); + record.set("dark", "#966220"); + return record; + }()); + return record; + }()); + record.set("custom", function () { + let record = fastn.recordInstance({ + }); + record.set("one", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#ed753a"); + record.set("dark", "#ed753a"); + return record; + }()); + record.set("two", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#f3db5f"); + record.set("dark", "#f3db5f"); + return record; + }()); + record.set("three", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#8fdcf8"); + record.set("dark", "#8fdcf8"); + return record; + }()); + record.set("four", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#7a65c7"); + record.set("dark", "#7a65c7"); + return record; + }()); + record.set("five", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#eb57be"); + record.set("dark", "#eb57be"); + return record; + }()); + record.set("six", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#ef8dd6"); + record.set("dark", "#ef8dd6"); + return record; + }()); + record.set("seven", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#7564be"); + record.set("dark", "#7564be"); + return record; + }()); + record.set("eight", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#d554b3"); + record.set("dark", "#d554b3"); + return record; + }()); + record.set("nine", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#ec8943"); + record.set("dark", "#ec8943"); + return record; + }()); + record.set("ten", function () { + let record = fastn.recordInstance({ + }); + record.set("light", "#da7a4a"); + record.set("dark", "#da7a4a"); + return record; + }()); + return record; + }()); + return record; +}(); +ftd.breakpoint_width = function () { + let record = fastn.recordInstance({ + }); + record.set("mobile", 768); + return record; +}(); +ftd.device = fastn.mutable(fastn_dom.DeviceData.Mobile); +let inherited = function () { + let record = fastn.recordInstance({ + }); + record.set("colors", ftd.default_colors.getClone().setAndReturn("is_root", true)); + record.set("types", ftd.default_types.getClone().setAndReturn("is_root", true)); + return record; +}(); diff --git a/fastn-core/tests/22-http-headers/output/index.ftd b/fastn-core/tests/22-http-headers/output/index.ftd new file mode 100644 index 0000000000..a28d9716c0 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/index.ftd @@ -0,0 +1,74 @@ +-- import: fastn/processors as pr + +-- record auth-response: +string token: + +-- record user-response: +integer id: +string username: +string email: +string firstName: +string lastName: + + + +-- auth-response auth-res: +$processor$: pr.http +method: post +url: https://dummyjson.com/auth/login +username: kminchelle +password: 0lelplR +$header-content-type$: application/json + + + +-- string bearer-token: $join(a = Bearer, b = *$auth-res.token) + + + +-- user-response user-res: +$processor$: pr.http +method: get +url: https://dummyjson.com/auth/me +$header-authorization$: $bearer-token + + + +-- display-user: $user-res + + + +-- string join(a, b): +string a: +string b: + +a + " " + b + + + +-- component display-user: +caption user-res user: + +-- ftd.column: + +-- ftd.row: +spacing.fixed.rem: 1 + +-- ftd.text: Username: + +-- ftd.text: $user-res.username + +-- end: ftd.row + +-- ftd.row: +spacing.fixed.rem: 1 + +-- ftd.text: Email: + +-- ftd.text: $user-res.email + +-- end: ftd.row + +-- end: ftd.column + +-- end: display-user diff --git a/fastn-core/tests/22-http-headers/output/index.html b/fastn-core/tests/22-http-headers/output/index.html new file mode 100644 index 0000000000..86f8b10af4 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/index.html @@ -0,0 +1,474 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="UTF-8"> + <base href="/"> + <meta content="fastn" name="generator"> + + + <script> + let __fastn_package_name__ = "fastn-stack.github.io/http-headers-test"; + + </script> + + + <script src="markdown-24E09EFC0C2B9A11DEA9AC71888EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js"></script> + <script src="prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js"></script> + <script src="default-B66C2B8914832538F78C67C1C127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js"></script> + <link rel="stylesheet" href="prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css"> + + + + + <style> + /* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) + */ + +/*html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +!* HTML5 display-role reset for older browsers *! +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +}*/ + +*, :after, :before { + /*box-sizing: inherit;*/ + box-sizing: border-box; + text-decoration: none; + box-sizing: border-box; + border-top-width: 0px; + border-bottom-width: 0px; + border-left-width: 0px; + border-right-width: 0px; + border-style: solid; + height: auto; + width: auto; +} + +*, pre, div { + padding: 0; + margin: 0; + gap: 0; + outline: none; +} + + +body, ol ol, ol ul, ul ol, ul ul { + margin:0 +} +pre, table{ + overflow:auto +} +html { + height: 100%; + width: 100%; +} + +body { + height: 100%; + width: 100%; +} + +input { + vertical-align: middle; +} +pre { + white-space: break-spaces; + word-wrap: break-word; +} +html { + -webkit-font-smoothing: antialiased; + text-rendering: optimizelegibility; + -webkit-text-size-adjust: 100%; + text-size-adjust: 100%; +} +iframe { + border: 0; + color-scheme: auto; +} + +pre code { + /* + This break show-line-number in `ftd.code` + overflow-x: auto; + */ + display: block; + padding: 0 1em !important; +} + +/* Common styles */ +.ft_common{ + text-decoration: none; + box-sizing: border-box; + border-top-width: 0px; + border-bottom-width: 0px; + border-left-width: 0px; + border-right-width: 0px; + border-style: solid; + height: auto; + width: auto; +} + +/* Common container attributes */ +.ft_row, .ft_column { + display: flex; + align-items: start; + justify-content: start +} + +.ft_full_size { + width: 100%; + height: 100%; +} + +.ft_row { + display: flex; + align-items: start; + justify-content: start; + flex-direction: row; + box-sizing: border-box; +} +.ft_column { + display: flex; + align-items: start; + justify-content: start; + flex-direction: column; + box-sizing: border-box; +} + +.ft_row { + flex-direction: row; +} + +.ft_column { + flex-direction: column; +} + +.ft_md ul, +.ft_md ol{ + margin: 10px 0; +} + +.ft_md ul ul, +.ft_md ul ol, +.ft_md ol ul, +.ft_md ol ol { + margin: 0; +} + +.ft_md ul li, +.ft_md ol li, +.ft_md ul ol li .ft_md ul ul li .ft_md ol ul li .ft_md ol ol li { + position: relative; + padding-left: 32px; + margin: 4px 0; +} + +.ft_md ul { + list-style: none; + padding-left: 0; +} + +.ft_md ol { + list-style: none; + padding-left: 0; + counter-reset: item; +} + +.ft_md ol li:before, +.ft_md ol ol li:before, +.ft_md ul ol li:before { + content: counter(item); + counter-increment: item; + font-size: 11px; + line-height: 10px; + text-align: center; + padding: 4px 0; + height: 10px; + width: 18px; + border-radius: 10px; + position: absolute; + left: 0; + top: 5px; +} + +.ft_md ul li::before, +.ft_md ul ul li::before, +.ft_md ol ul li::before { + content: ""; + position: absolute; + width: 6px; + height: 6px; + left: 8px; + top: 10px; + border-radius: 50%; + background: #c1c8ce; +} + +ul, ol { + /* Added padding to the left to move the ol number/ ul bullet to the right */ + padding-left: 20px; +} + +a { + color: #2952a3; +} + +a:visited { + color: #856ab9; +} + +a:hover { + color: #24478f; +} + +.ft_md a { + text-decoration: none; +} + +.ft_md a:visited { + text-decoration: none; +} + +.ft_md a:hover { + text-decoration: none; +} + +code { + padding: 0.1rem 0.25rem; + border-radius: 4px; + background-color: #0000000d; +} + +.ft_md blockquote { + padding: 0.25rem 1rem; + margin: 1rem 0; + border-radius: 3px; +} + +.ft_md blockquote > blockquote { + margin: 0; +} + + +body.dark code { + padding: 0.1rem 0.25rem; + border-radius: 4px; + background-color: #ffffff1f; +} + + +body.dark a { + color: #6498ff +} + +body.dark a:visited { + color: #b793fb; +} + + +p { + margin-block-end: 1em; +} + +h1:only-child { + margin-block-end: 0.67em +} + +table, td, th { + border: 1px solid; +} + +th { + padding: 6px; +} + +td { + padding-left: 6px; + padding-right: 6px; + padding-top: 3px; + padding-bottom: 3px; +} + + </style> +</head> +<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> +<body data-id="1"><div data-id="2" class="ft_column __w-1 __h-2"><div data-id="3" class="ft_column"><div data-id="4" class="ft_row __g-3"><div data-id="5">Username:</div><div data-id="6">kminchelle</div></div><div data-id="7" class="ft_row __g-4"><div data-id="8">Email:</div><div data-id="9"><a href="mailto:kminchelle@qq.com">kminchelle@qq.com</a></div></div></div></div></body><style id="styles"> + .__w-1 { width: 100%; } + .__h-2 { height: 100%; } + .__g-3 { gap: 1rem; } + .__g-4 { gap: 1rem; } + </style> +<script> + (function() { + let main = function (parent) { + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let parenti0 = fastn_stack_github_io_http_headers_test___display_user(parent, inherited, { + user: global.fastn_stack_github_io_http_headers_test___user_res + }); + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +global["main"] = main; +let fastn_stack_github_io_http_headers_test___join = function (args) +{ + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = fastn_utils.getArgs({ + }, args); + return (fastn_utils.getStaticValue(__args__.a) + " " + fastn_utils.getStaticValue(__args__.b)); + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +global["fastn_stack_github_io_http_headers_test___join"] = fastn_stack_github_io_http_headers_test___join; +fastn_utils.createNestedObject(global, "fastn_stack_github_io_http_headers_test___auth_res", function () { + let record = fastn.recordInstance({ + }); + record.set("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTUsInVzZXJuYW1lIjoia21pbmNoZWxsZSIsImVtYWlsIjoia21pbmNoZWxsZUBxcS5jb20iLCJmaXJzdE5hbWUiOiJKZWFubmUiLCJsYXN0TmFtZSI6IkhhbHZvcnNvbiIsImdlbmRlciI6ImZlbWFsZSIsImltYWdlIjoiaHR0cHM6Ly9yb2JvaGFzaC5vcmcvSmVhbm5lLnBuZz9zZXQ9c2V0NCIsImlhdCI6MTcwOTEwMzk5MywiZXhwIjoxNzA5MTA3NTkzfQ.LHCuTT1UCGiuS5D3F4tvmlbYuO2nnIOlSG-W2sAoXGo"); + return record; +}()); +fastn_utils.createNestedObject(global, "fastn_stack_github_io_http_headers_test___bearer_token", fastn.formula([global.fastn_stack_github_io_http_headers_test___auth_res.get("token")], function () { + return fastn_stack_github_io_http_headers_test___join({ + a: "Bearer", + b: fastn_utils.clone(global.fastn_stack_github_io_http_headers_test___auth_res.get("token")), + }); +})); +fastn_utils.createNestedObject(global, "fastn_stack_github_io_http_headers_test___user_res", function () { + let record = fastn.recordInstance({ + }); + record.set("id", 15); + record.set("username", "kminchelle"); + record.set("email", "kminchelle@qq.com"); + record.set("firstName", "Jeanne"); + record.set("lastName", "Halvorson"); + return record; +}()); +let fastn_stack_github_io_http_headers_test___display_user = function (parent, inherited, args) +{ + let __fastn_super_package_name__ = __fastn_package_name__; + __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; + try { + let __args__ = { + }; + inherited = fastn_utils.getInheritedValues(__args__, inherited, args); + __args__ = fastn_utils.getArgs(__args__, args); + let parenti0 = fastn_dom.createKernel(parent, fastn_dom.ElementKind.Column); + parenti0.setProperty(fastn_dom.PropertyKind.Children, fastn.mutableList([function (root, inherited) { + let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Row); + rooti0.setProperty(fastn_dom.PropertyKind.Spacing, fastn_dom.Spacing.Fixed(fastn_dom.Length.Rem(1)), inherited); + rooti0.setProperty(fastn_dom.PropertyKind.Children, fastn.mutableList([function (root, inherited) { + let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Text); + rooti0.setProperty(fastn_dom.PropertyKind.StringValue, "Username:", inherited); + }, + function (root, inherited) { + let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Text); + rooti0.setProperty(fastn_dom.PropertyKind.StringValue, global.fastn_stack_github_io_http_headers_test___user_res.get("username"), inherited); + } + ]), inherited); + }, + function (root, inherited) { + let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Row); + rooti0.setProperty(fastn_dom.PropertyKind.Spacing, fastn_dom.Spacing.Fixed(fastn_dom.Length.Rem(1)), inherited); + rooti0.setProperty(fastn_dom.PropertyKind.Children, fastn.mutableList([function (root, inherited) { + let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Text); + rooti0.setProperty(fastn_dom.PropertyKind.StringValue, "Email:", inherited); + }, + function (root, inherited) { + let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Text); + rooti0.setProperty(fastn_dom.PropertyKind.StringValue, global.fastn_stack_github_io_http_headers_test___user_res.get("email"), inherited); + } + ]), inherited); + } + ]), inherited); + return parenti0; + } finally { + __fastn_package_name__ = __fastn_super_package_name__; + } +} +global["fastn_stack_github_io_http_headers_test___display_user"] = fastn_stack_github_io_http_headers_test___display_user; +fastn_dom.codeData.availableThemes["coldark-theme.dark"] = "code-theme-9A3284FD117DFF7CFD432FF860A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css"; +fastn_dom.codeData.availableThemes["coldark-theme.light"] = "code-theme-99CD7B013C96C4632F0AEA39AC265387B814AE85A7D33666A4AE4BEFF59016D0.css"; +fastn_dom.codeData.availableThemes["coy-theme"] = "code-theme-B3AEA322EADEDA61F0E219845A0E9C8E73F6345E49362B46E6F52CEE40471248.css"; +fastn_dom.codeData.availableThemes["dracula-theme"] = "code-theme-0CA636E4954E3FC6184FB8000174F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css"; +fastn_dom.codeData.availableThemes["duotone-theme.dark"] = "code-theme-95B9118AFC8631777EEBBD89B2066C3706A6DF3579B14F41AF05564E41CAA09C.css"; +fastn_dom.codeData.availableThemes["duotone-theme.earth"] = "code-theme-6EB6F03F9F578742CA0CD1189693E43A6135D910989ADD88CA3C0D6117EE24D7.css"; +fastn_dom.codeData.availableThemes["duotone-theme.forest"] = "code-theme-256C21B515FC9E77F95D88689A4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css"; +fastn_dom.codeData.availableThemes["duotone-theme.light"] = "code-theme-0800A18B1822D6AFDAF807CF840379A2DB3483A1F058CA29FBCFB3815CA76148.css"; +fastn_dom.codeData.availableThemes["duotone-theme.sea"] = "code-theme-9A45313F167DBD90654BFD5BB3BC0BDF6AE447485C30B0389ADA7B49C069E46A.css"; +fastn_dom.codeData.availableThemes["duotone-theme.space"] = "code-theme-4DD8479BE14A755645BC09FF433FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css"; +fastn_dom.codeData.availableThemes["fastn-theme.dark"] = "code-theme-F614177D3155EA8E915B35A3445175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css"; +fastn_dom.codeData.availableThemes["fastn-theme.light"] = "code-theme-B8645DE281A38A3068C56919DE1BB0511696A1EE8002C5088748DA0BAC0806E6.css"; +fastn_dom.codeData.availableThemes["fire.light"] = "code-theme-A352AF572179AB980583D41BC41ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css"; +fastn_dom.codeData.availableThemes["gruvbox-theme.dark"] = "code-theme-B68AA27E05B319F04A9CD747AADBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css"; +fastn_dom.codeData.availableThemes["gruvbox-theme.light"] = "code-theme-06E6F84E43C61CB1653D9F4FACD46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css"; +fastn_dom.codeData.availableThemes["laserwave-theme"] = "code-theme-0F444C6433C356376F7E92122F6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css"; +fastn_dom.codeData.availableThemes["material-theme.dark"] = "code-theme-8CCA3D600F91FA55950DF3132F2ABE4BA14CEEA13CD23E157BF6A137762B8452.css"; +fastn_dom.codeData.availableThemes["material-theme.light"] = "code-theme-8C59190F5018F48CCBB063359072EE9053D04923BBC5D1BA52B574E78D8C536A.css"; +fastn_dom.codeData.availableThemes["nightowl-theme"] = "code-theme-88F91252A8A0EA125B4BA2C7B85E65580DB580F1477931AADCB5118E4E69D1CD.css"; +fastn_dom.codeData.availableThemes["one-theme.dark"] = "code-theme-A24DC8F09D03756A62923E8A883CAE3B938D54E2813F0855312D2554DBE97BAD.css"; +fastn_dom.codeData.availableThemes["one-theme.light"] = "code-theme-60E02531E77333F3F1B636C4FC43E976EA9F41AD75268B2DD825C33C68B573A6.css"; +fastn_dom.codeData.availableThemes["vs-theme.dark"] = "code-theme-DC76F700474E809F7BA2D9914793D04881B17EA4699BA9C568C83D32A18B0173.css"; +fastn_dom.codeData.availableThemes["vs-theme.light"] = "code-theme-7852E516BA094B01897820BB3432BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css"; +fastn_dom.codeData.availableThemes["ztouch-theme"] = "code-theme-792C7BB9F4C8DFF3E0CBC354D2084DBF71BC5750C2C1357F0E7D936867AFAB62.css"; + + let main_wrapper = function (parent) { + let parenti0 = fastn_dom.createKernel(parent, fastn_dom.ElementKind.Column); + parenti0.setProperty(fastn_dom.PropertyKind.Width, fastn_dom.Resizing.FillContainer, inherited); + parenti0.setProperty(fastn_dom.PropertyKind.Height, fastn_dom.Resizing.FillContainer, inherited); + main(parenti0); + } + fastnVirtual.doubleBuffer(main_wrapper); + ftd.post_init(); + })(); + + window.onload = function() { + fastn_utils.resetFullHeight(); + fastn_utils.setFullHeight(); + ftd.emit_on_load(); + }; +</script> +</html> diff --git a/fastn-core/tests/22-http-headers/output/manifest.json b/fastn-core/tests/22-http-headers/output/manifest.json new file mode 100644 index 0000000000..5ddd3edb15 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/manifest.json @@ -0,0 +1,16 @@ +{ + "files": { + "FASTN.ftd": { + "name": "FASTN.ftd", + "checksum": "743D9D38F836501B012A0CA4E75088B044DFCC64BDEB7D2476FF7A0952AE7AB1", + "size": 76 + }, + "index.ftd": { + "name": "index.ftd", + "checksum": "AAF986E8B3997246D6245240806C24547E0355D9A60258A2C72B3DBFFA54DAAD", + "size": 971 + } + }, + "zip_url": "https://codeload.github.com/fastn-stack/http-headers-test/zip/refs/heads/main", + "checksum": "E078712E2CC94F6F264CA98AEC6509BE579AC5C8BD329A6B9A72FB25435E525E" +} diff --git a/fastn-core/tests/22-http-headers/output/markdown-24E09EFC0C2B9A11DEA9AC71888EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js b/fastn-core/tests/22-http-headers/output/markdown-24E09EFC0C2B9A11DEA9AC71888EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js new file mode 100644 index 0000000000..eaa08fabf4 --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/markdown-24E09EFC0C2B9A11DEA9AC71888EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js @@ -0,0 +1,7 @@ +/** + * marked v9.1.4 - a markdown parser + * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed) + * https://github.com/markedjs/marked + */ +// Content taken from https://cdn.jsdelivr.net/npm/marked/marked.min.js +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,(function(e){"use strict";function t(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function n(t){e.defaults=t}e.defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};const s=/[&<>"']/,r=new RegExp(s.source,"g"),i=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,l=new RegExp(i.source,"g"),o={"&":"&","<":"<",">":">",'"':""","'":"'"},a=e=>o[e];function c(e,t){if(t){if(s.test(e))return e.replace(r,a)}else if(i.test(e))return e.replace(l,a);return e}const h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;const p=/(^|[^\[])\^/g;function u(e,t){e="string"==typeof e?e:e.source,t=t||"";const n={replace:(t,s)=>(s=(s="object"==typeof s&&"source"in s?s.source:s).replace(p,"$1"),e=e.replace(t,s),n),getRegex:()=>new RegExp(e,t)};return n}function g(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const k={exec:()=>null};function f(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let s=!1,r=t;for(;--r>=0&&"\\"===n[r];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(/\\\|/g,"|");return n}function d(e,t,n){const s=e.length;if(0===s)return"";let r=0;for(;r<s;){const i=e.charAt(s-r-1);if(i!==t||n){if(i===t||!n)break;r++}else r++}return e.slice(0,s-r)}function x(e,t,n,s){const r=t.href,i=t.title?c(t.title):null,l=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:n,href:r,title:i,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,e}return{type:"image",raw:n,href:r,title:i,text:c(l)}}class b{options;rules;lexer;constructor(t){this.options=t||e.defaults}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:d(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const s=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=d(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=d(t[0].replace(/^ *>[ \t]?/gm,""),"\n"),n=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const i=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let l="",o="",a=!1;for(;e;){let n=!1;if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;l=t[0],e=e.substring(l.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,o=s.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,o=s.slice(h),h+=t[1].length);let p=!1;if(!s&&/^ *$/.test(c)&&(l+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),r=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),i=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;e;){const a=e.split("\n",1)[0];if(c=a,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),r.test(c))break;if(i.test(c))break;if(t.test(c))break;if(n.test(e))break;if(c.search(/[^ ]/)>=h||!c.trim())o+="\n"+c.slice(h);else{if(p)break;if(s.search(/[^ ]/)>=4)break;if(r.test(s))break;if(i.test(s))break;if(n.test(s))break;o+="\n"+c}p||c.trim()||(p=!0),l+=a+"\n",e=e.substring(a.length+1),s=c.slice(h)}}r.loose||(a?r.loose=!0:/\n *\n *$/.test(l)&&(a=!0));let u,g=null;this.options.gfm&&(g=/^\[[ xX]\] /.exec(o),g&&(u="[ ] "!==g[0],o=o.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:l,task:!!g,checked:u,loose:!1,text:o,tokens:[]}),r.raw+=l}r.items[r.items.length-1].raw=l.trimEnd(),r.items[r.items.length-1].text=o.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e<r.items.length;e++)if(this.lexer.state.top=!1,r.items[e].tokens=this.lexer.blockTokens(r.items[e].text,[]),!r.loose){const t=r.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e<r.items.length;e++)r.items[e].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(t){if(!/[:|]/.test(t[2]))return;const e={type:"table",raw:t[0],header:f(t[1]).map((e=>({text:e,tokens:[]}))),align:t[2].replace(/^\||\| *$/g,"").split("|"),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){let t,n,s,r,i=e.align.length;for(t=0;t<i;t++){const n=e.align[t];n&&(/^ *-+: *$/.test(n)?e.align[t]="right":/^ *:-+: *$/.test(n)?e.align[t]="center":/^ *:-+ *$/.test(n)?e.align[t]="left":e.align[t]=null)}for(i=e.rows.length,t=0;t<i;t++)e.rows[t]=f(e.rows[t],e.header.length).map((e=>({text:e,tokens:[]})));for(i=e.header.length,n=0;n<i;n++)e.header[n].tokens=this.lexer.inline(e.header[n].text);for(i=e.rows.length,n=0;n<i;n++)for(r=e.rows[n],s=0;s<r.length;s++)r[s].tokens=this.lexer.inline(r[s].text);return e}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:c(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=d(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let s=0;s<e.length;s++)if("\\"===e[s])s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),x(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return x(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrong.lDelim.exec(e);if(!s)return;if(s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let r,i,l=n,o=0;const a="*"===s[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+s[0].length-1);null!=(s=a.exec(t));){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(i=[...r].length,s[3]||s[4]){l+=i;continue}if((s[5]||s[6])&&n%3&&!((n+i)%3)){o+=i;continue}if(l-=i,l>0)continue;i=Math.min(i,i+l+o);const t=[...e].slice(0,n+s.index+i+1).join("");if(Math.min(n,i)%2){const e=t.slice(1,-1);return{type:"em",raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}const a=t.slice(2,-2);return{type:"strong",raw:t,text:a,tokens:this.lexer.inlineTokens(a)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return n&&s&&(e=e.substring(1,e.length-1)),e=c(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=c(t[1]),n="mailto:"+e):(e=c(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=c(t[0]),n="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])[0]}while(s!==t[0]);e=c(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:c(t[0]),{type:"text",raw:t[0],text:e}}}}const m={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:k,lheading:/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};m.def=u(m.def).replace("label",m._label).replace("title",m._title).getRegex(),m.bullet=/(?:[*+-]|\d{1,9}[.)])/,m.listItemStart=u(/^( *)(bull) */).replace("bull",m.bullet).getRegex(),m.list=u(m.list).replace(/bull/g,m.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+m.def.source+")").getRegex(),m._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",m._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,m.html=u(m.html,"i").replace("comment",m._comment).replace("tag",m._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),m.lheading=u(m.lheading).replace(/bull/g,m.bullet).getRegex(),m.paragraph=u(m._paragraph).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.blockquote=u(m.blockquote).replace("paragraph",m.paragraph).getRegex(),m.normal={...m},m.gfm={...m.normal,table:"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"},m.gfm.table=u(m.gfm.table).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.gfm.paragraph=u(m._paragraph).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",m.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.pedantic={...m.normal,html:u("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",m._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:k,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(m.normal._paragraph).replace("hr",m.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",m.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const w={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:k,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:k,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^((?![*_])[\spunctuation])/,_punctuation:"\\p{P}$+<=>`^|~"};w.punctuation=u(w.punctuation,"u").replace(/punctuation/g,w._punctuation).getRegex(),w.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,w.anyPunctuation=/\\[punct]/g,w._escapes=/\\([punct])/g,w._comment=u(m._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),w.emStrong.lDelim=u(w.emStrong.lDelim,"u").replace(/punct/g,w._punctuation).getRegex(),w.emStrong.rDelimAst=u(w.emStrong.rDelimAst,"gu").replace(/punct/g,w._punctuation).getRegex(),w.emStrong.rDelimUnd=u(w.emStrong.rDelimUnd,"gu").replace(/punct/g,w._punctuation).getRegex(),w.anyPunctuation=u(w.anyPunctuation,"gu").replace(/punct/g,w._punctuation).getRegex(),w._escapes=u(w._escapes,"gu").replace(/punct/g,w._punctuation).getRegex(),w._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,w._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,w.autolink=u(w.autolink).replace("scheme",w._scheme).replace("email",w._email).getRegex(),w._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,w.tag=u(w.tag).replace("comment",w._comment).replace("attribute",w._attribute).getRegex(),w._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,w._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,w._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,w.link=u(w.link).replace("label",w._label).replace("href",w._href).replace("title",w._title).getRegex(),w.reflink=u(w.reflink).replace("label",w._label).replace("ref",m._label).getRegex(),w.nolink=u(w.nolink).replace("ref",m._label).getRegex(),w.reflinkSearch=u(w.reflinkSearch,"g").replace("reflink",w.reflink).replace("nolink",w.nolink).getRegex(),w.normal={...w},w.pedantic={...w.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",w._label).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",w._label).getRegex()},w.gfm={...w.normal,escape:u(w.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},w.gfm.url=u(w.gfm.url,"i").replace("email",w.gfm._extended_email).getRegex(),w.breaks={...w.gfm,br:u(w.br).replace("{2,}","*").getRegex(),text:u(w.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};class _{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||e.defaults,this.options.tokenizer=this.options.tokenizer||new b,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:m.normal,inline:w.normal};this.options.pedantic?(n.block=m.pedantic,n.inline=w.pedantic):this.options.gfm&&(n.block=m.gfm,this.options.breaks?n.inline=w.breaks:n.inline=w.gfm),this.tokenizer.rules=n}static get rules(){return{block:m,inline:w}}static lex(e,t){return new _(t).lex(e)}static lexInline(e,t){return new _(t).inlineTokens(e)}lex(e){let t;for(e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){let n,s,r,i;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(n):(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(s.raw+="\n"+n.raw,s.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(r=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r)))s=t[t.length-1],i&&"paragraph"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),i=r.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,r,i,l,o,a=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(a));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(a));)a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(a));)a=a.slice(0,i.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(o=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,a,o))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(r=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),l=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class y{options;constructor(t){this.options=t||e.defaults}code(e,t,n){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="language-'+c(s)+'">'+(n?e:c(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:c(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,n){const s=t?"ol":"ul";return"<"+s+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+s+">\n"}listitem(e,t,n){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const s=g(e);if(null===s)return n;let r='<a href="'+(e=s)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){const s=g(e);if(null===s)return n;let r=`<img src="${e=s}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(e){return e}}class ${strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class z{options;renderer;textRenderer;constructor(t){this.options=t||e.defaults,this.options.renderer=this.options.renderer||new y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new $}static parse(e,t){return new z(t).parse(e)}static parseInline(e,t){return new z(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}switch(r.type){case"space":continue;case"hr":n+=this.renderer.hr();continue;case"heading":{const e=r;n+=this.renderer.heading(this.parseInline(e.tokens),e.depth,this.parseInline(e.tokens,this.textRenderer).replace(h,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")));continue}case"code":{const e=r;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=r;let t="",s="";for(let t=0;t<e.header.length;t++)s+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(s);let i="";for(let t=0;t<e.rows.length;t++){const n=e.rows[t];s="";for(let t=0;t<n.length;t++)s+=this.renderer.tablecell(this.parseInline(n[t].tokens),{header:!1,align:e.align[t]});i+=this.renderer.tablerow(s)}n+=this.renderer.table(t,i);continue}case"blockquote":{const e=r,t=this.parse(e.tokens);n+=this.renderer.blockquote(t);continue}case"list":{const e=r,t=e.ordered,s=e.start,i=e.loose;let l="";for(let t=0;t<e.items.length;t++){const n=e.items[t],s=n.checked,r=n.task;let o="";if(n.task){const e=this.renderer.checkbox(!!s);i?n.tokens.length>0&&"paragraph"===n.tokens[0].type?(n.tokens[0].text=e+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&"text"===n.tokens[0].tokens[0].type&&(n.tokens[0].tokens[0].text=e+" "+n.tokens[0].tokens[0].text)):n.tokens.unshift({type:"text",text:e+" "}):o+=e+" "}o+=this.parse(n.tokens,i),l+=this.renderer.listitem(o,r,!!s)}n+=this.renderer.list(l,t,s);continue}case"html":{const e=r;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=r;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let i=r,l=i.tokens?this.parseInline(i.tokens):i.text;for(;s+1<e.length&&"text"===e[s+1].type;)i=e[++s],l+="\n"+(i.tokens?this.parseInline(i.tokens):i.text);n+=t?this.renderer.paragraph(l):l;continue}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=e||"";continue}}switch(r.type){case"escape":{const e=r;n+=t.text(e.text);break}case"html":{const e=r;n+=t.html(e.text);break}case"link":{const e=r;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=r;n+=t.image(e.href,e.title,e.text);break}case"strong":{const e=r;n+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=r;n+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=r;n+=t.codespan(e.text);break}case"br":n+=t.br();break;case"del":{const e=r;n+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=r;n+=t.text(e.text);break}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class T{options;constructor(t){this.options=t||e.defaults}static passThroughHooks=new Set(["preprocess","postprocess"]);preprocess(e){return e}postprocess(e){return e}}class R{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(_.lex,z.parse);parseInline=this.#e(_.lexInline,z.parseInline);Parser=z;parser=z.parse;Renderer=y;TextRenderer=$;Lexer=_;lexer=_.lex;Tokenizer=b;Hooks=T;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{const e=s;for(const s of e.header)n=n.concat(this.walkTokens(s.tokens,t));for(const s of e.rows)for(const e of s)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=s;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=s;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((s=>{n=n.concat(this.walkTokens(e[s],t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=n.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new y(this.defaults);for(const n in e.renderer){const s=e.renderer[n],r=n,i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new b(this.defaults);for(const n in e.tokenizer){const s=e.tokenizer[n],r=n,i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new T;for(const n in e.hooks){const s=e.hooks[n],r=n,i=t[r];T.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(s.call(t,e)).then((e=>i.call(t,e)));const n=s.call(t,e);return i.call(t,n)}:t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(s.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}#e(e,t){return(n,s)=>{const r={...s},i={...this.defaults,...r};!0===this.defaults.async&&!1===r.async&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const l=this.#t(!!i.silent,!!i.async);if(null==n)return l(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then((t=>e(t,i))).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>t(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(l);try{i.hooks&&(n=i.hooks.preprocess(n));const s=e(n,i);i.walkTokens&&this.walkTokens(s,i.walkTokens);let r=t(s,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return l(e)}}}#t(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+c(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}}const S=new R;function A(e,t){return S.parse(e,t)}A.options=A.setOptions=function(e){return S.setOptions(e),A.defaults=S.defaults,n(A.defaults),A},A.getDefaults=t,A.defaults=e.defaults,A.use=function(...e){return S.use(...e),A.defaults=S.defaults,n(A.defaults),A},A.walkTokens=function(e,t){return S.walkTokens(e,t)},A.parseInline=S.parseInline,A.Parser=z,A.parser=z.parse,A.Renderer=y,A.TextRenderer=$,A.Lexer=_,A.lexer=_.lex,A.Tokenizer=b,A.Hooks=T,A.parse=A;const I=A.options,E=A.setOptions,Z=A.use,q=A.walkTokens,L=A.parseInline,D=A,P=z.parse,v=_.lex;e.Hooks=T,e.Lexer=_,e.Marked=R,e.Parser=z,e.Renderer=y,e.TextRenderer=$,e.Tokenizer=b,e.getDefaults=t,e.lexer=v,e.marked=A,e.options=I,e.parse=D,e.parseInline=L,e.parser=P,e.setOptions=E,e.use=Z,e.walkTokens=q})); diff --git a/fastn-core/tests/22-http-headers/output/prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css b/fastn-core/tests/22-http-headers/output/prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css new file mode 100644 index 0000000000..991195e60e --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css @@ -0,0 +1,61 @@ +/* +https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-highlight.css - a Prism provide line-highlight CSS +Copyright (c) 2012 Lea Verou (MIT Licensed) +https://github.com/PrismJS/prism/releases/tag/v1.29.0 +https://github.com/PrismJS/prism + +Content taken from https://raw.githubusercontent.com/PrismJS/prism/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-highlight.min.css +*/ + +pre[data-line]{position:relative;padding:1em 0 1em 3em}.line-highlight{position:absolute;left:0;right:0;padding:inherit 0;margin-top:1em;background:hsla(24,20%,50%,.08);background:linear-gradient(to right,hsla(24,20%,50%,.1) 70%,hsla(24,20%,50%,0));pointer-events:none;line-height:inherit;white-space:pre}@media print{.line-highlight{-webkit-print-color-adjust:exact;color-adjust:exact}}.line-highlight:before,.line-highlight[data-end]:after{content:attr(data-start);position:absolute;top:.4em;left:.6em;min-width:1em;padding:0 .5em;background-color:hsla(24,20%,50%,.4);color:#f4f1ef;font:bold 65%/1.5 sans-serif;text-align:center;vertical-align:.3em;border-radius:999px;text-shadow:none;box-shadow:0 1px #fff}.line-highlight[data-end]:after{content:attr(data-end);top:auto;bottom:.4em}.line-numbers .line-highlight:after,.line-numbers .line-highlight:before{content:none}pre[id].linkable-line-numbers span.line-numbers-rows{pointer-events:all}pre[id].linkable-line-numbers span.line-numbers-rows>span:before{cursor:pointer}pre[id].linkable-line-numbers span.line-numbers-rows>span:hover:before{background-color:rgba(128,128,128,.2)} +/* +https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-numbers.css - a Prism provide line-numbers CSS +Copyright (c) 2012 Lea Verou (MIT Licensed) +https://github.com/PrismJS/prism/releases/tag/v1.29.0 +https://github.com/PrismJS/prism + +Content taken from https://raw.githubusercontent.com/PrismJS/prism/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-numbers/prism-line-numbers.min.css +*/ + + +pre[class*="language-"].line-numbers { + position: relative; + padding-left: 3.8em !important; + counter-reset: linenumber; +} + +pre[class*="language-"].line-numbers > code { + position: relative; + white-space: inherit; + padding-left: 0 !important; +} + +.line-numbers .line-numbers-rows { + position: absolute; + pointer-events: none; + top: 0; + font-size: 100%; + left: -3.8em; + width: 3em; /* works for line-numbers below 1000 lines */ + letter-spacing: -1px; + border-right: 1px solid #999; + + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + +} + +.line-numbers-rows > span { + display: block; + counter-increment: linenumber; +} + +.line-numbers-rows > span:before { + content: counter(linenumber); + color: #999; + display: block; + padding-right: 0.8em; + text-align: right; +} diff --git a/fastn-core/tests/22-http-headers/output/prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js b/fastn-core/tests/22-http-headers/output/prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js new file mode 100644 index 0000000000..b8fa760f2f --- /dev/null +++ b/fastn-core/tests/22-http-headers/output/prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js @@ -0,0 +1,84 @@ +/** + * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library + * Copyright (c) 2012 Lea Verou (MIT Licensed) + * https://github.com/PrismJS/prism + */ +// Content taken from https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/prism.min.js +var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(o){var u=/\blang(?:uage)?-([\w-]+)\b/i,t=0,e={},j={manual:o.Prism&&o.Prism.manual,disableWorkerMessageHandler:o.Prism&&o.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof C?new C(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function n(e,a){var r,t;switch(a=a||{},j.util.type(e)){case"Object":if(t=j.util.objId(e),a[t])return a[t];for(var s in r={},a[t]=r,e)e.hasOwnProperty(s)&&(r[s]=n(e[s],a));return r;case"Array":return(t=j.util.objId(e),a[t])?a[t]:(r=[],a[t]=r,e.forEach(function(e,t){r[t]=n(e,a)}),r);default:return e}},getLanguage:function(e){for(;e&&!u.test(e.className);)e=e.parentElement;return e?(e.className.match(u)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(e){var t=(/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(e.stack)||[])[1];if(t){var n,a=document.getElementsByTagName("script");for(n in a)if(a[n].src==t)return a[n]}return null}},isActive:function(e,t,n){for(var a="no-"+t;e;){var r=e.classList;if(r.contains(t))return!0;if(r.contains(a))return!1;e=e.parentElement}return!!n}},languages:{plain:e,plaintext:e,text:e,txt:e,extend:function(e,t){var n,a=j.util.clone(j.languages[e]);for(n in t)a[n]=t[n];return a},insertBefore:function(n,e,t,a){var r,s=(a=a||j.languages)[n],i={};for(r in s)if(s.hasOwnProperty(r)){if(r==e)for(var l in t)t.hasOwnProperty(l)&&(i[l]=t[l]);t.hasOwnProperty(r)||(i[r]=s[r])}var o=a[n];return a[n]=i,j.languages.DFS(j.languages,function(e,t){t===o&&e!=n&&(this[e]=i)}),i},DFS:function e(t,n,a,r){r=r||{};var s,i,l,o=j.util.objId;for(s in t)t.hasOwnProperty(s)&&(n.call(t,s,t[s],a||s),i=t[s],"Object"!==(l=j.util.type(i))||r[o(i)]?"Array"!==l||r[o(i)]||(r[o(i)]=!0,e(i,n,s,r)):(r[o(i)]=!0,e(i,n,null,r)))}},plugins:{},highlightAll:function(e,t){j.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var a={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};j.hooks.run("before-highlightall",a),a.elements=Array.prototype.slice.apply(a.container.querySelectorAll(a.selector)),j.hooks.run("before-all-elements-highlight",a);for(var r,s=0;r=a.elements[s++];)j.highlightElement(r,!0===t,a.callback)},highlightElement:function(e,t,n){var a=j.util.getLanguage(e),r=j.languages[a];e.className=e.className.replace(u,"").replace(/\s+/g," ")+" language-"+a;var s=e.parentElement;s&&"pre"===s.nodeName.toLowerCase()&&(s.className=s.className.replace(u,"").replace(/\s+/g," ")+" language-"+a);var i={element:e,language:a,grammar:r,code:e.textContent};function l(e){i.highlightedCode=e,j.hooks.run("before-insert",i),i.element.innerHTML=i.highlightedCode,j.hooks.run("after-highlight",i),j.hooks.run("complete",i),n&&n.call(i.element)}if(j.hooks.run("before-sanity-check",i),(s=i.element.parentElement)&&"pre"===s.nodeName.toLowerCase()&&!s.hasAttribute("tabindex")&&s.setAttribute("tabindex","0"),!i.code)return j.hooks.run("complete",i),void(n&&n.call(i.element));j.hooks.run("before-highlight",i),i.grammar?t&&o.Worker?((t=new Worker(j.filename)).onmessage=function(e){l(e.data)},t.postMessage(JSON.stringify({language:i.language,code:i.code,immediateClose:!0}))):l(j.highlight(i.code,i.grammar,i.language)):l(j.util.encode(i.code))},highlight:function(e,t,n){n={code:e,grammar:t,language:n};return j.hooks.run("before-tokenize",n),n.tokens=j.tokenize(n.code,n.grammar),j.hooks.run("after-tokenize",n),C.stringify(j.util.encode(n.tokens),n.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var a in n)t[a]=n[a];delete t.rest}var r=new s;return z(r,r.head,e),function e(t,n,a,r,s,i){for(var l in a)if(a.hasOwnProperty(l)&&a[l]){var o=a[l];o=Array.isArray(o)?o:[o];for(var u=0;u<o.length;++u){if(i&&i.cause==l+","+u)return;var c,g=o[u],d=g.inside,p=!!g.lookbehind,m=!!g.greedy,h=g.alias;m&&!g.pattern.global&&(c=g.pattern.toString().match(/[imsuy]*$/)[0],g.pattern=RegExp(g.pattern.source,c+"g"));for(var f=g.pattern||g,b=r.next,y=s;b!==n.tail&&!(i&&y>=i.reach);y+=b.value.length,b=b.next){var v=b.value;if(n.length>t.length)return;if(!(v instanceof C)){var F,k=1;if(m){if(!(F=O(f,y,t,p)))break;var x=F.index,w=F.index+F[0].length,P=y;for(P+=b.value.length;P<=x;)b=b.next,P+=b.value.length;if(P-=b.value.length,y=P,b.value instanceof C)continue;for(var A=b;A!==n.tail&&(P<w||"string"==typeof A.value);A=A.next)k++,P+=A.value.length;k--,v=t.slice(y,P),F.index-=y}else if(!(F=O(f,0,v,p)))continue;var x=F.index,$=F[0],S=v.slice(0,x),E=v.slice(x+$.length),_=y+v.length;i&&_>i.reach&&(i.reach=_);v=b.prev;S&&(v=z(n,v,S),y+=S.length),T(n,v,k);$=new C(l,d?j.tokenize($,d):$,h,$);b=z(n,v,$),E&&z(n,b,E),1<k&&(_={cause:l+","+u,reach:_},e(t,n,a,b.prev,y,_),i&&_.reach>i.reach&&(i.reach=_.reach))}}}}}(e,r,t,r.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(r)},hooks:{all:{},add:function(e,t){var n=j.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=j.hooks.all[e];if(n&&n.length)for(var a,r=0;a=n[r++];)a(t)}},Token:C};function C(e,t,n,a){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length}function O(e,t,n,a){e.lastIndex=t;n=e.exec(n);return n&&a&&n[1]&&(a=n[1].length,n.index+=a,n[0]=n[0].slice(a)),n}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function z(e,t,n){var a=t.next,n={value:n,prev:t,next:a};return t.next=n,a.prev=n,e.length++,n}function T(e,t,n){for(var a=t.next,r=0;r<n&&a!==e.tail;r++)a=a.next;(t.next=a).prev=t,e.length-=r}if(o.Prism=j,C.stringify=function t(e,n){if("string"==typeof e)return e;if(Array.isArray(e)){var a="";return e.forEach(function(e){a+=t(e,n)}),a}var r={type:e.type,content:t(e.content,n),tag:"span",classes:["token",e.type],attributes:{},language:n},e=e.alias;e&&(Array.isArray(e)?Array.prototype.push.apply(r.classes,e):r.classes.push(e)),j.hooks.run("wrap",r);var s,i="";for(s in r.attributes)i+=" "+s+'="'+(r.attributes[s]||"").replace(/"/g,""")+'"';return"<"+r.tag+' class="'+r.classes.join(" ")+'"'+i+">"+r.content+"</"+r.tag+">"},!o.document)return o.addEventListener&&(j.disableWorkerMessageHandler||o.addEventListener("message",function(e){var t=JSON.parse(e.data),n=t.language,e=t.code,t=t.immediateClose;o.postMessage(j.highlight(e,j.languages[n],n)),t&&o.close()},!1)),j;var n=j.util.currentScript();function a(){j.manual||j.highlightAll()}return n&&(j.filename=n.src,n.hasAttribute("data-manual")&&(j.manual=!0)),j.manual||("loading"===(e=document.readyState)||"interactive"===e&&n&&n.defer?document.addEventListener("DOMContentLoaded",a):window.requestAnimationFrame?window.requestAnimationFrame(a):window.setTimeout(a,16)),j}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism),Prism.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata:/<!\[CDATA\[[\s\S]*?\]\]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};n["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};t={};t[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:n},Prism.languages.insertBefore("markup","cdata",t)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;e=e.languages.markup;e&&(e.tag.addInlined("style","css"),e.tag.addAttribute("style","css"))}(Prism),Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,function(){var i,l,o,u,a,e;function c(e,t){var n=(n=e.className).replace(a," ")+" language-"+t;e.className=n.replace(/\s+/g," ").trim()}void 0!==Prism&&"undefined"!=typeof document&&(Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},u="pre[data-src]:not(["+(l="data-src-status")+'="loaded"]):not(['+l+'="'+(o="loading")+'"])',a=/\blang(?:uage)?-([\w-]+)\b/i,Prism.hooks.add("before-highlightall",function(e){e.selector+=", "+u}),Prism.hooks.add("before-sanity-check",function(e){var t,n,a,r,s=e.element;s.matches(u)&&(e.code="",s.setAttribute(l,o),(t=s.appendChild(document.createElement("CODE"))).textContent="Loading…",n=s.getAttribute("data-src"),"none"===(e=e.language)&&(a=(/\.(\w+)$/.exec(n)||[,"none"])[1],e=i[a]||a),c(t,e),c(s,e),(a=Prism.plugins.autoloader)&&a.loadLanguages(e),(r=new XMLHttpRequest).open("GET",n,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status<400&&r.responseText?(s.setAttribute(l,"loaded"),t.textContent=r.responseText,Prism.highlightElement(t)):(s.setAttribute(l,"failed"),400<=r.status?t.textContent="✖ Error "+r.status+" while fetching file: "+r.statusText:t.textContent="✖ Error: File does not exist or is empty"))},r.send(null))}),e=!(Prism.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(u),a=0;t=n[a++];)Prism.highlightElement(t)}}),Prism.fileHighlight=function(){e||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),e=!0),Prism.plugins.fileHighlight.highlight.apply(this,arguments)})}(); +/* +https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-highlight.js - a Prism provide line-highlight JS +Copyright (c) 2012 Lea Verou (MIT Licensed) +https://github.com/PrismJS/prism/releases/tag/v1.29.0 +https://github.com/PrismJS/prism + +Content taken from https://raw.githubusercontent.com/PrismJS/prism/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-highlight.min.js +*/ + +!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document&&document.querySelector){var e,t="line-numbers",i="linkable-line-numbers",n=/\n(?!$)/g,r=!0;Prism.plugins.lineHighlight={highlightLines:function(o,u,c){var h=(u="string"==typeof u?u:o.getAttribute("data-line")||"").replace(/\s+/g,"").split(",").filter(Boolean),d=+o.getAttribute("data-line-offset")||0,f=(function(){if(void 0===e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding="0",t.style.border="0",t.innerHTML=" <br /> ",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e}()?parseInt:parseFloat)(getComputedStyle(o).lineHeight),p=Prism.util.isActive(o,t),g=o.querySelector("code"),m=p?o:g||o,v=[],y=g.textContent.match(n),b=y?y.length+1:1,A=g&&m!=g?function(e,t){var i=getComputedStyle(e),n=getComputedStyle(t);function r(e){return+e.substr(0,e.length-2)}return t.offsetTop+r(n.borderTopWidth)+r(n.paddingTop)-r(i.paddingTop)}(o,g):0;h.forEach((function(e){var t=e.split("-"),i=+t[0],n=+t[1]||i;if(!((n=Math.min(b+d,n))<i)){var r=o.querySelector('.line-highlight[data-range="'+e+'"]')||document.createElement("div");if(v.push((function(){r.setAttribute("aria-hidden","true"),r.setAttribute("data-range",e),r.className=(c||"")+" line-highlight"})),p&&Prism.plugins.lineNumbers){var s=Prism.plugins.lineNumbers.getLine(o,i),l=Prism.plugins.lineNumbers.getLine(o,n);if(s){var a=s.offsetTop+A+"px";v.push((function(){r.style.top=a}))}if(l){var u=l.offsetTop-s.offsetTop+l.offsetHeight+"px";v.push((function(){r.style.height=u}))}}else v.push((function(){r.setAttribute("data-start",String(i)),n>i&&r.setAttribute("data-end",String(n)),r.style.top=(i-d-1)*f+A+"px",r.textContent=new Array(n-i+2).join(" \n")}));v.push((function(){r.style.width=o.scrollWidth+"px"})),v.push((function(){m.appendChild(r)}))}}));var P=o.id;if(p&&Prism.util.isActive(o,i)&&P){l(o,i)||v.push((function(){o.classList.add(i)}));var E=parseInt(o.getAttribute("data-start")||"1");s(".line-numbers-rows > span",o).forEach((function(e,t){var i=t+E;e.onclick=function(){var e=P+"."+i;r=!1,location.hash=e,setTimeout((function(){r=!0}),1)}}))}return function(){v.forEach(a)}}};var o=0;Prism.hooks.add("before-sanity-check",(function(e){var t=e.element.parentElement;if(u(t)){var i=0;s(".line-highlight",t).forEach((function(e){i+=e.textContent.length,e.parentNode.removeChild(e)})),i&&/^(?: \n)+$/.test(e.code.slice(-i))&&(e.code=e.code.slice(0,-i))}})),Prism.hooks.add("complete",(function e(i){var n=i.element.parentElement;if(u(n)){clearTimeout(o);var r=Prism.plugins.lineNumbers,s=i.plugins&&i.plugins.lineNumbers;l(n,t)&&r&&!s?Prism.hooks.add("line-numbers",e):(Prism.plugins.lineHighlight.highlightLines(n)(),o=setTimeout(c,1))}})),window.addEventListener("hashchange",c),window.addEventListener("resize",(function(){s("pre").filter(u).map((function(e){return Prism.plugins.lineHighlight.highlightLines(e)})).forEach(a)}))}function s(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function l(e,t){return e.classList.contains(t)}function a(e){e()}function u(e){return!!(e&&/pre/i.test(e.nodeName)&&(e.hasAttribute("data-line")||e.id&&Prism.util.isActive(e,i)))}function c(){var e=location.hash.slice(1);s(".temporary.line-highlight").forEach((function(e){e.parentNode.removeChild(e)}));var t=(e.match(/\.([\d,-]+)$/)||[,""])[1];if(t&&!document.getElementById(e)){var i=e.slice(0,e.lastIndexOf(".")),n=document.getElementById(i);n&&(n.hasAttribute("data-line")||n.setAttribute("data-line",""),Prism.plugins.lineHighlight.highlightLines(n,t,"temporary ")(),r&&document.querySelector(".temporary.line-highlight").scrollIntoView())}}}(); +/* +https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-numbers.js - a Prism provide line-numbers JS +Copyright (c) 2012 Lea Verou (MIT Licensed) +https://github.com/PrismJS/prism/releases/tag/v1.29.0 +https://github.com/PrismJS/prism + +Content taken from + https://raw.githubusercontent.com/PrismJS/prism/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-numbers/prism-line-numbers.min.js +*/ + +!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e="line-numbers",n=/\n(?!$)/g,t=Prism.plugins.lineNumbers={getLine:function(n,t){if("PRE"===n.tagName&&n.classList.contains(e)){var i=n.querySelector(".line-numbers-rows");if(i){var r=parseInt(n.getAttribute("data-start"),10)||1,s=r+(i.children.length-1);t<r&&(t=r),t>s&&(t=s);var l=t-r;return i.children[l]}}},resize:function(e){r([e])},assumeViewportIndependence:!0},i=void 0;window.addEventListener("resize",(function(){t.assumeViewportIndependence&&i===window.innerWidth||(i=window.innerWidth,r(Array.prototype.slice.call(document.querySelectorAll("pre.line-numbers"))))})),Prism.hooks.add("complete",(function(t){if(t.code){var i=t.element,s=i.parentNode;if(s&&/pre/i.test(s.nodeName)&&!i.querySelector(".line-numbers-rows")&&Prism.util.isActive(i,e)){i.classList.remove(e),s.classList.add(e);var l,o=t.code.match(n),a=o?o.length+1:1,u=new Array(a+1).join("<span></span>");(l=document.createElement("span")).setAttribute("aria-hidden","true"),l.className="line-numbers-rows",l.innerHTML=u,s.hasAttribute("data-start")&&(s.style.counterReset="linenumber "+(parseInt(s.getAttribute("data-start"),10)-1)),t.element.appendChild(l),r([s]),Prism.hooks.run("line-numbers",t)}}})),Prism.hooks.add("line-numbers",(function(e){e.plugins=e.plugins||{},e.plugins.lineNumbers=!0}))}function r(e){if(0!=(e=e.filter((function(e){var n,t=(n=e,n?window.getComputedStyle?getComputedStyle(n):n.currentStyle||null:null)["white-space"];return"pre-wrap"===t||"pre-line"===t}))).length){var t=e.map((function(e){var t=e.querySelector("code"),i=e.querySelector(".line-numbers-rows");if(t&&i){var r=e.querySelector(".line-numbers-sizer"),s=t.textContent.split(n);r||((r=document.createElement("span")).className="line-numbers-sizer",t.appendChild(r)),r.innerHTML="0",r.style.display="block";var l=r.getBoundingClientRect().height;return r.innerHTML="",{element:e,lines:s,lineHeights:[],oneLinerHeight:l,sizer:r}}})).filter(Boolean);t.forEach((function(e){var n=e.sizer,t=e.lines,i=e.lineHeights,r=e.oneLinerHeight;i[t.length-1]=void 0,t.forEach((function(e,t){if(e&&e.length>1){var s=n.appendChild(document.createElement("span"));s.style.display="block",s.textContent=e}else i[t]=r}))})),t.forEach((function(e){for(var n=e.sizer,t=e.lineHeights,i=0,r=0;r<t.length;r++)void 0===t[r]&&(t[r]=n.children[i++].getBoundingClientRect().height)})),t.forEach((function(e){var n=e.sizer,t=e.element.querySelector(".line-numbers-rows");n.style.display="none",n.innerHTML="",e.lineHeights.forEach((function(e,n){t.children[n].style.height=e+"px"}))}))}}}(); +/** + * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library + * Copyright (c) 2012 Lea Verou (MIT Licensed) + * https://github.com/PrismJS/prism + * https://github.com/PrismJS/prism/commit/11c54624ee4f0e36ec3607c16d74969c8264a79d + */ +// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-rust.min.js +!function(e){for(var a="/\\*(?:[^*/]|\\*(?!/)|/(?!\\*)|<self>)*\\*/",t=0;t<2;t++)a=a.replace(/<self>/g,(function(){return a}));a=a.replace(/<self>/g,(function(){return"[^\\s\\S]"})),e.languages.rust={comment:[{pattern:RegExp("(^|[^\\\\])"+a),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string,e.languages.rs=e.languages.rust}(Prism); +/** + * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library + * Copyright (c) 2012 Lea Verou (MIT Licensed) + * https://github.com/PrismJS/prism + * https://github.com/PrismJS/prism/commit/e2630d890e9ced30a79cdf9ef272601ceeaedccf + */ +// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-json.min.js +Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json; +/** + * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library + * Copyright (c) 2012 Lea Verou (MIT Licensed) + * https://github.com/PrismJS/prism + * https://github.com/PrismJS/prism/commit/8ecef306a76be571ff14a18e504196f4f406903d + */ +// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-python.min.js +Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python; +/** + * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library + * Copyright (c) 2012 Lea Verou (MIT Licensed) + * https://github.com/PrismJS/prism + * https://github.com/PrismJS/prism/commit/11c54624ee4f0e36ec3607c16d74969c8264a79d + */ +// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-markdown.min.js +!function(n){function e(n){return n=n.replace(/<inner>/g,(function(){return"(?:\\\\.|[^\\\\\n\r]|(?:\n|\r\n?)(?![\r\n]))"})),RegExp("((?:^|[^\\\\])(?:\\\\{2})*)(?:"+n+")")}var t="(?:\\\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\\\|\r\n`])+",a="\\|?__(?:\\|__)+\\|?(?:(?:\n|\r\n?)|(?![^]))".replace(/__/g,(function(){return t})),i="\\|?[ \t]*:?-{3,}:?[ \t]*(?:\\|[ \t]*:?-{3,}:?[ \t]*)+\\|?(?:\n|\r\n?)";n.languages.markdown=n.languages.extend("markup",{}),n.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:n.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+i+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+i+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(t),inside:n.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(t),alias:"important",inside:n.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:e("\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*"),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:e("\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*"),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:e("(~~?)(?:(?!~)<inner>)+\\2"),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:e('!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \t]?\\[(?:(?!\\])<inner>)+\\])'),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(e){["url","bold","italic","strike","code-snippet"].forEach((function(t){e!==t&&(n.languages.markdown[e].inside.content.inside[t]=n.languages.markdown[t])}))})),n.hooks.add("after-tokenize",(function(n){"markdown"!==n.language&&"md"!==n.language||function n(e){if(e&&"string"!=typeof e)for(var t=0,a=e.length;t<a;t++){var i=e[t];if("code"===i.type){var r=i.content[1],o=i.content[3];if(r&&o&&"code-language"===r.type&&"code-block"===o.type&&"string"==typeof r.content){var l=r.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),s="language-"+(l=(/[a-z][\w-]*/i.exec(l)||[""])[0].toLowerCase());o.alias?"string"==typeof o.alias?o.alias=[o.alias,s]:o.alias.push(s):o.alias=[s]}}else n(i.content)}}(n.tokens)})),n.hooks.add("wrap",(function(e){if("code-block"===e.type){for(var t="",a=0,i=e.classes.length;a<i;a++){var s=e.classes[a],d=/language-(.+)/.exec(s);if(d){t=d[1];break}}var p=n.languages[t];if(p)e.content=n.highlight(e.content.replace(r,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(n,e){var t;return"#"===(e=e.toLowerCase())[0]?(t="x"===e[1]?parseInt(e.slice(2),16):Number(e.slice(1)),l(t)):o[e]||n})),p,t);else if(t&&"none"!==t&&n.plugins.autoloader){var u="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());e.attributes.id=u,n.plugins.autoloader.loadLanguages(t,(function(){var e=document.getElementById(u);e&&(e.innerHTML=n.highlight(e.textContent,n.languages[t],t))}))}}}));var r=RegExp(n.languages.markup.tag.pattern.source,"gi"),o={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;n.languages.md=n.languages.markdown}(Prism); +/** + * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library + * Copyright (c) 2012 Lea Verou (MIT Licensed) + * https://github.com/PrismJS/prism + * https://github.com/PrismJS/prism/commit/8ecef306a76be571ff14a18e504196f4f406903d + */ +// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-plsql.min.js +Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}; +/** + * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library + * Copyright (c) 2012 Lea Verou (MIT Licensed) + * https://github.com/PrismJS/prism + * https://github.com/PrismJS/prism/commit/8ecef306a76be571ff14a18e504196f4f406903d + */ +// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-bash.min.js +!function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",a={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},n={bash:a,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:n},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:a}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:n},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:n.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:n.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},a.inside=e.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=n.variable[1].inside,i=0;i<s.length;i++)o[s[i]]=e.languages.bash[s[i]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash}(Prism); +/** + * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library + * Copyright (c) 2012 Lea Verou (MIT Licensed) + * https://github.com/PrismJS/prism + * https://github.com/PrismJS/prism/commit/8ecef306a76be571ff14a18e504196f4f406903d + */ +// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-javascript.min.js +Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)/(?:(?:\\[(?:[^\\]\\\\\r\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|/\\*(?:[^*]|\\*(?!/))*\\*/)*(?:$|[\r\n,.;:})\\]]|//))"),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)","javascript")),Prism.languages.js=Prism.languages.javascript; From e4384611fbba4705e1508b40f4e587f1efcf3d6f Mon Sep 17 00:00:00 2001 From: Harsh Singh <harshsingh.js@gmail.com> Date: Wed, 28 Feb 2024 13:04:20 +0530 Subject: [PATCH 8/9] fixed tests --- fastn-core/tests/19-offline-build/output/index.html | 2 +- fastn-core/tests/22-http-headers/output/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fastn-core/tests/19-offline-build/output/index.html b/fastn-core/tests/19-offline-build/output/index.html index 9d98ef4f95..f2b4ad74cd 100644 --- a/fastn-core/tests/19-offline-build/output/index.html +++ b/fastn-core/tests/19-offline-build/output/index.html @@ -16,7 +16,7 @@ <script src="prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js"></script> <script src="default-D6428866DD6727EE4B0EE4400DD96CCD326584894936608BFFFF505BBC10376E.js"></script> <link rel="stylesheet" href="prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css"> - <script src="-/fastn-stack.github.io/fastn-js/download.js"></script><script src="//cdnjs.cloudflare.com/ajax/libs/html-to-image/1.11.11/html-to-image.min.js"></script> + <script src="//cdnjs.cloudflare.com/ajax/libs/html-to-image/1.11.11/html-to-image.min.js"></script><script src="-/fastn-stack.github.io/fastn-js/download.js"></script> diff --git a/fastn-core/tests/22-http-headers/output/index.html b/fastn-core/tests/22-http-headers/output/index.html index 86f8b10af4..69ef7aa6db 100644 --- a/fastn-core/tests/22-http-headers/output/index.html +++ b/fastn-core/tests/22-http-headers/output/index.html @@ -368,7 +368,7 @@ fastn_utils.createNestedObject(global, "fastn_stack_github_io_http_headers_test___auth_res", function () { let record = fastn.recordInstance({ }); - record.set("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTUsInVzZXJuYW1lIjoia21pbmNoZWxsZSIsImVtYWlsIjoia21pbmNoZWxsZUBxcS5jb20iLCJmaXJzdE5hbWUiOiJKZWFubmUiLCJsYXN0TmFtZSI6IkhhbHZvcnNvbiIsImdlbmRlciI6ImZlbWFsZSIsImltYWdlIjoiaHR0cHM6Ly9yb2JvaGFzaC5vcmcvSmVhbm5lLnBuZz9zZXQ9c2V0NCIsImlhdCI6MTcwOTEwMzk5MywiZXhwIjoxNzA5MTA3NTkzfQ.LHCuTT1UCGiuS5D3F4tvmlbYuO2nnIOlSG-W2sAoXGo"); + record.set("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTUsInVzZXJuYW1lIjoia21pbmNoZWxsZSIsImVtYWlsIjoia21pbmNoZWxsZUBxcS5jb20iLCJmaXJzdE5hbWUiOiJKZWFubmUiLCJsYXN0TmFtZSI6IkhhbHZvcnNvbiIsImdlbmRlciI6ImZlbWFsZSIsImltYWdlIjoiaHR0cHM6Ly9yb2JvaGFzaC5vcmcvSmVhbm5lLnBuZz9zZXQ9c2V0NCIsImlhdCI6MTcwOTEwNTYzOSwiZXhwIjoxNzA5MTA5MjM5fQ.6JvfYxsrUZxctYe0nJ63eujlcRSnT1KQ9QRhSGqa2Wc"); return record; }()); fastn_utils.createNestedObject(global, "fastn_stack_github_io_http_headers_test___bearer_token", fastn.formula([global.fastn_stack_github_io_http_headers_test___auth_res.get("token")], function () { From 168922376d1d9c05432738f97aec18a88b5ac00c Mon Sep 17 00:00:00 2001 From: Harsh Singh <harshsingh.js@gmail.com> Date: Wed, 28 Feb 2024 13:55:55 +0530 Subject: [PATCH 9/9] fixed tests --- fastn-core/tests/22-http-headers/cmd.p1 | 12 - .../tests/22-http-headers/input/FASTN.ftd | 3 - .../tests/22-http-headers/output/FASTN.ftd | 3 - ...D46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css | 139 - ...0379A2DB3483A1F058CA29FBCFB3815CA76148.css | 172 - ...74F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css | 122 - ...6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css | 133 - ...4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css | 172 - ...3FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css | 172 - ...43E976EA9F41AD75268B2DD825C33C68B573A6.css | 428 -- ...93E43A6135D910989ADD88CA3C0D6117EE24D7.css | 172 - ...32BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css | 168 - ...084DBF71BC5750C2C1357F0E7D936867AFAB62.css | 160 - ...5E65580DB580F1477931AADCB5118E4E69D1CD.css | 158 - ...72EE9053D04923BBC5D1BA52B574E78D8C536A.css | 207 - ...2ABE4BA14CEEA13CD23E157BF6A137762B8452.css | 205 - ...066C3706A6DF3579B14F41AF05564E41CAA09C.css | 172 - ...265387B814AE85A7D33666A4AE4BEFF59016D0.css | 318 - ...A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css | 317 - ...BC0BDF6AE447485C30B0389ADA7B49C069E46A.css | 172 - ...3CAE3B938D54E2813F0855312D2554DBE97BAD.css | 440 -- ...1ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css | 134 - ...0E9C8E73F6345E49362B46E6F52CEE40471248.css | 140 - ...DBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css | 139 - ...1BB0511696A1EE8002C5088748DA0BAC0806E6.css | 210 - ...93D04881B17EA4699BA9C568C83D32A18B0173.css | 281 - ...5175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css | 194 - ...127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js | 6550 ----------------- .../tests/22-http-headers/output/index.ftd | 74 - .../tests/22-http-headers/output/index.html | 474 -- .../22-http-headers/output/manifest.json | 16 - ...88EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js | 7 - ...F239A103F0B0F93B69CD55CB5C6530501182EB.css | 61 - ...059F8F1870D613AD0C5B0B013D6205B72A62BAF.js | 84 - .../_tests/14-http-headers.test.ftd | 7 + .../dummy-json-auth.ftd | 0 36 files changed, 7 insertions(+), 12209 deletions(-) delete mode 100644 fastn-core/tests/22-http-headers/cmd.p1 delete mode 100644 fastn-core/tests/22-http-headers/input/FASTN.ftd delete mode 100644 fastn-core/tests/22-http-headers/output/FASTN.ftd delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-06E6F84E43C61CB1653D9F4FACD46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-0800A18B1822D6AFDAF807CF840379A2DB3483A1F058CA29FBCFB3815CA76148.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-0CA636E4954E3FC6184FB8000174F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-0F444C6433C356376F7E92122F6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-256C21B515FC9E77F95D88689A4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-4DD8479BE14A755645BC09FF433FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-60E02531E77333F3F1B636C4FC43E976EA9F41AD75268B2DD825C33C68B573A6.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-6EB6F03F9F578742CA0CD1189693E43A6135D910989ADD88CA3C0D6117EE24D7.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-7852E516BA094B01897820BB3432BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-792C7BB9F4C8DFF3E0CBC354D2084DBF71BC5750C2C1357F0E7D936867AFAB62.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-88F91252A8A0EA125B4BA2C7B85E65580DB580F1477931AADCB5118E4E69D1CD.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-8C59190F5018F48CCBB063359072EE9053D04923BBC5D1BA52B574E78D8C536A.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-8CCA3D600F91FA55950DF3132F2ABE4BA14CEEA13CD23E157BF6A137762B8452.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-95B9118AFC8631777EEBBD89B2066C3706A6DF3579B14F41AF05564E41CAA09C.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-99CD7B013C96C4632F0AEA39AC265387B814AE85A7D33666A4AE4BEFF59016D0.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-9A3284FD117DFF7CFD432FF860A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-9A45313F167DBD90654BFD5BB3BC0BDF6AE447485C30B0389ADA7B49C069E46A.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-A24DC8F09D03756A62923E8A883CAE3B938D54E2813F0855312D2554DBE97BAD.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-A352AF572179AB980583D41BC41ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-B3AEA322EADEDA61F0E219845A0E9C8E73F6345E49362B46E6F52CEE40471248.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-B68AA27E05B319F04A9CD747AADBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-B8645DE281A38A3068C56919DE1BB0511696A1EE8002C5088748DA0BAC0806E6.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-DC76F700474E809F7BA2D9914793D04881B17EA4699BA9C568C83D32A18B0173.css delete mode 100644 fastn-core/tests/22-http-headers/output/code-theme-F614177D3155EA8E915B35A3445175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css delete mode 100644 fastn-core/tests/22-http-headers/output/default-B66C2B8914832538F78C67C1C127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js delete mode 100644 fastn-core/tests/22-http-headers/output/index.ftd delete mode 100644 fastn-core/tests/22-http-headers/output/index.html delete mode 100644 fastn-core/tests/22-http-headers/output/manifest.json delete mode 100644 fastn-core/tests/22-http-headers/output/markdown-24E09EFC0C2B9A11DEA9AC71888EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js delete mode 100644 fastn-core/tests/22-http-headers/output/prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css delete mode 100644 fastn-core/tests/22-http-headers/output/prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js create mode 100644 integration-tests/_tests/14-http-headers.test.ftd rename fastn-core/tests/22-http-headers/input/index.ftd => integration-tests/dummy-json-auth.ftd (100%) diff --git a/fastn-core/tests/22-http-headers/cmd.p1 b/fastn-core/tests/22-http-headers/cmd.p1 deleted file mode 100644 index f4b8f80116..0000000000 --- a/fastn-core/tests/22-http-headers/cmd.p1 +++ /dev/null @@ -1,12 +0,0 @@ --- fbt: -cmd: $FBT_CWD/../target/debug/fastn --test build -output: .build - --- stdout: - -Updated package dependency. -Processing fastn-stack.github.io/http-headers-test/manifest.json ... done in <omitted> -Processing fastn-stack.github.io/http-headers-test/FASTN/ ... done in <omitted> -Processing fastn-stack.github.io/http-headers-test/ ... calling `http` processor with url: https://dummyjson.com/auth/login -calling `http` processor with url: https://dummyjson.com/auth/me -done in <omitted> diff --git a/fastn-core/tests/22-http-headers/input/FASTN.ftd b/fastn-core/tests/22-http-headers/input/FASTN.ftd deleted file mode 100644 index a62ae8aa0e..0000000000 --- a/fastn-core/tests/22-http-headers/input/FASTN.ftd +++ /dev/null @@ -1,3 +0,0 @@ --- import: fastn - --- fastn.package: fastn-stack.github.io/http-headers-test diff --git a/fastn-core/tests/22-http-headers/output/FASTN.ftd b/fastn-core/tests/22-http-headers/output/FASTN.ftd deleted file mode 100644 index a62ae8aa0e..0000000000 --- a/fastn-core/tests/22-http-headers/output/FASTN.ftd +++ /dev/null @@ -1,3 +0,0 @@ --- import: fastn - --- fastn.package: fastn-stack.github.io/http-headers-test diff --git a/fastn-core/tests/22-http-headers/output/code-theme-06E6F84E43C61CB1653D9F4FACD46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css b/fastn-core/tests/22-http-headers/output/code-theme-06E6F84E43C61CB1653D9F4FACD46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css deleted file mode 100644 index 4a32152b08..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-06E6F84E43C61CB1653D9F4FACD46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Gruvbox light theme - * - * Based on Gruvbox: https://github.com/morhetz/gruvbox - * Adapted from PrismJS gruvbox-dark theme: https://github.com/schnerring/prism-themes/blob/master/themes/prism-gruvbox-dark.css - * - * @author Michael Schnerring (https://schnerring.net) - * @version 1.0 - */ - -code[class*="language-"].gruvbox-theme-light, -pre[class*="language-"].gruvbox-theme-light { - color: #3c3836; /* fg1 / fg */ - font-family: Consolas, Monaco, "Andale Mono", monospace; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - line-height: 1.5; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"].gruvbox-theme-light::-moz-selection, -pre[class*="language-"].gruvbox-theme-light ::-moz-selection, -code[class*="language-"].gruvbox-theme-light::-moz-selection, -code[class*="language-"].gruvbox-theme-light ::-moz-selection { - color: #282828; /* fg0 */ - background: #a89984; /* bg4 */ -} - -pre[class*="language-"].gruvbox-theme-light::selection, -pre[class*="language-"].gruvbox-theme-light ::selection, -code[class*="language-"].gruvbox-theme-light::selection, -code[class*="language-"].gruvbox-theme-light ::selection { - color: #282828; /* fg0 */ - background: #a89984; /* bg4 */ -} - -/* Code blocks */ -pre[class*="language-"].gruvbox-theme-light { - padding: 1em; - margin: 0.5em 0; - overflow: auto; -} - -:not(pre) > code[class*="language-"].gruvbox-theme-light, -pre[class*="language-"].gruvbox-theme-light { - background: #f9f5d7; /* bg0_h */ -} - -/* Inline code */ -:not(pre) > code[class*="language-"].gruvbox-theme-light { - padding: 0.1em; - border-radius: 0.3em; -} - -.gruvbox-theme-light .token.comment, -.gruvbox-theme-light .token.prolog, -.gruvbox-theme-light .token.cdata { - color: #7c6f64; /* fg4 / gray1 */ -} - -.gruvbox-theme-light .token.delimiter, -.gruvbox-theme-light .token.boolean, -.gruvbox-theme-light .token.keyword, -.gruvbox-theme-light .token.selector, -.gruvbox-theme-light .token.important, -.gruvbox-theme-light .token.atrule { - color: #9d0006; /* red2 */ -} - -.gruvbox-theme-light .token.operator, -.gruvbox-theme-light .token.punctuation, -.gruvbox-theme-light .token.attr-name { - color: #7c6f64; /* fg4 / gray1 */ -} - -.gruvbox-theme-light .token.tag, -.gruvbox-theme-light .token.tag .punctuation, -.gruvbox-theme-light .token.doctype, -.gruvbox-theme-light .token.builtin { - color: #b57614; /* yellow2 */ -} - -.gruvbox-theme-light .token.entity, -.gruvbox-theme-light .token.number, -.gruvbox-theme-light .token.symbol { - color: #8f3f71; /* purple2 */ -} - -.gruvbox-theme-light .token.property, -.gruvbox-theme-light .token.constant, -.gruvbox-theme-light .token.variable { - color: #9d0006; /* red2 */ -} - -.gruvbox-theme-light .token.string, -.gruvbox-theme-light .token.char { - color: #797403; /* green2 */ -} - -.gruvbox-theme-light .token.attr-value, -.gruvbox-theme-light .token.attr-value .punctuation { - color: #7c6f64; /* fg4 / gray1 */ -} - -.gruvbox-theme-light .token.url { - color: #797403; /* green2 */ - text-decoration: underline; -} - -.gruvbox-theme-light .token.function { - color: #b57614; /* yellow2 */ -} - -.gruvbox-theme-light .token.bold { - font-weight: bold; -} - -.gruvbox-theme-light .token.italic { - font-style: italic; -} - -.gruvbox-theme-light .token.inserted { - background: #7c6f64; /* fg4 / gray1 */ -} - -.gruvbox-theme-light .token.deleted { - background: #9d0006; /* red2 */ -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-0800A18B1822D6AFDAF807CF840379A2DB3483A1F058CA29FBCFB3815CA76148.css b/fastn-core/tests/22-http-headers/output/code-theme-0800A18B1822D6AFDAF807CF840379A2DB3483A1F058CA29FBCFB3815CA76148.css deleted file mode 100644 index 63ab0878b3..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-0800A18B1822D6AFDAF807CF840379A2DB3483A1F058CA29FBCFB3815CA76148.css +++ /dev/null @@ -1,172 +0,0 @@ -/* -Name: Duotone Light -Author: Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) - -Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-morning-light.css) -Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) -*/ - -code[class*="language-"].duotone-theme-light, -pre[class*="language-"].duotone-theme-light { - font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; - font-size: 14px; - line-height: 1.375; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; - background: #faf8f5; - color: #728fcb; -} - -pre > code[class*="language-"].duotone-theme-light { - font-size: 1em; -} - -pre[class*="language-"].duotone-theme-light::-moz-selection, pre[class*="language-"].duotone-theme-light ::-moz-selection, -code[class*="language-"].duotone-theme-light::-moz-selection, code[class*="language-"].duotone-theme-light ::-moz-selection { - text-shadow: none; - background: #faf8f5; -} - -pre[class*="language-"].duotone-theme-light::selection, pre[class*="language-"].duotone-theme-light ::selection, -code[class*="language-"].duotone-theme-light::selection, code[class*="language-"].duotone-theme-light ::selection { - text-shadow: none; - background: #faf8f5; -} - -/* Code blocks */ -pre[class*="language-"].duotone-theme-light { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].duotone-theme-light { - padding: .1em; - border-radius: .3em; -} - -.duotone-theme-light .token.comment, -.duotone-theme-light .token.prolog, -.duotone-theme-light .token.doctype, -.duotone-theme-light .token.cdata { - color: #b6ad9a; -} - -.duotone-theme-light .token.punctuation { - color: #b6ad9a; -} - -.duotone-theme-light .token.namespace { - opacity: .7; -} - -.duotone-theme-light .token.tag, -.duotone-theme-light .token.operator, -.duotone-theme-light .token.number { - color: #063289; -} - -.duotone-theme-light .token.property, -.duotone-theme-light .token.function { - color: #b29762; -} - -.duotone-theme-light .token.tag-id, -.duotone-theme-light .token.selector, -.duotone-theme-light .token.atrule-id { - color: #2d2006; -} - -code.language-javascript, -.duotone-theme-light .token.attr-name { - color: #896724; -} - -code.language-css, -code.language-scss, -.duotone-theme-light .token.boolean, -.duotone-theme-light .token.string, -.duotone-theme-light .token.entity, -.duotone-theme-light .token.url, -.language-css .duotone-theme-light .token.string, -.language-scss .duotone-theme-light .token.string, -.style .duotone-theme-light .token.string, -.duotone-theme-light .token.attr-value, -.duotone-theme-light .token.keyword, -.duotone-theme-light .token.control, -.duotone-theme-light .token.directive, -.duotone-theme-light .token.unit, -.duotone-theme-light .token.statement, -.duotone-theme-light .token.regex, -.duotone-theme-light .token.atrule { - color: #728fcb; -} - -.duotone-theme-light .token.placeholder, -.duotone-theme-light .token.variable { - color: #93abdc; -} - -.duotone-theme-light .token.deleted { - text-decoration: line-through; -} - -.duotone-theme-light .token.inserted { - border-bottom: 1px dotted #2d2006; - text-decoration: none; -} - -.duotone-theme-light .token.italic { - font-style: italic; -} - -.duotone-theme-light .token.important, -.duotone-theme-light .token.bold { - font-weight: bold; -} - -.duotone-theme-light .token.important { - color: #896724; -} - -.duotone-theme-light .token.entity { - cursor: help; -} - -pre > code.highlight { - outline: .4em solid #896724; - outline-offset: .4em; -} - -/* overrides color-values for the Line Numbers plugin - * http://prismjs.com/plugins/line-numbers/ - */ -.line-numbers.line-numbers .line-numbers-rows { - border-right-color: #ece8de; -} - -.line-numbers .line-numbers-rows > span:before { - color: #cdc4b1; -} - -/* overrides color-values for the Line Highlight plugin - * http://prismjs.com/plugins/line-highlight/ - */ -.line-highlight.line-highlight { - background: rgba(45, 32, 6, 0.2); - background: -webkit-linear-gradient(left, rgba(45, 32, 6, 0.2) 70%, rgba(45, 32, 6, 0)); - background: linear-gradient(to right, rgba(45, 32, 6, 0.2) 70%, rgba(45, 32, 6, 0)); -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-0CA636E4954E3FC6184FB8000174F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css b/fastn-core/tests/22-http-headers/output/code-theme-0CA636E4954E3FC6184FB8000174F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css deleted file mode 100644 index 06a53a01e6..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-0CA636E4954E3FC6184FB8000174F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Dracula Theme originally by Zeno Rocha [@zenorocha] - * https://draculatheme.com/ - * - * Ported for PrismJS by Albert Vallverdu [@byverdu] - */ - -code[class*="language-"].dracula-theme, -pre[class*="language-"].dracula-theme { - color: #f8f8f2; - background: none; - text-shadow: 0 1px rgba(0, 0, 0, 0.3); - font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -/* Code blocks */ -pre[class*="language-"].dracula-theme { - padding: 1em; - margin: .5em 0; - overflow: auto; - border-radius: 0.3em; -} - -:not(pre) > code[class*="language-"].dracula-theme, -pre[class*="language-"].dracula-theme { - background: #282a36; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].dracula-theme { - padding: .1em; - border-radius: .3em; - white-space: normal; -} - -.dracula-theme .token.comment, -.dracula-theme .token.prolog, -.dracula-theme .token.doctype, -.dracula-theme .token.cdata { - color: #6272a4; -} - -.dracula-theme .token.punctuation { - color: #f8f8f2; -} - -.namespace { - opacity: .7; -} - -.dracula-theme .token.property, -.dracula-theme .token.tag, -.dracula-theme .token.constant, -.dracula-theme .token.symbol, -.dracula-theme .token.deleted { - color: #ff79c6; -} - -.dracula-theme .token.boolean, -.dracula-theme .token.number { - color: #bd93f9; -} - -.dracula-theme .token.selector, -.dracula-theme .token.attr-name, -.dracula-theme .token.string, -.dracula-theme .token.char, -.dracula-theme .token.builtin, -.dracula-theme .token.inserted { - color: #50fa7b; -} - -.dracula-theme .token.operator, -.dracula-theme .token.entity, -.dracula-theme .token.url, -.language-css .dracula-theme .token.string, -.style .dracula-theme .token.string, -.dracula-theme .token.variable { - color: #f8f8f2; -} - -.dracula-theme .token.atrule, -.dracula-theme .token.attr-value, -.dracula-theme .token.function, -.dracula-theme .token.class-name { - color: #f1fa8c; -} - -.dracula-theme .token.keyword { - color: #8be9fd; -} - -.dracula-theme .token.regex, -.dracula-theme .token.important { - color: #ffb86c; -} - -.dracula-theme .token.important, -.dracula-theme .token.bold { - font-weight: bold; -} - -.dracula-theme .token.italic { - font-style: italic; -} - -.dracula-theme .token.entity { - cursor: help; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-0F444C6433C356376F7E92122F6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css b/fastn-core/tests/22-http-headers/output/code-theme-0F444C6433C356376F7E92122F6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css deleted file mode 100644 index b0b38cbdd7..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-0F444C6433C356376F7E92122F6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Laserwave Theme originally by Jared Jones for Visual Studio Code - * https://github.com/Jaredk3nt/laserwave - * - * Ported for PrismJS by Simon Jespersen [https://github.com/simjes] - */ - -code[class*="language-"].laserwave-theme, -pre[class*="language-"].laserwave-theme { - background: #27212e; - color: #ffffff; - font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; /* this is the default */ - /* The following properties are standard, please leave them as they are */ - font-size: 1em; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - line-height: 1.5; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; - /* The following properties are also standard */ - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -code[class*="language-"].laserwave-theme::-moz-selection, -code[class*="language-"].laserwave-theme ::-moz-selection, -pre[class*="language-"].laserwave-theme::-moz-selection, -pre[class*="language-"].laserwave-theme ::-moz-selection { - background: #eb64b927; - color: inherit; -} - -code[class*="language-"].laserwave-theme::selection, -code[class*="language-"].laserwave-theme ::selection, -pre[class*="language-"].laserwave-theme::selection, -pre[class*="language-"].laserwave-theme ::selection { - background: #eb64b927; - color: inherit; -} - -/* Properties specific to code blocks */ -pre[class*="language-"].laserwave-theme { - padding: 1em; /* this is standard */ - margin: 0.5em 0; /* this is the default */ - overflow: auto; /* this is standard */ - border-radius: 0.5em; -} - -/* Properties specific to inline code */ -:not(pre) > code[class*="language-"].laserwave-theme { - padding: 0.2em 0.3em; - border-radius: 0.5rem; - white-space: normal; /* this is standard */ -} - -.laserwave-theme .token.comment, -.laserwave-theme .token.prolog, -.laserwave-theme .token.cdata { - color: #91889b; -} - -.laserwave-theme .token.punctuation { - color: #7b6995; -} - -.laserwave-theme .token.builtin, -.laserwave-theme .token.constant, -.laserwave-theme .token.boolean { - color: #ffe261; -} - -.laserwave-theme .token.number { - color: #b381c5; -} - -.laserwave-theme .token.important, -.laserwave-theme .token.atrule, -.laserwave-theme .token.property, -.laserwave-theme .token.keyword { - color: #40b4c4; -} - -.laserwave-theme .token.doctype, -.laserwave-theme .token.operator, -.laserwave-theme .token.inserted, -.laserwave-theme .token.tag, -.laserwave-theme .token.class-name, -.laserwave-theme .token.symbol { - color: #74dfc4; -} - -.laserwave-theme .token.attr-name, -.laserwave-theme .token.function, -.laserwave-theme .token.deleted, -.laserwave-theme .token.selector { - color: #eb64b9; -} - -.laserwave-theme .token.attr-value, -.laserwave-theme .token.regex, -.laserwave-theme .token.char, -.laserwave-theme .token.string { - color: #b4dce7; -} - -.laserwave-theme .token.entity, -.laserwave-theme .token.url, -.laserwave-theme .token.variable { - color: #ffffff; -} - -/* The following rules are pretty similar across themes, but feel free to adjust them */ -.laserwave-theme .token.bold { - font-weight: bold; -} - -.laserwave-theme .token.italic { - font-style: italic; -} - -.laserwave-theme .token.entity { - cursor: help; -} - -.laserwave-theme .token.namespace { - opacity: 0.7; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-256C21B515FC9E77F95D88689A4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css b/fastn-core/tests/22-http-headers/output/code-theme-256C21B515FC9E77F95D88689A4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css deleted file mode 100644 index 1c8b8fe6d3..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-256C21B515FC9E77F95D88689A4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css +++ /dev/null @@ -1,172 +0,0 @@ -/* -Name: Duotone Forest -Author: by Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) - -Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-forest-dark.css) -Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) -*/ - -code[class*="language-"].duotone-theme-forest, -pre[class*="language-"].duotone-theme-forest { - font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; - font-size: 14px; - line-height: 1.375; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; - background: #2a2d2a; - color: #687d68; -} - -pre > code[class*="language-"].duotone-theme-forest { - font-size: 1em; -} - -pre[class*="language-"].duotone-theme-forest::-moz-selection, pre[class*="language-"].duotone-theme-forest ::-moz-selection, -code[class*="language-"].duotone-theme-forest::-moz-selection, code[class*="language-"].duotone-theme-forest ::-moz-selection { - text-shadow: none; - background: #435643; -} - -pre[class*="language-"].duotone-theme-forest::selection, pre[class*="language-"].duotone-theme-forest ::selection, -code[class*="language-"].duotone-theme-forest::selection, code[class*="language-"].duotone-theme-forest ::selection { - text-shadow: none; - background: #435643; -} - -/* Code blocks */ -pre[class*="language-"].duotone-theme-forest { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].duotone-theme-forest { - padding: .1em; - border-radius: .3em; -} - -.duotone-theme-forest .token.comment, -.duotone-theme-forest .token.prolog, -.duotone-theme-forest .token.doctype, -.duotone-theme-forest .token.cdata { - color: #535f53; -} - -.duotone-theme-forest .token.punctuation { - color: #535f53; -} - -.duotone-theme-forest .token.namespace { - opacity: .7; -} - -.duotone-theme-forest .token.tag, -.duotone-theme-forest .token.operator, -.duotone-theme-forest .token.number { - color: #a2b34d; -} - -.duotone-theme-forest .token.property, -.duotone-theme-forest .token.function { - color: #687d68; -} - -.duotone-theme-forest .token.tag-id, -.duotone-theme-forest .token.selector, -.duotone-theme-forest .token.atrule-id { - color: #f0fff0; -} - -code.language-javascript, -.duotone-theme-forest .token.attr-name { - color: #b3d6b3; -} - -code.language-css, -code.language-scss, -.duotone-theme-forest .token.boolean, -.duotone-theme-forest .token.string, -.duotone-theme-forest .token.entity, -.duotone-theme-forest .token.url, -.language-css .duotone-theme-forest .token.string, -.language-scss .duotone-theme-forest .token.string, -.style .duotone-theme-forest .token.string, -.duotone-theme-forest .token.attr-value, -.duotone-theme-forest .token.keyword, -.duotone-theme-forest .token.control, -.duotone-theme-forest .token.directive, -.duotone-theme-forest .token.unit, -.duotone-theme-forest .token.statement, -.duotone-theme-forest .token.regex, -.duotone-theme-forest .token.atrule { - color: #e5fb79; -} - -.duotone-theme-forest .token.placeholder, -.duotone-theme-forest .token.variable { - color: #e5fb79; -} - -.duotone-theme-forest .token.deleted { - text-decoration: line-through; -} - -.duotone-theme-forest .token.inserted { - border-bottom: 1px dotted #f0fff0; - text-decoration: none; -} - -.duotone-theme-forest .token.italic { - font-style: italic; -} - -.duotone-theme-forest .token.important, -.duotone-theme-forest .token.bold { - font-weight: bold; -} - -.duotone-theme-forest .token.important { - color: #b3d6b3; -} - -.duotone-theme-forest .token.entity { - cursor: help; -} - -pre > code.highlight { - outline: .4em solid #5c705c; - outline-offset: .4em; -} - -/* overrides color-values for the Line Numbers plugin - * http://prismjs.com/plugins/line-numbers/ - */ -.line-numbers.line-numbers .line-numbers-rows { - border-right-color: #2c302c; -} - -.line-numbers .line-numbers-rows > span:before { - color: #3b423b; -} - -/* overrides color-values for the Line Highlight plugin -* http://prismjs.com/plugins/line-highlight/ -*/ -.line-highlight.line-highlight { - background: rgba(162, 179, 77, 0.2); - background: -webkit-linear-gradient(left, rgba(162, 179, 77, 0.2) 70%, rgba(162, 179, 77, 0)); - background: linear-gradient(to right, rgba(162, 179, 77, 0.2) 70%, rgba(162, 179, 77, 0)); -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-4DD8479BE14A755645BC09FF433FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css b/fastn-core/tests/22-http-headers/output/code-theme-4DD8479BE14A755645BC09FF433FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css deleted file mode 100644 index e1095a1fcd..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-4DD8479BE14A755645BC09FF433FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css +++ /dev/null @@ -1,172 +0,0 @@ -/* -Name: Duotone Space -Author: Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) - -Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-space-dark.css) -Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) -*/ - -code[class*="language-"].duotone-theme-space, -pre[class*="language-"].duotone-theme-space { - font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; - font-size: 14px; - line-height: 1.375; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; - background: #24242e; - color: #767693; -} - -pre > code[class*="language-"].duotone-theme-space { - font-size: 1em; -} - -pre[class*="language-"].duotone-theme-space::-moz-selection, pre[class*="language-"].duotone-theme-space ::-moz-selection, -code[class*="language-"].duotone-theme-space::-moz-selection, code[class*="language-"].duotone-theme-space ::-moz-selection { - text-shadow: none; - background: #5151e6; -} - -pre[class*="language-"].duotone-theme-space::selection, pre[class*="language-"].duotone-theme-space ::selection, -code[class*="language-"].duotone-theme-space::selection, code[class*="language-"].duotone-theme-space ::selection { - text-shadow: none; - background: #5151e6; -} - -/* Code blocks */ -pre[class*="language-"].duotone-theme-space { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].duotone-theme-space { - padding: .1em; - border-radius: .3em; -} - -.duotone-theme-space .token.comment, -.duotone-theme-space .token.prolog, -.duotone-theme-space .token.doctype, -.duotone-theme-space .token.cdata { - color: #5b5b76; -} - -.duotone-theme-space .token.punctuation { - color: #5b5b76; -} - -.duotone-theme-space .token.namespace { - opacity: .7; -} - -.duotone-theme-space .token.tag, -.duotone-theme-space .token.operator, -.duotone-theme-space .token.number { - color: #dd672c; -} - -.duotone-theme-space .token.property, -.duotone-theme-space .token.function { - color: #767693; -} - -.duotone-theme-space .token.tag-id, -.duotone-theme-space .token.selector, -.duotone-theme-space .token.atrule-id { - color: #ebebff; -} - -code.language-javascript, -.duotone-theme-space .token.attr-name { - color: #aaaaca; -} - -code.language-css, -code.language-scss, -.duotone-theme-space .token.boolean, -.duotone-theme-space .token.string, -.duotone-theme-space .token.entity, -.duotone-theme-space .token.url, -.language-css .duotone-theme-space .token.string, -.language-scss .duotone-theme-space .token.string, -.style .duotone-theme-space .token.string, -.duotone-theme-space .token.attr-value, -.duotone-theme-space .token.keyword, -.duotone-theme-space .token.control, -.duotone-theme-space .token.directive, -.duotone-theme-space .token.unit, -.duotone-theme-space .token.statement, -.duotone-theme-space .token.regex, -.duotone-theme-space .token.atrule { - color: #fe8c52; -} - -.duotone-theme-space .token.placeholder, -.duotone-theme-space .token.variable { - color: #fe8c52; -} - -.duotone-theme-space .token.deleted { - text-decoration: line-through; -} - -.duotone-theme-space .token.inserted { - border-bottom: 1px dotted #ebebff; - text-decoration: none; -} - -.duotone-theme-space .token.italic { - font-style: italic; -} - -.duotone-theme-space .token.important, -.duotone-theme-space .token.bold { - font-weight: bold; -} - -.duotone-theme-space .token.important { - color: #aaaaca; -} - -.duotone-theme-space .token.entity { - cursor: help; -} - -pre > code.highlight { - outline: .4em solid #7676f4; - outline-offset: .4em; -} - -/* overrides color-values for the Line Numbers plugin - * http://prismjs.com/plugins/line-numbers/ - */ -.line-numbers.line-numbers .line-numbers-rows { - border-right-color: #262631; -} - -.line-numbers .line-numbers-rows > span:before { - color: #393949; -} - -/* overrides color-values for the Line Highlight plugin -* http://prismjs.com/plugins/line-highlight/ -*/ -.line-highlight.line-highlight { - background: rgba(221, 103, 44, 0.2); - background: -webkit-linear-gradient(left, rgba(221, 103, 44, 0.2) 70%, rgba(221, 103, 44, 0)); - background: linear-gradient(to right, rgba(221, 103, 44, 0.2) 70%, rgba(221, 103, 44, 0)); -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-60E02531E77333F3F1B636C4FC43E976EA9F41AD75268B2DD825C33C68B573A6.css b/fastn-core/tests/22-http-headers/output/code-theme-60E02531E77333F3F1B636C4FC43E976EA9F41AD75268B2DD825C33C68B573A6.css deleted file mode 100644 index 0353aa3fbe..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-60E02531E77333F3F1B636C4FC43E976EA9F41AD75268B2DD825C33C68B573A6.css +++ /dev/null @@ -1,428 +0,0 @@ -/** - * One Light theme for prism.js - * Based on Atom's One Light theme: https://github.com/atom/atom/tree/master/packages/one-light-syntax - */ - -/** - * One Light colours (accurate as of commit eb064bf on 19 Feb 2021) - * From colors.less - * --mono-1: hsl(230, 8%, 24%); - * --mono-2: hsl(230, 6%, 44%); - * --mono-3: hsl(230, 4%, 64%) - * --hue-1: hsl(198, 99%, 37%); - * --hue-2: hsl(221, 87%, 60%); - * --hue-3: hsl(301, 63%, 40%); - * --hue-4: hsl(119, 34%, 47%); - * --hue-5: hsl(5, 74%, 59%); - * --hue-5-2: hsl(344, 84%, 43%); - * --hue-6: hsl(35, 99%, 36%); - * --hue-6-2: hsl(35, 99%, 40%); - * --syntax-fg: hsl(230, 8%, 24%); - * --syntax-bg: hsl(230, 1%, 98%); - * --syntax-gutter: hsl(230, 1%, 62%); - * --syntax-guide: hsla(230, 8%, 24%, 0.2); - * --syntax-accent: hsl(230, 100%, 66%); - * From syntax-variables.less - * --syntax-selection-color: hsl(230, 1%, 90%); - * --syntax-gutter-background-color-selected: hsl(230, 1%, 90%); - * --syntax-cursor-line: hsla(230, 8%, 24%, 0.05); - */ - -code[class*="language-"].one-theme-light, -pre[class*="language-"].one-theme-light { - background: hsl(230, 1%, 98%); - color: hsl(230, 8%, 24%); - font-family: "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - line-height: 1.5; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -/* Selection */ -code[class*="language-"].one-theme-light::-moz-selection, -code[class*="language-"].one-theme-light *::-moz-selection, -pre[class*="language-"].one-theme-light *::-moz-selection { - background: hsl(230, 1%, 90%); - color: inherit; -} - -code[class*="language-"].one-theme-light::selection, -code[class*="language-"].one-theme-light *::selection, -pre[class*="language-"].one-theme-light *::selection { - background: hsl(230, 1%, 90%); - color: inherit; -} - -/* Code blocks */ -pre[class*="language-"].one-theme-light { - padding: 1em; - margin: 0.5em 0; - overflow: auto; - border-radius: 0.3em; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].one-theme-light { - padding: 0.2em 0.3em; - border-radius: 0.3em; - white-space: normal; -} - -.one-theme-light .token.comment, -.one-theme-light .token.prolog, -.one-theme-light .token.cdata { - color: hsl(230, 4%, 64%); -} - -.one-theme-light .token.doctype, -.one-theme-light .token.punctuation, -.one-theme-light .token.entity { - color: hsl(230, 8%, 24%); -} - -.one-theme-light .token.attr-name, -.one-theme-light .token.class-name, -.one-theme-light .token.boolean, -.one-theme-light .token.constant, -.one-theme-light .token.number, -.one-theme-light .token.atrule { - color: hsl(35, 99%, 36%); -} - -.one-theme-light .token.keyword { - color: hsl(301, 63%, 40%); -} - -.one-theme-light .token.property, -.one-theme-light .token.tag, -.one-theme-light .token.symbol, -.one-theme-light .token.deleted, -.one-theme-light .token.important { - color: hsl(5, 74%, 59%); -} - -.one-theme-light .token.selector, -.one-theme-light .token.string, -.one-theme-light .token.char, -.one-theme-light .token.builtin, -.one-theme-light .token.inserted, -.one-theme-light .token.regex, -.one-theme-light .token.attr-value, -.one-theme-light .token.attr-value > .one-theme-light .token.punctuation { - color: hsl(119, 34%, 47%); -} - -.one-theme-light .token.variable, -.one-theme-light .token.operator, -.one-theme-light .token.function { - color: hsl(221, 87%, 60%); -} - -.one-theme-light .token.url { - color: hsl(198, 99%, 37%); -} - -/* HTML overrides */ -.one-theme-light .token.attr-value > .one-theme-light .token.punctuation.attr-equals, -.one-theme-light .token.special-attr > .one-theme-light .token.attr-value > .one-theme-light .token.value.css { - color: hsl(230, 8%, 24%); -} - -/* CSS overrides */ -.language-css .one-theme-light .token.selector { - color: hsl(5, 74%, 59%); -} - -.language-css .one-theme-light .token.property { - color: hsl(230, 8%, 24%); -} - -.language-css .one-theme-light .token.function, -.language-css .one-theme-light .token.url > .one-theme-light .token.function { - color: hsl(198, 99%, 37%); -} - -.language-css .one-theme-light .token.url > .one-theme-light .token.string.url { - color: hsl(119, 34%, 47%); -} - -.language-css .one-theme-light .token.important, -.language-css .one-theme-light .token.atrule .one-theme-light .token.rule { - color: hsl(301, 63%, 40%); -} - -/* JS overrides */ -.language-javascript .one-theme-light .token.operator { - color: hsl(301, 63%, 40%); -} - -.language-javascript .one-theme-light .token.template-string > .one-theme-light .token.interpolation > .one-theme-light .token.interpolation-punctuation.punctuation { - color: hsl(344, 84%, 43%); -} - -/* JSON overrides */ -.language-json .one-theme-light .token.operator { - color: hsl(230, 8%, 24%); -} - -.language-json .one-theme-light .token.null.keyword { - color: hsl(35, 99%, 36%); -} - -/* MD overrides */ -.language-markdown .one-theme-light .token.url, -.language-markdown .one-theme-light .token.url > .one-theme-light .token.operator, -.language-markdown .one-theme-light .token.url-reference.url > .one-theme-light .token.string { - color: hsl(230, 8%, 24%); -} - -.language-markdown .one-theme-light .token.url > .one-theme-light .token.content { - color: hsl(221, 87%, 60%); -} - -.language-markdown .one-theme-light .token.url > .one-theme-light .token.url, -.language-markdown .one-theme-light .token.url-reference.url { - color: hsl(198, 99%, 37%); -} - -.language-markdown .one-theme-light .token.blockquote.punctuation, -.language-markdown .one-theme-light .token.hr.punctuation { - color: hsl(230, 4%, 64%); - font-style: italic; -} - -.language-markdown .one-theme-light .token.code-snippet { - color: hsl(119, 34%, 47%); -} - -.language-markdown .one-theme-light .token.bold .one-theme-light .token.content { - color: hsl(35, 99%, 36%); -} - -.language-markdown .one-theme-light .token.italic .one-theme-light .token.content { - color: hsl(301, 63%, 40%); -} - -.language-markdown .one-theme-light .token.strike .one-theme-light .token.content, -.language-markdown .one-theme-light .token.strike .one-theme-light .token.punctuation, -.language-markdown .one-theme-light .token.list.punctuation, -.language-markdown .one-theme-light .token.title.important > .one-theme-light .token.punctuation { - color: hsl(5, 74%, 59%); -} - -/* General */ -.one-theme-light .token.bold { - font-weight: bold; -} - -.one-theme-light .token.comment, -.one-theme-light .token.italic { - font-style: italic; -} - -.one-theme-light .token.entity { - cursor: help; -} - -.one-theme-light .token.namespace { - opacity: 0.8; -} - -/* Plugin overrides */ -/* Selectors should have higher specificity than those in the plugins' default stylesheets */ - -/* Show Invisibles plugin overrides */ -.one-theme-light .token.one-theme-light .token.tab:not(:empty):before, -.one-theme-light .token.one-theme-light .token.cr:before, -.one-theme-light .token.one-theme-light .token.lf:before, -.one-theme-light .token.one-theme-light .token.space:before { - color: hsla(230, 8%, 24%, 0.2); -} - -/* Toolbar plugin overrides */ -/* Space out all buttons and move them away from the right edge of the code block */ -div.code-toolbar > .toolbar.toolbar > .toolbar-item { - margin-right: 0.4em; -} - -/* Styling the buttons */ -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span { - background: hsl(230, 1%, 90%); - color: hsl(230, 6%, 44%); - padding: 0.1em 0.4em; - border-radius: 0.3em; -} - -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus { - background: hsl(230, 1%, 78%); /* custom: darken(--syntax-bg, 20%) */ - color: hsl(230, 8%, 24%); -} - -/* Line Highlight plugin overrides */ -/* The highlighted line itself */ -.line-highlight.line-highlight { - background: hsla(230, 8%, 24%, 0.05); -} - -/* Default line numbers in Line Highlight plugin */ -.line-highlight.line-highlight:before, -.line-highlight.line-highlight[data-end]:after { - background: hsl(230, 1%, 90%); - color: hsl(230, 8%, 24%); - padding: 0.1em 0.6em; - border-radius: 0.3em; - box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.2); /* same as Toolbar plugin default */ -} - -/* Hovering over a linkable line number (in the gutter area) */ -/* Requires Line Numbers plugin as well */ -pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before { - background-color: hsla(230, 8%, 24%, 0.05); -} - -/* Line Numbers and Command Line plugins overrides */ -/* Line separating gutter from coding area */ -.line-numbers.line-numbers .line-numbers-rows, -.command-line .command-line-prompt { - border-right-color: hsla(230, 8%, 24%, 0.2); -} - -/* Stuff in the gutter */ -.line-numbers .line-numbers-rows > span:before, -.command-line .command-line-prompt > span:before { - color: hsl(230, 1%, 62%); -} - -/* Match Braces plugin overrides */ -/* Note: Outline colour is inherited from the braces */ -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-1, -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-5, -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-9 { - color: hsl(5, 74%, 59%); -} - -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-2, -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-6, -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-10 { - color: hsl(119, 34%, 47%); -} - -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-3, -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-7, -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-11 { - color: hsl(221, 87%, 60%); -} - -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-4, -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-8, -.rainbow-braces .one-theme-light .token.one-theme-light .token.punctuation.brace-level-12 { - color: hsl(301, 63%, 40%); -} - -/* Diff Highlight plugin overrides */ -/* Taken from https://github.com/atom/github/blob/master/styles/variables.less */ -pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.deleted:not(.prefix), -pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.deleted:not(.prefix) { - background-color: hsla(353, 100%, 66%, 0.15); -} - -pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.deleted:not(.prefix)::-moz-selection, -pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.deleted:not(.prefix) *::-moz-selection, -pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.deleted:not(.prefix)::-moz-selection, -pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.deleted:not(.prefix) *::-moz-selection { - background-color: hsla(353, 95%, 66%, 0.25); -} - -pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.deleted:not(.prefix)::selection, -pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.deleted:not(.prefix) *::selection, -pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.deleted:not(.prefix)::selection, -pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.deleted:not(.prefix) *::selection { - background-color: hsla(353, 95%, 66%, 0.25); -} - -pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.inserted:not(.prefix), -pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.inserted:not(.prefix) { - background-color: hsla(137, 100%, 55%, 0.15); -} - -pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.inserted:not(.prefix)::-moz-selection, -pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.inserted:not(.prefix) *::-moz-selection, -pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.inserted:not(.prefix)::-moz-selection, -pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.inserted:not(.prefix) *::-moz-selection { - background-color: hsla(135, 73%, 55%, 0.25); -} - -pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.inserted:not(.prefix)::selection, -pre.diff-highlight > code .one-theme-light .token.one-theme-light .token.inserted:not(.prefix) *::selection, -pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.inserted:not(.prefix)::selection, -pre > code.diff-highlight .one-theme-light .token.one-theme-light .token.inserted:not(.prefix) *::selection { - background-color: hsla(135, 73%, 55%, 0.25); -} - -/* Previewers plugin overrides */ -/* Based on https://github.com/atom-community/atom-ide-datatip/blob/master/styles/atom-ide-datatips.less and https://github.com/atom/atom/blob/master/packages/one-light-ui */ -/* Border around popup */ -.prism-previewer.prism-previewer:before, -.prism-previewer-gradient.prism-previewer-gradient div { - border-color: hsl(0, 0, 95%); -} - -/* Angle and time should remain as circles and are hence not included */ -.prism-previewer-color.prism-previewer-color:before, -.prism-previewer-gradient.prism-previewer-gradient div, -.prism-previewer-easing.prism-previewer-easing:before { - border-radius: 0.3em; -} - -/* Triangles pointing to the code */ -.prism-previewer.prism-previewer:after { - border-top-color: hsl(0, 0, 95%); -} - -.prism-previewer-flipped.prism-previewer-flipped.after { - border-bottom-color: hsl(0, 0, 95%); -} - -/* Background colour within the popup */ -.prism-previewer-angle.prism-previewer-angle:before, -.prism-previewer-time.prism-previewer-time:before, -.prism-previewer-easing.prism-previewer-easing { - background: hsl(0, 0%, 100%); -} - -/* For angle, this is the positive area (eg. 90deg will display one quadrant in this colour) */ -/* For time, this is the alternate colour */ -.prism-previewer-angle.prism-previewer-angle circle, -.prism-previewer-time.prism-previewer-time circle { - stroke: hsl(230, 8%, 24%); - stroke-opacity: 1; -} - -/* Stroke colours of the handle, direction point, and vector itself */ -.prism-previewer-easing.prism-previewer-easing circle, -.prism-previewer-easing.prism-previewer-easing path, -.prism-previewer-easing.prism-previewer-easing line { - stroke: hsl(230, 8%, 24%); -} - -/* Fill colour of the handle */ -.prism-previewer-easing.prism-previewer-easing circle { - fill: transparent; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-6EB6F03F9F578742CA0CD1189693E43A6135D910989ADD88CA3C0D6117EE24D7.css b/fastn-core/tests/22-http-headers/output/code-theme-6EB6F03F9F578742CA0CD1189693E43A6135D910989ADD88CA3C0D6117EE24D7.css deleted file mode 100644 index 96ee075b18..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-6EB6F03F9F578742CA0CD1189693E43A6135D910989ADD88CA3C0D6117EE24D7.css +++ /dev/null @@ -1,172 +0,0 @@ -/* -Name: Duotone Earth -Author: Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) - -Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-earth-dark.css) -Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) -*/ - -code[class*="language-"].duotone-theme-earth, -pre[class*="language-"].duotone-theme-earth { - font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; - font-size: 14px; - line-height: 1.375; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; - background: #322d29; - color: #88786d; -} - -pre > code[class*="language-"].duotone-theme-earth { - font-size: 1em; -} - -pre[class*="language-"].duotone-theme-earth::-moz-selection, pre[class*="language-"].duotone-theme-earth ::-moz-selection, -code[class*="language-"].duotone-theme-earth::-moz-selection, code[class*="language-"].duotone-theme-earth ::-moz-selection { - text-shadow: none; - background: #6f5849; -} - -pre[class*="language-"].duotone-theme-earth::selection, pre[class*="language-"].duotone-theme-earth ::selection, -code[class*="language-"].duotone-theme-earth::selection, code[class*="language-"].duotone-theme-earth ::selection { - text-shadow: none; - background: #6f5849; -} - -/* Code blocks */ -pre[class*="language-"].duotone-theme-earth { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].duotone-theme-earth { - padding: .1em; - border-radius: .3em; -} - -.duotone-theme-earth .token.comment, -.duotone-theme-earth .token.prolog, -.duotone-theme-earth .token.doctype, -.duotone-theme-earth .token.cdata { - color: #6a5f58; -} - -.duotone-theme-earth .token.punctuation { - color: #6a5f58; -} - -.duotone-theme-earth .token.namespace { - opacity: .7; -} - -.duotone-theme-earth .token.tag, -.duotone-theme-earth .token.operator, -.duotone-theme-earth .token.number { - color: #bfa05a; -} - -.duotone-theme-earth .token.property, -.duotone-theme-earth .token.function { - color: #88786d; -} - -.duotone-theme-earth .token.tag-id, -.duotone-theme-earth .token.selector, -.duotone-theme-earth .token.atrule-id { - color: #fff3eb; -} - -code.language-javascript, -.duotone-theme-earth .token.attr-name { - color: #a48774; -} - -code.language-css, -code.language-scss, -.duotone-theme-earth .token.boolean, -.duotone-theme-earth .token.string, -.duotone-theme-earth .token.entity, -.duotone-theme-earth .token.url, -.language-css .duotone-theme-earth .token.string, -.language-scss .duotone-theme-earth .token.string, -.style .duotone-theme-earth .token.string, -.duotone-theme-earth .token.attr-value, -.duotone-theme-earth .token.keyword, -.duotone-theme-earth .token.control, -.duotone-theme-earth .token.directive, -.duotone-theme-earth .token.unit, -.duotone-theme-earth .token.statement, -.duotone-theme-earth .token.regex, -.duotone-theme-earth .token.atrule { - color: #fcc440; -} - -.duotone-theme-earth .token.placeholder, -.duotone-theme-earth .token.variable { - color: #fcc440; -} - -.duotone-theme-earth .token.deleted { - text-decoration: line-through; -} - -.duotone-theme-earth .token.inserted { - border-bottom: 1px dotted #fff3eb; - text-decoration: none; -} - -.duotone-theme-earth .token.italic { - font-style: italic; -} - -.duotone-theme-earth .token.important, -.duotone-theme-earth .token.bold { - font-weight: bold; -} - -.duotone-theme-earth .token.important { - color: #a48774; -} - -.duotone-theme-earth .token.entity { - cursor: help; -} - -pre > code.highlight { - outline: .4em solid #816d5f; - outline-offset: .4em; -} - -/* overrides color-values for the Line Numbers plugin - * http://prismjs.com/plugins/line-numbers/ - */ -.line-numbers.line-numbers .line-numbers-rows { - border-right-color: #35302b; -} - -.line-numbers .line-numbers-rows > span:before { - color: #46403d; -} - -/* overrides color-values for the Line Highlight plugin -* http://prismjs.com/plugins/line-highlight/ -*/ -.line-highlight.line-highlight { - background: rgba(191, 160, 90, 0.2); - background: -webkit-linear-gradient(left, rgba(191, 160, 90, 0.2) 70%, rgba(191, 160, 90, 0)); - background: linear-gradient(to right, rgba(191, 160, 90, 0.2) 70%, rgba(191, 160, 90, 0)); -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-7852E516BA094B01897820BB3432BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css b/fastn-core/tests/22-http-headers/output/code-theme-7852E516BA094B01897820BB3432BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css deleted file mode 100644 index c4e4d34880..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-7852E516BA094B01897820BB3432BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css +++ /dev/null @@ -1,168 +0,0 @@ -/** - * VS theme by Andrew Lock (https://andrewlock.net) - * Inspired by Visual Studio syntax coloring - */ - -code[class*="language-"].vs-theme-light, -pre[class*="language-"].vs-theme-light { - color: #393A34; - font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - font-size: .9em; - line-height: 1.2em; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre > code[class*="language-"].vs-theme-light { - font-size: 1em; -} - -pre[class*="language-"].vs-theme-light::-moz-selection, pre[class*="language-"].vs-theme-light ::-moz-selection, -code[class*="language-"].vs-theme-light::-moz-selection, code[class*="language-"].vs-theme-light ::-moz-selection { - background: #C1DEF1; -} - -pre[class*="language-"].vs-theme-light::selection, pre[class*="language-"].vs-theme-light ::selection, -code[class*="language-"].vs-theme-light::selection, code[class*="language-"].vs-theme-light ::selection { - background: #C1DEF1; -} - -/* Code blocks */ -pre[class*="language-"].vs-theme-light { - padding: 1em; - margin: .5em 0; - overflow: auto; - border: 1px solid #dddddd; - background-color: white; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].vs-theme-light { - padding: .2em; - padding-top: 1px; - padding-bottom: 1px; - background: #f8f8f8; - border: 1px solid #dddddd; -} - -.vs-theme-light .token.comment, -.vs-theme-light .token.prolog, -.vs-theme-light .token.doctype, -.vs-theme-light .token.cdata { - color: #008000; - font-style: italic; -} - -.vs-theme-light .token.namespace { - opacity: .7; -} - -.vs-theme-light .token.string { - color: #A31515; -} - -.vs-theme-light .token.punctuation, -.vs-theme-light .token.operator { - color: #393A34; /* no highlight */ -} - -.vs-theme-light .token.url, -.vs-theme-light .token.symbol, -.vs-theme-light .token.number, -.vs-theme-light .token.boolean, -.vs-theme-light .token.variable, -.vs-theme-light .token.constant, -.vs-theme-light .token.inserted { - color: #36acaa; -} - -.vs-theme-light .token.atrule, -.vs-theme-light .token.keyword, -.vs-theme-light .token.attr-value, -.language-autohotkey .vs-theme-light .token.selector, -.language-json .vs-theme-light .token.boolean, -.language-json .vs-theme-light .token.number, -code[class*="language-css"] { - color: #0000ff; -} - -.vs-theme-light .token.function { - color: #393A34; -} - -.vs-theme-light .token.deleted, -.language-autohotkey .vs-theme-light .token.tag { - color: #9a050f; -} - -.vs-theme-light .token.selector, -.language-autohotkey .vs-theme-light .token.keyword { - color: #00009f; -} - -.vs-theme-light .token.important { - color: #e90; -} - -.vs-theme-light .token.important, -.vs-theme-light .token.bold { - font-weight: bold; -} - -.vs-theme-light .token.italic { - font-style: italic; -} - -.vs-theme-light .token.class-name, -.language-json .vs-theme-light .token.property { - color: #2B91AF; -} - -.vs-theme-light .token.tag, -.vs-theme-light .token.selector { - color: #800000; -} - -.vs-theme-light .token.attr-name, -.vs-theme-light .token.property, -.vs-theme-light .token.regex, -.vs-theme-light .token.entity { - color: #ff0000; -} - -.vs-theme-light .token.directive.tag .tag { - background: #ffff00; - color: #393A34; -} - -/* overrides color-values for the Line Numbers plugin - * http://prismjs.com/plugins/line-numbers/ - */ -.line-numbers.line-numbers .line-numbers-rows { - border-right-color: #a5a5a5; -} - -.line-numbers .line-numbers-rows > span:before { - color: #2B91AF; -} - -/* overrides color-values for the Line Highlight plugin -* http://prismjs.com/plugins/line-highlight/ -*/ -.line-highlight.line-highlight { - background: rgba(193, 222, 241, 0.2); - background: -webkit-linear-gradient(left, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0)); - background: linear-gradient(to right, rgba(193, 222, 241, 0.2) 70%, rgba(221, 222, 241, 0)); -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-792C7BB9F4C8DFF3E0CBC354D2084DBF71BC5750C2C1357F0E7D936867AFAB62.css b/fastn-core/tests/22-http-headers/output/code-theme-792C7BB9F4C8DFF3E0CBC354D2084DBF71BC5750C2C1357F0E7D936867AFAB62.css deleted file mode 100644 index 8f0bbb35c5..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-792C7BB9F4C8DFF3E0CBC354D2084DBF71BC5750C2C1357F0E7D936867AFAB62.css +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Z-Toch - * by Zeel Codder - * https://github.com/zeel-codder - * - */ -code[class*="language-"].ztouch-theme, -pre[class*="language-"].ztouch-theme { - color: #22da17; - font-family: monospace; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; - line-height: 25px; - font-size: 18px; - margin: 5px 0; -} - -pre[class*="language-"].ztouch-theme * { - font-family: monospace; -} - -:not(pre) > code[class*="language-"].ztouch-theme, -pre[class*="language-"].ztouch-theme { - color: white; - background: #0a143c; - padding: 22px; -} - -/* Code blocks */ -pre[class*="language-"].ztouch-theme { - padding: 1em; - margin: 0.5em 0; - overflow: auto; -} - -pre[class*="language-"].ztouch-theme::-moz-selection, -pre[class*="language-"].ztouch-theme ::-moz-selection, -code[class*="language-"].ztouch-theme::-moz-selection, -code[class*="language-"].ztouch-theme ::-moz-selection { - text-shadow: none; - background: rgba(29, 59, 83, 0.99); -} - -pre[class*="language-"].ztouch-theme::selection, -pre[class*="language-"].ztouch-theme ::selection, -code[class*="language-"].ztouch-theme::selection, -code[class*="language-"].ztouch-theme ::selection { - text-shadow: none; - background: rgba(29, 59, 83, 0.99); -} - -@media print { - code[class*="language-"].ztouch-theme, - pre[class*="language-"].ztouch-theme { - text-shadow: none; - } -} - -:not(pre) > code[class*="language-"].ztouch-theme { - padding: 0.1em; - border-radius: 0.3em; - white-space: normal; -} - -.ztouch-theme .token.comment, -.ztouch-theme .token.prolog, -.ztouch-theme .token.cdata { - color: rgb(99, 119, 119); - font-style: italic; -} - -.ztouch-theme .token.punctuation { - color: rgb(199, 146, 234); -} - -.namespace { - color: rgb(178, 204, 214); -} - -.ztouch-theme .token.deleted { - color: rgba(239, 83, 80, 0.56); - font-style: italic; -} - -.ztouch-theme .token.symbol, -.ztouch-theme .token.property { - color: rgb(128, 203, 196); -} - -.ztouch-theme .token.tag, -.ztouch-theme .token.operator, -.ztouch-theme .token.keyword { - color: rgb(127, 219, 202); -} - -.ztouch-theme .token.boolean { - color: rgb(255, 88, 116); -} - -.ztouch-theme .token.number { - color: rgb(247, 140, 108); -} - -.ztouch-theme .token.constant, -.ztouch-theme .token.function, -.ztouch-theme .token.builtin, -.ztouch-theme .token.char { - color: rgb(34 183 199); -} - -.ztouch-theme .token.selector, -.ztouch-theme .token.doctype { - color: rgb(199, 146, 234); - font-style: italic; -} - -.ztouch-theme .token.attr-name, -.ztouch-theme .token.inserted { - color: rgb(173, 219, 103); - font-style: italic; -} - -.ztouch-theme .token.string, -.ztouch-theme .token.url, -.ztouch-theme .token.entity, -.language-css .ztouch-theme .token.string, -.style .ztouch-theme .token.string { - color: rgb(173, 219, 103); -} - -.ztouch-theme .token.class-name, -.ztouch-theme .token.atrule, -.ztouch-theme .token.attr-value { - color: rgb(255, 203, 139); -} - -.ztouch-theme .token.regex, -.ztouch-theme .token.important, -.ztouch-theme .token.variable { - color: rgb(214, 222, 235); -} - -.ztouch-theme .token.important, -.ztouch-theme .token.bold { - font-weight: bold; -} - -.ztouch-theme .token.italic { - font-style: italic; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-88F91252A8A0EA125B4BA2C7B85E65580DB580F1477931AADCB5118E4E69D1CD.css b/fastn-core/tests/22-http-headers/output/code-theme-88F91252A8A0EA125B4BA2C7B85E65580DB580F1477931AADCB5118E4E69D1CD.css deleted file mode 100644 index a4fd66e9de..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-88F91252A8A0EA125B4BA2C7B85E65580DB580F1477931AADCB5118E4E69D1CD.css +++ /dev/null @@ -1,158 +0,0 @@ -/** - * MIT License - * Copyright (c) 2018 Sarah Drasner - * Sarah Drasner's[@sdras] Night Owl - * Ported by Sara vieria [@SaraVieira] - * Added by Souvik Mandal [@SimpleIndian] - */ - -code[class*="language-"].nightowl-theme, -pre[class*="language-"].nightowl-theme { - color: #d6deeb; - font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - font-size: 1em; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"].nightowl-theme::-moz-selection, -pre[class*="language-"].nightowl-theme::-moz-selection, -code[class*="language-"].nightowl-theme::-moz-selection, -code[class*="language-"].nightowl-theme::-moz-selection { - text-shadow: none; - background: rgba(29, 59, 83, 0.99); -} - -pre[class*="language-"].nightowl-theme::selection, -pre[class*="language-"].nightowl-theme ::selection, -code[class*="language-"].nightowl-theme::selection, -code[class*="language-"].nightowl-theme ::selection { - text-shadow: none; - background: rgba(29, 59, 83, 0.99); -} - -@media print { - code[class*="language-"].nightowl-theme, - pre[class*="language-"].nightowl-theme { - text-shadow: none; - } -} - -/* Code blocks */ -pre[class*="language-"].nightowl-theme { - padding: 1em; - margin: 0.5em 0; - overflow: auto; -} - -:not(pre) > code[class*="language-"].nightowl-theme, -pre[class*="language-"].nightowl-theme { - color: white; - background: #011627; -} - -:not(pre) > code[class*="language-"].nightowl-theme { - padding: 0.1em; - border-radius: 0.3em; - white-space: normal; -} - -.nightowl-theme .token.comment, -.nightowl-theme .token.prolog, -.nightowl-theme .token.cdata { - color: rgb(99, 119, 119); - font-style: italic; -} - -.nightowl-theme .token.punctuation { - color: rgb(199, 146, 234); -} - -.namespace { - color: rgb(178, 204, 214); -} - -.nightowl-theme .token.deleted { - color: rgba(239, 83, 80, 0.56); - font-style: italic; -} - -.nightowl-theme .token.symbol, -.nightowl-theme .token.property { - color: rgb(128, 203, 196); -} - -.nightowl-theme .token.tag, -.nightowl-theme .token.operator, -.nightowl-theme .token.keyword { - color: rgb(127, 219, 202); -} - -.nightowl-theme .token.boolean { - color: rgb(255, 88, 116); -} - -.nightowl-theme .token.number { - color: rgb(247, 140, 108); -} - -.nightowl-theme .token.constant, -.nightowl-theme .token.function, -.nightowl-theme .token.builtin, -.nightowl-theme .token.char { - color: rgb(130, 170, 255); -} - -.nightowl-theme .token.selector, -.nightowl-theme .token.doctype { - color: rgb(199, 146, 234); - font-style: italic; -} - -.nightowl-theme .token.attr-name, -.nightowl-theme .token.inserted { - color: rgb(173, 219, 103); - font-style: italic; -} - -.nightowl-theme .token.string, -.nightowl-theme .token.url, -.nightowl-theme .token.entity, -.language-css .nightowl-theme .token.string, -.style .nightowl-theme .token.string { - color: rgb(173, 219, 103); -} - -.nightowl-theme .token.class-name, -.nightowl-theme .token.atrule, -.nightowl-theme .token.attr-value { - color: rgb(255, 203, 139); -} - -.nightowl-theme .token.regex, -.nightowl-theme .token.important, -.nightowl-theme .token.variable { - color: rgb(214, 222, 235); -} - -.nightowl-theme .token.important, -.nightowl-theme .token.bold { - font-weight: bold; -} - -.nightowl-theme .token.italic { - font-style: italic; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-8C59190F5018F48CCBB063359072EE9053D04923BBC5D1BA52B574E78D8C536A.css b/fastn-core/tests/22-http-headers/output/code-theme-8C59190F5018F48CCBB063359072EE9053D04923BBC5D1BA52B574E78D8C536A.css deleted file mode 100644 index 74b9801c00..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-8C59190F5018F48CCBB063359072EE9053D04923BBC5D1BA52B574E78D8C536A.css +++ /dev/null @@ -1,207 +0,0 @@ -code[class*="language-"].material-theme-light, -pre[class*="language-"].material-theme-light { - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - color: #90a4ae; - background: #fafafa; - font-family: Roboto Mono, monospace; - font-size: 1em; - line-height: 1.5em; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -code[class*="language-"].material-theme-light::-moz-selection, -pre[class*="language-"].material-theme-light::-moz-selection, -code[class*="language-"].material-theme-light ::-moz-selection, -pre[class*="language-"].material-theme-light ::-moz-selection { - background: #cceae7; - color: #263238; -} - -code[class*="language-"].material-theme-light::selection, -pre[class*="language-"].material-theme-light::selection, -code[class*="language-"].material-theme-light ::selection, -pre[class*="language-"].material-theme-light ::selection { - background: #cceae7; - color: #263238; -} - -:not(pre) > code[class*="language-"].material-theme-light { - white-space: normal; - border-radius: 0.2em; - padding: 0.1em; -} - -pre[class*="language-"].material-theme-light { - overflow: auto; - position: relative; - margin: 0.5em 0; - padding: 1.25em 1em; -} - -.language-css > code, -.language-sass > code, -.language-scss > code { - color: #f76d47; -} - -[class*="language-"].material-theme-light .namespace { - opacity: 0.7; -} - -.material-theme-light .token.atrule { - color: #7c4dff; -} - -.material-theme-light .token.attr-name { - color: #39adb5; -} - -.material-theme-light .token.attr-value { - color: #f6a434; -} - -.material-theme-light .token.attribute { - color: #f6a434; -} - -.material-theme-light .token.boolean { - color: #7c4dff; -} - -.material-theme-light .token.builtin { - color: #39adb5; -} - -.material-theme-light .token.cdata { - color: #39adb5; -} - -.material-theme-light .token.char { - color: #39adb5; -} - -.material-theme-light .token.class { - color: #39adb5; -} - -.material-theme-light .token.class-name { - color: #6182b8; -} - -.material-theme-light .token.comment { - color: #aabfc9; -} - -.material-theme-light .token.constant { - color: #7c4dff; -} - -.material-theme-light .token.deleted { - color: #e53935; -} - -.material-theme-light .token.doctype { - color: #aabfc9; -} - -.material-theme-light .token.entity { - color: #e53935; -} - -.material-theme-light .token.function { - color: #7c4dff; -} - -.material-theme-light .token.hexcode { - color: #f76d47; -} - -.material-theme-light .token.id { - color: #7c4dff; - font-weight: bold; -} - -.material-theme-light .token.important { - color: #7c4dff; - font-weight: bold; -} - -.material-theme-light .token.inserted { - color: #39adb5; -} - -.material-theme-light .token.keyword { - color: #7c4dff; -} - -.material-theme-light .token.number { - color: #f76d47; -} - -.material-theme-light .token.operator { - color: #39adb5; -} - -.material-theme-light .token.prolog { - color: #aabfc9; -} - -.material-theme-light .token.property { - color: #39adb5; -} - -.material-theme-light .token.pseudo-class { - color: #f6a434; -} - -.material-theme-light .token.pseudo-element { - color: #f6a434; -} - -.material-theme-light .token.punctuation { - color: #39adb5; -} - -.material-theme-light .token.regex { - color: #6182b8; -} - -.material-theme-light .token.selector { - color: #e53935; -} - -.material-theme-light .token.string { - color: #f6a434; -} - -.material-theme-light .token.symbol { - color: #7c4dff; -} - -.material-theme-light .token.tag { - color: #e53935; -} - -.material-theme-light .token.unit { - color: #f76d47; -} - -.material-theme-light .token.url { - color: #e53935; -} - -.material-theme-light .token.variable { - color: #e53935; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-8CCA3D600F91FA55950DF3132F2ABE4BA14CEEA13CD23E157BF6A137762B8452.css b/fastn-core/tests/22-http-headers/output/code-theme-8CCA3D600F91FA55950DF3132F2ABE4BA14CEEA13CD23E157BF6A137762B8452.css deleted file mode 100644 index 911b935600..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-8CCA3D600F91FA55950DF3132F2ABE4BA14CEEA13CD23E157BF6A137762B8452.css +++ /dev/null @@ -1,205 +0,0 @@ -code[class*="language-"].material-theme-dark, -pre[class*="language-"].material-theme-dark { - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - color: #eee; - background: #2f2f2f; - font-family: Roboto Mono, monospace; - font-size: 1em; - line-height: 1.5em; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -code[class*="language-"].material-theme-dark::-moz-selection, -pre[class*="language-"].material-theme-dark::-moz-selection, -code[class*="language-"].material-theme-dark::-moz-selection, -pre[class*="language-"].material-theme-dark::-moz-selection { - background: #363636; -} - -code[class*="language-"].material-theme-dark::selection, -pre[class*="language-"].material-theme-dark::selection, -code[class*="language-"].material-theme-dark::selection, -pre[class*="language-"].material-theme-dark::selection { - background: #363636; -} - -:not(pre) > code[class*="language-"].material-theme-dark { - white-space: normal; - border-radius: 0.2em; - padding: 0.1em; -} - -pre[class*="language-"].material-theme-dark { - overflow: auto; - position: relative; - margin: 0.5em 0; - padding: 1.25em 1em; -} - -.language-css > code, -.language-sass > code, -.language-scss > code { - color: #fd9170; -} - -[class*="language-"].material-theme-dark .namespace { - opacity: 0.7; -} - -.material-theme-dark .token.atrule { - color: #c792ea; -} - -.material-theme-dark .token.attr-name { - color: #ffcb6b; -} - -.material-theme-dark .token.attr-value { - color: #a5e844; -} - -.material-theme-dark .token.attribute { - color: #a5e844; -} - -.material-theme-dark .token.boolean { - color: #c792ea; -} - -.material-theme-dark .token.builtin { - color: #ffcb6b; -} - -.material-theme-dark .token.cdata { - color: #80cbc4; -} - -.material-theme-dark .token.char { - color: #80cbc4; -} - -.material-theme-dark .token.class { - color: #ffcb6b; -} - -.material-theme-dark .token.class-name { - color: #f2ff00; -} - -.material-theme-dark .token.comment { - color: #616161; -} - -.material-theme-dark .token.constant { - color: #c792ea; -} - -.material-theme-dark .token.deleted { - color: #ff6666; -} - -.material-theme-dark .token.doctype { - color: #616161; -} - -.material-theme-dark .token.entity { - color: #ff6666; -} - -.material-theme-dark .token.function { - color: #c792ea; -} - -.material-theme-dark .token.hexcode { - color: #f2ff00; -} - -.material-theme-dark .token.id { - color: #c792ea; - font-weight: bold; -} - -.material-theme-dark .token.important { - color: #c792ea; - font-weight: bold; -} - -.material-theme-dark .token.inserted { - color: #80cbc4; -} - -.material-theme-dark .token.keyword { - color: #c792ea; -} - -.material-theme-dark .token.number { - color: #fd9170; -} - -.material-theme-dark .token.operator { - color: #89ddff; -} - -.material-theme-dark .token.prolog { - color: #616161; -} - -.material-theme-dark .token.property { - color: #80cbc4; -} - -.material-theme-dark .token.pseudo-class { - color: #a5e844; -} - -.material-theme-dark .token.pseudo-element { - color: #a5e844; -} - -.material-theme-dark .token.punctuation { - color: #89ddff; -} - -.material-theme-dark .token.regex { - color: #f2ff00; -} - -.material-theme-dark .token.selector { - color: #ff6666; -} - -.material-theme-dark .token.string { - color: #a5e844; -} - -.material-theme-dark .token.symbol { - color: #c792ea; -} - -.material-theme-dark .token.tag { - color: #ff6666; -} - -.material-theme-dark .token.unit { - color: #fd9170; -} - -.material-theme-dark .token.url { - color: #ff6666; -} - -.material-theme-dark .token.variable { - color: #ff6666; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-95B9118AFC8631777EEBBD89B2066C3706A6DF3579B14F41AF05564E41CAA09C.css b/fastn-core/tests/22-http-headers/output/code-theme-95B9118AFC8631777EEBBD89B2066C3706A6DF3579B14F41AF05564E41CAA09C.css deleted file mode 100644 index 4aeccfcd65..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-95B9118AFC8631777EEBBD89B2066C3706A6DF3579B14F41AF05564E41CAA09C.css +++ /dev/null @@ -1,172 +0,0 @@ -/* -Name: Duotone Dark -Author: Simurai, adapted from DuoTone themes for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) - -Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-evening-dark.css) -Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) -*/ - -code[class*="language-"].duotone-theme-dark, -pre[class*="language-"].duotone-theme-dark { - font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; - font-size: 14px; - line-height: 1.375; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; - background: #2a2734; - color: #9a86fd; -} - -pre > code[class*="language-"].duotone-theme-dark { - font-size: 1em; -} - -pre[class*="language-"].duotone-theme-dark::-moz-selection, pre[class*="language-"].duotone-theme-dark ::-moz-selection, -code[class*="language-"].duotone-theme-dark::-moz-selection, code[class*="language-"].duotone-theme-dark ::-moz-selection { - text-shadow: none; - background: #6a51e6; -} - -pre[class*="language-"].duotone-theme-dark::selection, pre[class*="language-"].duotone-theme-dark ::selection, -code[class*="language-"].duotone-theme-dark::selection, code[class*="language-"].duotone-theme-dark ::selection { - text-shadow: none; - background: #6a51e6; -} - -/* Code blocks */ -pre[class*="language-"].duotone-theme-dark { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].duotone-theme-dark { - padding: .1em; - border-radius: .3em; -} - -.duotone-theme-dark .token.comment, -.duotone-theme-dark .token.prolog, -.duotone-theme-dark .token.doctype, -.duotone-theme-dark .token.cdata { - color: #6c6783; -} - -.duotone-theme-dark .token.punctuation { - color: #6c6783; -} - -.duotone-theme-dark .token.namespace { - opacity: .7; -} - -.duotone-theme-dark .token.tag, -.duotone-theme-dark .token.operator, -.duotone-theme-dark .token.number { - color: #e09142; -} - -.duotone-theme-dark .token.property, -.duotone-theme-dark .token.function { - color: #9a86fd; -} - -.duotone-theme-dark .token.tag-id, -.duotone-theme-dark .token.selector, -.duotone-theme-dark .token.atrule-id { - color: #eeebff; -} - -code.language-javascript, -.duotone-theme-dark .token.attr-name { - color: #c4b9fe; -} - -code.language-css, -code.language-scss, -.duotone-theme-dark .token.boolean, -.duotone-theme-dark .token.string, -.duotone-theme-dark .token.entity, -.duotone-theme-dark .token.url, -.language-css .duotone-theme-dark .token.string, -.language-scss .duotone-theme-dark .token.string, -.style .duotone-theme-dark .token.string, -.duotone-theme-dark .token.attr-value, -.duotone-theme-dark .token.keyword, -.duotone-theme-dark .token.control, -.duotone-theme-dark .token.directive, -.duotone-theme-dark .token.unit, -.duotone-theme-dark .token.statement, -.duotone-theme-dark .token.regex, -.duotone-theme-dark .token.atrule { - color: #ffcc99; -} - -.duotone-theme-dark .token.placeholder, -.duotone-theme-dark .token.variable { - color: #ffcc99; -} - -.duotone-theme-dark .token.deleted { - text-decoration: line-through; -} - -.duotone-theme-dark .token.inserted { - border-bottom: 1px dotted #eeebff; - text-decoration: none; -} - -.duotone-theme-dark .token.italic { - font-style: italic; -} - -.duotone-theme-dark .token.important, -.duotone-theme-dark .token.bold { - font-weight: bold; -} - -.duotone-theme-dark .token.important { - color: #c4b9fe; -} - -.duotone-theme-dark .token.entity { - cursor: help; -} - -pre > code.highlight { - outline: .4em solid #8a75f5; - outline-offset: .4em; -} - -/* overrides color-values for the Line Numbers plugin - * http://prismjs.com/plugins/line-numbers/ - */ -.line-numbers.line-numbers .line-numbers-rows { - border-right-color: #2c2937; -} - -.line-numbers .line-numbers-rows > span:before { - color: #3c3949; -} - -/* overrides color-values for the Line Highlight plugin -* http://prismjs.com/plugins/line-highlight/ -*/ -.line-highlight.line-highlight { - background: rgba(224, 145, 66, 0.2); - background: -webkit-linear-gradient(left, rgba(224, 145, 66, 0.2) 70%, rgba(224, 145, 66, 0)); - background: linear-gradient(to right, rgba(224, 145, 66, 0.2) 70%, rgba(224, 145, 66, 0)); -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-99CD7B013C96C4632F0AEA39AC265387B814AE85A7D33666A4AE4BEFF59016D0.css b/fastn-core/tests/22-http-headers/output/code-theme-99CD7B013C96C4632F0AEA39AC265387B814AE85A7D33666A4AE4BEFF59016D0.css deleted file mode 100644 index 7044cc5db4..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-99CD7B013C96C4632F0AEA39AC265387B814AE85A7D33666A4AE4BEFF59016D0.css +++ /dev/null @@ -1,318 +0,0 @@ -/** - * Coldark Theme for Prism.js - * Theme variation: Cold - * Tested with HTML, CSS, JS, JSON, PHP, YAML, Bash script - * @author Armand Philippot <contact@armandphilippot.com> - * @homepage https://github.com/ArmandPhilippot/coldark-prism - * @license MIT - * NOTE: This theme is used as light theme - */ -code[class*="language-"].coldark-theme-light, -pre[class*="language-"].coldark-theme-light { - color: #111b27; - background: none; - font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"].coldark-theme-light::-moz-selection, -pre[class*="language-"].coldark-theme-light ::-moz-selection, -code[class*="language-"].coldark-theme-light::-moz-selection, -code[class*="language-"].coldark-theme-light ::-moz-selection { - background: #8da1b9; -} - -pre[class*="language-"].coldark-theme-light::selection, -pre[class*="language-"].coldark-theme-light ::selection, -code[class*="language-"].coldark-theme-light::selection, -code[class*="language-"].coldark-theme-light ::selection { - background: #8da1b9; -} - -/* Code blocks */ -pre[class*="language-"].coldark-theme-light { - padding: 1em; - margin: 0.5em 0; - overflow: auto; -} - -:not(pre) > code[class*="language-"].coldark-theme-light, -pre[class*="language-"].coldark-theme-light { - background: #e3eaf2; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].coldark-theme-light { - padding: 0.1em 0.3em; - border-radius: 0.3em; - white-space: normal; -} - -.coldark-theme-light .token.comment, -.coldark-theme-light .token.prolog, -.coldark-theme-light .token.doctype, -.coldark-theme-light .token.cdata { - color: #3c526d; -} - -.coldark-theme-light .token.punctuation { - color: #111b27; -} - -.coldark-theme-light .token.delimiter.important, -.coldark-theme-light .token.selector .parent, -.coldark-theme-light .token.tag, -.coldark-theme-light .token.tag .coldark-theme-light .token.punctuation { - color: #006d6d; -} - -.coldark-theme-light .token.attr-name, -.coldark-theme-light .token.boolean, -.coldark-theme-light .token.boolean.important, -.coldark-theme-light .token.number, -.coldark-theme-light .token.constant, -.coldark-theme-light .token.selector .coldark-theme-light .token.attribute { - color: #755f00; -} - -.coldark-theme-light .token.class-name, -.coldark-theme-light .token.key, -.coldark-theme-light .token.parameter, -.coldark-theme-light .token.property, -.coldark-theme-light .token.property-access, -.coldark-theme-light .token.variable { - color: #005a8e; -} - -.coldark-theme-light .token.attr-value, -.coldark-theme-light .token.inserted, -.coldark-theme-light .token.color, -.coldark-theme-light .token.selector .coldark-theme-light .token.value, -.coldark-theme-light .token.string, -.coldark-theme-light .token.string .coldark-theme-light .token.url-link { - color: #116b00; -} - -.coldark-theme-light .token.builtin, -.coldark-theme-light .token.keyword-array, -.coldark-theme-light .token.package, -.coldark-theme-light .token.regex { - color: #af00af; -} - -.coldark-theme-light .token.function, -.coldark-theme-light .token.selector .coldark-theme-light .token.class, -.coldark-theme-light .token.selector .coldark-theme-light .token.id { - color: #7c00aa; -} - -.coldark-theme-light .token.atrule .coldark-theme-light .token.rule, -.coldark-theme-light .token.combinator, -.coldark-theme-light .token.keyword, -.coldark-theme-light .token.operator, -.coldark-theme-light .token.pseudo-class, -.coldark-theme-light .token.pseudo-element, -.coldark-theme-light .token.selector, -.coldark-theme-light .token.unit { - color: #a04900; -} - -.coldark-theme-light .token.deleted, -.coldark-theme-light .token.important { - color: #c22f2e; -} - -.coldark-theme-light .token.keyword-this, -.coldark-theme-light .token.this { - color: #005a8e; -} - -.coldark-theme-light .token.important, -.coldark-theme-light .token.keyword-this, -.coldark-theme-light .token.this, -.coldark-theme-light .token.bold { - font-weight: bold; -} - -.coldark-theme-light .token.delimiter.important { - font-weight: inherit; -} - -.coldark-theme-light .token.italic { - font-style: italic; -} - -.coldark-theme-light .token.entity { - cursor: help; -} - -.language-markdown .coldark-theme-light .token.title, -.language-markdown .coldark-theme-light .token.title .coldark-theme-light .token.punctuation { - color: #005a8e; - font-weight: bold; -} - -.language-markdown .coldark-theme-light .token.blockquote.punctuation { - color: #af00af; -} - -.language-markdown .coldark-theme-light .token.code { - color: #006d6d; -} - -.language-markdown .coldark-theme-light .token.hr.punctuation { - color: #005a8e; -} - -.language-markdown .coldark-theme-light .token.url > .coldark-theme-light .token.content { - color: #116b00; -} - -.language-markdown .coldark-theme-light .token.url-link { - color: #755f00; -} - -.language-markdown .coldark-theme-light .token.list.punctuation { - color: #af00af; -} - -.language-markdown .coldark-theme-light .token.table-header { - color: #111b27; -} - -.language-json .coldark-theme-light .token.operator { - color: #111b27; -} - -.language-scss .coldark-theme-light .token.variable { - color: #006d6d; -} - -/* overrides color-values for the Show Invisibles plugin - * https://prismjs.com/plugins/show-invisibles/ - */ -.coldark-theme-light .token.coldark-theme-light .token.tab:not(:empty):before, -.coldark-theme-light .token.coldark-theme-light .token.cr:before, -.coldark-theme-light .token.coldark-theme-light .token.lf:before, -.coldark-theme-light .token.coldark-theme-light .token.space:before { - color: #3c526d; -} - -/* overrides color-values for the Toolbar plugin - * https://prismjs.com/plugins/toolbar/ - */ -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button { - color: #e3eaf2; - background: #005a8e; -} - -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus { - color: #e3eaf2; - background: #005a8eda; - text-decoration: none; -} - -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus { - color: #e3eaf2; - background: #3c526d; -} - -/* overrides color-values for the Line Highlight plugin - * http://prismjs.com/plugins/line-highlight/ - */ -.line-highlight.line-highlight { - background: #8da1b92f; - background: linear-gradient(to right, #8da1b92f 70%, #8da1b925); -} - -.line-highlight.line-highlight:before, -.line-highlight.line-highlight[data-end]:after { - background-color: #3c526d; - color: #e3eaf2; - box-shadow: 0 1px #8da1b9; -} - -pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before { - background-color: #3c526d1f; -} - -/* overrides color-values for the Line Numbers plugin - * http://prismjs.com/plugins/line-numbers/ - */ -.line-numbers.line-numbers .line-numbers-rows { - border-right: 1px solid #8da1b97a; - background: #d0dae77a; -} - -.line-numbers .line-numbers-rows > span:before { - color: #3c526dda; -} - -/* overrides color-values for the Match Braces plugin - * https://prismjs.com/plugins/match-braces/ - */ -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-1, -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-5, -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-9 { - color: #755f00; -} - -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-2, -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-6, -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-10 { - color: #af00af; -} - -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-3, -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-7, -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-11 { - color: #005a8e; -} - -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-4, -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-8, -.rainbow-braces .coldark-theme-light .token.coldark-theme-light .token.punctuation.brace-level-12 { - color: #7c00aa; -} - -/* overrides color-values for the Diff Highlight plugin - * https://prismjs.com/plugins/diff-highlight/ - */ -pre.diff-highlight > code .coldark-theme-light .token.coldark-theme-light .token.deleted:not(.prefix), -pre > code.diff-highlight .coldark-theme-light .token.coldark-theme-light .token.deleted:not(.prefix) { - background-color: #c22f2e1f; -} - -pre.diff-highlight > code .coldark-theme-light .token.coldark-theme-light .token.inserted:not(.prefix), -pre > code.diff-highlight .coldark-theme-light .token.coldark-theme-light .token.inserted:not(.prefix) { - background-color: #116b001f; -} - -/* overrides color-values for the Command Line plugin - * https://prismjs.com/plugins/command-line/ - */ -.command-line .command-line-prompt { - border-right: 1px solid #8da1b97a; -} - -.command-line .command-line-prompt > span:before { - color: #3c526dda; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-9A3284FD117DFF7CFD432FF860A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css b/fastn-core/tests/22-http-headers/output/code-theme-9A3284FD117DFF7CFD432FF860A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css deleted file mode 100644 index fd310e58c0..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-9A3284FD117DFF7CFD432FF860A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css +++ /dev/null @@ -1,317 +0,0 @@ -/** - * Coldark Theme for Prism.js - * Theme variation: Dark - * Tested with HTML, CSS, JS, JSON, PHP, YAML, Bash script - * @author Armand Philippot <contact@armandphilippot.com> - * @homepage https://github.com/ArmandPhilippot/coldark-prism - * @license MIT - */ -code[class*="language-"].coldark-theme-dark, -pre[class*="language-"].coldark-theme-dark { - color: #e3eaf2; - background: none; - font-family: Consolas, Monaco, "Andale Mono", "Ubuntu Mono", monospace; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"].coldark-theme-dark::-moz-selection, -pre[class*="language-"].coldark-theme-dark ::-moz-selection, -code[class*="language-"].coldark-theme-dark::-moz-selection, -code[class*="language-"].coldark-theme-dark ::-moz-selection { - background: #3c526d; -} - -pre[class*="language-"].coldark-theme-dark::selection, -pre[class*="language-"].coldark-theme-dark ::selection, -code[class*="language-"].coldark-theme-dark::selection, -code[class*="language-"].coldark-theme-dark ::selection { - background: #3c526d; -} - -/* Code blocks */ -pre[class*="language-"].coldark-theme-dark { - padding: 1em; - margin: 0.5em 0; - overflow: auto; -} - -:not(pre) > code[class*="language-"].coldark-theme-dark, -pre[class*="language-"].coldark-theme-dark { - background: #111b27; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].coldark-theme-dark { - padding: 0.1em 0.3em; - border-radius: 0.3em; - white-space: normal; -} - -.coldark-theme-dark .token.comment, -.coldark-theme-dark .token.prolog, -.coldark-theme-dark .token.doctype, -.coldark-theme-dark .token.cdata { - color: #8da1b9; -} - -.coldark-theme-dark .token.punctuation { - color: #e3eaf2; -} - -.coldark-theme-dark .token.delimiter.important, -.coldark-theme-dark .token.selector .parent, -.coldark-theme-dark .token.tag, -.coldark-theme-dark .token.tag .coldark-theme-dark .token.punctuation { - color: #66cccc; -} - -.coldark-theme-dark .token.attr-name, -.coldark-theme-dark .token.boolean, -.coldark-theme-dark .token.boolean.important, -.coldark-theme-dark .token.number, -.coldark-theme-dark .token.constant, -.coldark-theme-dark .token.selector .coldark-theme-dark .token.attribute { - color: #e6d37a; -} - -.coldark-theme-dark .token.class-name, -.coldark-theme-dark .token.key, -.coldark-theme-dark .token.parameter, -.coldark-theme-dark .token.property, -.coldark-theme-dark .token.property-access, -.coldark-theme-dark .token.variable { - color: #6cb8e6; -} - -.coldark-theme-dark .token.attr-value, -.coldark-theme-dark .token.inserted, -.coldark-theme-dark .token.color, -.coldark-theme-dark .token.selector .coldark-theme-dark .token.value, -.coldark-theme-dark .token.string, -.coldark-theme-dark .token.string .coldark-theme-dark .token.url-link { - color: #91d076; -} - -.coldark-theme-dark .token.builtin, -.coldark-theme-dark .token.keyword-array, -.coldark-theme-dark .token.package, -.coldark-theme-dark .token.regex { - color: #f4adf4; -} - -.coldark-theme-dark .token.function, -.coldark-theme-dark .token.selector .coldark-theme-dark .token.class, -.coldark-theme-dark .token.selector .coldark-theme-dark .token.id { - color: #c699e3; -} - -.coldark-theme-dark .token.atrule .coldark-theme-dark .token.rule, -.coldark-theme-dark .token.combinator, -.coldark-theme-dark .token.keyword, -.coldark-theme-dark .token.operator, -.coldark-theme-dark .token.pseudo-class, -.coldark-theme-dark .token.pseudo-element, -.coldark-theme-dark .token.selector, -.coldark-theme-dark .token.unit { - color: #e9ae7e; -} - -.coldark-theme-dark .token.deleted, -.coldark-theme-dark .token.important { - color: #cd6660; -} - -.coldark-theme-dark .token.keyword-this, -.coldark-theme-dark .token.this { - color: #6cb8e6; -} - -.coldark-theme-dark .token.important, -.coldark-theme-dark .token.keyword-this, -.coldark-theme-dark .token.this, -.coldark-theme-dark .token.bold { - font-weight: bold; -} - -.coldark-theme-dark .token.delimiter.important { - font-weight: inherit; -} - -.coldark-theme-dark .token.italic { - font-style: italic; -} - -.coldark-theme-dark .token.entity { - cursor: help; -} - -.language-markdown .coldark-theme-dark .token.title, -.language-markdown .coldark-theme-dark .token.title .coldark-theme-dark .token.punctuation { - color: #6cb8e6; - font-weight: bold; -} - -.language-markdown .coldark-theme-dark .token.blockquote.punctuation { - color: #f4adf4; -} - -.language-markdown .coldark-theme-dark .token.code { - color: #66cccc; -} - -.language-markdown .coldark-theme-dark .token.hr.punctuation { - color: #6cb8e6; -} - -.language-markdown .coldark-theme-dark .token.url .coldark-theme-dark .token.content { - color: #91d076; -} - -.language-markdown .coldark-theme-dark .token.url-link { - color: #e6d37a; -} - -.language-markdown .coldark-theme-dark .token.list.punctuation { - color: #f4adf4; -} - -.language-markdown .coldark-theme-dark .token.table-header { - color: #e3eaf2; -} - -.language-json .coldark-theme-dark .token.operator { - color: #e3eaf2; -} - -.language-scss .coldark-theme-dark .token.variable { - color: #66cccc; -} - -/* overrides color-values for the Show Invisibles plugin - * https://prismjs.com/plugins/show-invisibles/ - */ -.coldark-theme-dark .token.coldark-theme-dark .token.tab:not(:empty):before, -.coldark-theme-dark .token.coldark-theme-dark .token.cr:before, -.coldark-theme-dark .token.coldark-theme-dark .token.lf:before, -.coldark-theme-dark .token.coldark-theme-dark .token.space:before { - color: #8da1b9; -} - -/* overrides color-values for the Toolbar plugin - * https://prismjs.com/plugins/toolbar/ - */ -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button { - color: #111b27; - background: #6cb8e6; -} - -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus { - color: #111b27; - background: #6cb8e6da; - text-decoration: none; -} - -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus { - color: #111b27; - background: #8da1b9; -} - -/* overrides color-values for the Line Highlight plugin - * http://prismjs.com/plugins/line-highlight/ - */ -.line-highlight.line-highlight { - background: #3c526d5f; - background: linear-gradient(to right, #3c526d5f 70%, #3c526d55); -} - -.line-highlight.line-highlight:before, -.line-highlight.line-highlight[data-end]:after { - background-color: #8da1b9; - color: #111b27; - box-shadow: 0 1px #3c526d; -} - -pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before { - background-color: #8da1b918; -} - -/* overrides color-values for the Line Numbers plugin - * http://prismjs.com/plugins/line-numbers/ - */ -.line-numbers.line-numbers .line-numbers-rows { - border-right: 1px solid #0b121b; - background: #0b121b7a; -} - -.line-numbers .line-numbers-rows > span:before { - color: #8da1b9da; -} - -/* overrides color-values for the Match Braces plugin - * https://prismjs.com/plugins/match-braces/ - */ -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-1, -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-5, -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-9 { - color: #e6d37a; -} - -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-2, -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-6, -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-10 { - color: #f4adf4; -} - -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-3, -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-7, -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-11 { - color: #6cb8e6; -} - -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-4, -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-8, -.rainbow-braces .coldark-theme-dark .token.coldark-theme-dark .token.punctuation.brace-level-12 { - color: #c699e3; -} - -/* overrides color-values for the Diff Highlight plugin - * https://prismjs.com/plugins/diff-highlight/ - */ -pre.diff-highlight > code .coldark-theme-dark .token.coldark-theme-dark .token.deleted:not(.prefix), -pre > code.diff-highlight .coldark-theme-dark .token.coldark-theme-dark .token.deleted:not(.prefix) { - background-color: #cd66601f; -} - -pre.diff-highlight > code .coldark-theme-dark .token.coldark-theme-dark .token.inserted:not(.prefix), -pre > code.diff-highlight .coldark-theme-dark .token.coldark-theme-dark .token.inserted:not(.prefix) { - background-color: #91d0761f; -} - -/* overrides color-values for the Command Line plugin - * https://prismjs.com/plugins/command-line/ - */ -.command-line .command-line-prompt { - border-right: 1px solid #0b121b; -} - -.command-line .command-line-prompt > span:before { - color: #8da1b9da; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-9A45313F167DBD90654BFD5BB3BC0BDF6AE447485C30B0389ADA7B49C069E46A.css b/fastn-core/tests/22-http-headers/output/code-theme-9A45313F167DBD90654BFD5BB3BC0BDF6AE447485C30B0389ADA7B49C069E46A.css deleted file mode 100644 index 5448cf3a91..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-9A45313F167DBD90654BFD5BB3BC0BDF6AE447485C30B0389ADA7B49C069E46A.css +++ /dev/null @@ -1,172 +0,0 @@ -/* -Name: Duotone Sea -Author: by Simurai, adapted from DuoTone themes by Simurai for Atom (http://simurai.com/projects/2016/01/01/duotone-themes) - -Conversion: Bram de Haan (http://atelierbram.github.io/Base2Tone-prism/output/prism/prism-base2tone-sea-dark.css) -Generated with Base16 Builder (https://github.com/base16-builder/base16-builder) -*/ - -code[class*="language-"].duotone-theme-sea, -pre[class*="language-"].duotone-theme-sea { - font-family: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace; - font-size: 14px; - line-height: 1.375; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; - background: #1d262f; - color: #57718e; -} - -pre > code[class*="language-"].duotone-theme-sea { - font-size: 1em; -} - -pre[class*="language-"].duotone-theme-sea::-moz-selection, pre[class*="language-"].duotone-theme-sea ::-moz-selection, -code[class*="language-"].duotone-theme-sea::-moz-selection, code[class*="language-"].duotone-theme-sea ::-moz-selection { - text-shadow: none; - background: #004a9e; -} - -pre[class*="language-"].duotone-theme-sea::selection, pre[class*="language-"].duotone-theme-sea ::selection, -code[class*="language-"].duotone-theme-sea::selection, code[class*="language-"].duotone-theme-sea ::selection { - text-shadow: none; - background: #004a9e; -} - -/* Code blocks */ -pre[class*="language-"].duotone-theme-sea { - padding: 1em; - margin: .5em 0; - overflow: auto; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].duotone-theme-sea { - padding: .1em; - border-radius: .3em; -} - -.duotone-theme-sea .token.comment, -.duotone-theme-sea .token.prolog, -.duotone-theme-sea .token.doctype, -.duotone-theme-sea .token.cdata { - color: #4a5f78; -} - -.duotone-theme-sea .token.punctuation { - color: #4a5f78; -} - -.duotone-theme-sea .token.namespace { - opacity: .7; -} - -.duotone-theme-sea .token.tag, -.duotone-theme-sea .token.operator, -.duotone-theme-sea .token.number { - color: #0aa370; -} - -.duotone-theme-sea .token.property, -.duotone-theme-sea .token.function { - color: #57718e; -} - -.duotone-theme-sea .token.tag-id, -.duotone-theme-sea .token.selector, -.duotone-theme-sea .token.atrule-id { - color: #ebf4ff; -} - -code.language-javascript, -.duotone-theme-sea .token.attr-name { - color: #7eb6f6; -} - -code.language-css, -code.language-scss, -.duotone-theme-sea .token.boolean, -.duotone-theme-sea .token.string, -.duotone-theme-sea .token.entity, -.duotone-theme-sea .token.url, -.language-css .duotone-theme-sea .token.string, -.language-scss .duotone-theme-sea .token.string, -.style .duotone-theme-sea .token.string, -.duotone-theme-sea .token.attr-value, -.duotone-theme-sea .token.keyword, -.duotone-theme-sea .token.control, -.duotone-theme-sea .token.directive, -.duotone-theme-sea .token.unit, -.duotone-theme-sea .token.statement, -.duotone-theme-sea .token.regex, -.duotone-theme-sea .token.atrule { - color: #47ebb4; -} - -.duotone-theme-sea .token.placeholder, -.duotone-theme-sea .token.variable { - color: #47ebb4; -} - -.duotone-theme-sea .token.deleted { - text-decoration: line-through; -} - -.duotone-theme-sea .token.inserted { - border-bottom: 1px dotted #ebf4ff; - text-decoration: none; -} - -.duotone-theme-sea .token.italic { - font-style: italic; -} - -.duotone-theme-sea .token.important, -.duotone-theme-sea .token.bold { - font-weight: bold; -} - -.duotone-theme-sea .token.important { - color: #7eb6f6; -} - -.duotone-theme-sea .token.entity { - cursor: help; -} - -pre > code.highlight { - outline: .4em solid #34659d; - outline-offset: .4em; -} - -/* overrides color-values for the Line Numbers plugin - * http://prismjs.com/plugins/line-numbers/ - */ -.line-numbers.line-numbers .line-numbers-rows { - border-right-color: #1f2932; -} - -.line-numbers .line-numbers-rows > span:before { - color: #2c3847; -} - -/* overrides color-values for the Line Highlight plugin -* http://prismjs.com/plugins/line-highlight/ -*/ -.line-highlight.line-highlight { - background: rgba(10, 163, 112, 0.2); - background: -webkit-linear-gradient(left, rgba(10, 163, 112, 0.2) 70%, rgba(10, 163, 112, 0)); - background: linear-gradient(to right, rgba(10, 163, 112, 0.2) 70%, rgba(10, 163, 112, 0)); -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-A24DC8F09D03756A62923E8A883CAE3B938D54E2813F0855312D2554DBE97BAD.css b/fastn-core/tests/22-http-headers/output/code-theme-A24DC8F09D03756A62923E8A883CAE3B938D54E2813F0855312D2554DBE97BAD.css deleted file mode 100644 index db09be499c..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-A24DC8F09D03756A62923E8A883CAE3B938D54E2813F0855312D2554DBE97BAD.css +++ /dev/null @@ -1,440 +0,0 @@ -/** - * One Dark theme for prism.js - * Based on Atom's One Dark theme: https://github.com/atom/atom/tree/master/packages/one-dark-syntax - */ - -/** - * One Dark colours (accurate as of commit 8ae45ca on 6 Sep 2018) - * From colors.less - * --mono-1: hsl(220, 14%, 71%); - * --mono-2: hsl(220, 9%, 55%); - * --mono-3: hsl(220, 10%, 40%); - * --hue-1: hsl(187, 47%, 55%); - * --hue-2: hsl(207, 82%, 66%); - * --hue-3: hsl(286, 60%, 67%); - * --hue-4: hsl(95, 38%, 62%); - * --hue-5: hsl(355, 65%, 65%); - * --hue-5-2: hsl(5, 48%, 51%); - * --hue-6: hsl(29, 54%, 61%); - * --hue-6-2: hsl(39, 67%, 69%); - * --syntax-fg: hsl(220, 14%, 71%); - * --syntax-bg: hsl(220, 13%, 18%); - * --syntax-gutter: hsl(220, 14%, 45%); - * --syntax-guide: hsla(220, 14%, 71%, 0.15); - * --syntax-accent: hsl(220, 100%, 66%); - * From syntax-variables.less - * --syntax-selection-color: hsl(220, 13%, 28%); - * --syntax-gutter-background-color-selected: hsl(220, 13%, 26%); - * --syntax-cursor-line: hsla(220, 100%, 80%, 0.04); - */ - -code[class*="language-"].one-theme-dark, -pre[class*="language-"].one-theme-dark { - background: hsl(220, 13%, 18%); - color: hsl(220, 14%, 71%); - text-shadow: 0 1px rgba(0, 0, 0, 0.3); - font-family: "Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - line-height: 1.5; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -/* Selection */ -code[class*="language-"].one-theme-dark::-moz-selection, -code[class*="language-"].one-theme-dark *::-moz-selection, -pre[class*="language-"].one-theme-dark *::-moz-selection { - background: hsl(220, 13%, 28%); - color: inherit; - text-shadow: none; -} - -code[class*="language-"].one-theme-dark::selection, -code[class*="language-"].one-theme-dark *::selection, -pre[class*="language-"].one-theme-dark *::selection { - background: hsl(220, 13%, 28%); - color: inherit; - text-shadow: none; -} - -/* Code blocks */ -pre[class*="language-"].one-theme-dark { - padding: 1em; - margin: 0.5em 0; - overflow: auto; - border-radius: 0.3em; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].one-theme-dark { - padding: 0.2em 0.3em; - border-radius: 0.3em; - white-space: normal; -} - -/* Print */ -@media print { - code[class*="language-"].one-theme-dark, - pre[class*="language-"].one-theme-dark { - text-shadow: none; - } -} - -.one-theme-dark .token.comment, -.one-theme-dark .token.prolog, -.one-theme-dark .token.cdata { - color: hsl(220, 10%, 40%); -} - -.one-theme-dark .token.doctype, -.one-theme-dark .token.punctuation, -.one-theme-dark .token.entity { - color: hsl(220, 14%, 71%); -} - -.one-theme-dark .token.attr-name, -.one-theme-dark .token.class-name, -.one-theme-dark .token.boolean, -.one-theme-dark .token.constant, -.one-theme-dark .token.number, -.one-theme-dark .token.atrule { - color: hsl(29, 54%, 61%); -} - -.one-theme-dark .token.keyword { - color: hsl(286, 60%, 67%); -} - -.one-theme-dark .token.property, -.one-theme-dark .token.tag, -.one-theme-dark .token.symbol, -.one-theme-dark .token.deleted, -.one-theme-dark .token.important { - color: hsl(355, 65%, 65%); -} - -.one-theme-dark .token.selector, -.one-theme-dark .token.string, -.one-theme-dark .token.char, -.one-theme-dark .token.builtin, -.one-theme-dark .token.inserted, -.one-theme-dark .token.regex, -.one-theme-dark .token.attr-value, -.one-theme-dark .token.attr-value > .one-theme-dark .token.punctuation { - color: hsl(95, 38%, 62%); -} - -.one-theme-dark .token.variable, -.one-theme-dark .token.operator, -.one-theme-dark .token.function { - color: hsl(207, 82%, 66%); -} - -.one-theme-dark .token.url { - color: hsl(187, 47%, 55%); -} - -/* HTML overrides */ -.one-theme-dark .token.attr-value > .one-theme-dark .token.punctuation.attr-equals, -.one-theme-dark .token.special-attr > .one-theme-dark .token.attr-value > .one-theme-dark .token.value.css { - color: hsl(220, 14%, 71%); -} - -/* CSS overrides */ -.language-css .one-theme-dark .token.selector { - color: hsl(355, 65%, 65%); -} - -.language-css .one-theme-dark .token.property { - color: hsl(220, 14%, 71%); -} - -.language-css .one-theme-dark .token.function, -.language-css .one-theme-dark .token.url > .one-theme-dark .token.function { - color: hsl(187, 47%, 55%); -} - -.language-css .one-theme-dark .token.url > .one-theme-dark .token.string.url { - color: hsl(95, 38%, 62%); -} - -.language-css .one-theme-dark .token.important, -.language-css .one-theme-dark .token.atrule .one-theme-dark .token.rule { - color: hsl(286, 60%, 67%); -} - -/* JS overrides */ -.language-javascript .one-theme-dark .token.operator { - color: hsl(286, 60%, 67%); -} - -.language-javascript .one-theme-dark .token.template-string > .one-theme-dark .token.interpolation > .one-theme-dark .token.interpolation-punctuation.punctuation { - color: hsl(5, 48%, 51%); -} - -/* JSON overrides */ -.language-json .one-theme-dark .token.operator { - color: hsl(220, 14%, 71%); -} - -.language-json .one-theme-dark .token.null.keyword { - color: hsl(29, 54%, 61%); -} - -/* MD overrides */ -.language-markdown .one-theme-dark .token.url, -.language-markdown .one-theme-dark .token.url > .one-theme-dark .token.operator, -.language-markdown .one-theme-dark .token.url-reference.url > .one-theme-dark .token.string { - color: hsl(220, 14%, 71%); -} - -.language-markdown .one-theme-dark .token.url > .one-theme-dark .token.content { - color: hsl(207, 82%, 66%); -} - -.language-markdown .one-theme-dark .token.url > .one-theme-dark .token.url, -.language-markdown .one-theme-dark .token.url-reference.url { - color: hsl(187, 47%, 55%); -} - -.language-markdown .one-theme-dark .token.blockquote.punctuation, -.language-markdown .one-theme-dark .token.hr.punctuation { - color: hsl(220, 10%, 40%); - font-style: italic; -} - -.language-markdown .one-theme-dark .token.code-snippet { - color: hsl(95, 38%, 62%); -} - -.language-markdown .one-theme-dark .token.bold .one-theme-dark .token.content { - color: hsl(29, 54%, 61%); -} - -.language-markdown .one-theme-dark .token.italic .one-theme-dark .token.content { - color: hsl(286, 60%, 67%); -} - -.language-markdown .one-theme-dark .token.strike .one-theme-dark .token.content, -.language-markdown .one-theme-dark .token.strike .one-theme-dark .token.punctuation, -.language-markdown .one-theme-dark .token.list.punctuation, -.language-markdown .one-theme-dark .token.title.important > .one-theme-dark .token.punctuation { - color: hsl(355, 65%, 65%); -} - -/* General */ -.one-theme-dark .token.bold { - font-weight: bold; -} - -.one-theme-dark .token.comment, -.one-theme-dark .token.italic { - font-style: italic; -} - -.one-theme-dark .token.entity { - cursor: help; -} - -.one-theme-dark .token.namespace { - opacity: 0.8; -} - -/* Plugin overrides */ -/* Selectors should have higher specificity than those in the plugins' default stylesheets */ - -/* Show Invisibles plugin overrides */ -.one-theme-dark .token.one-theme-dark .token.tab:not(:empty):before, -.one-theme-dark .token.one-theme-dark .token.cr:before, -.one-theme-dark .token.one-theme-dark .token.lf:before, -.one-theme-dark .token.one-theme-dark .token.space:before { - color: hsla(220, 14%, 71%, 0.15); - text-shadow: none; -} - -/* Toolbar plugin overrides */ -/* Space out all buttons and move them away from the right edge of the code block */ -div.code-toolbar > .toolbar.toolbar > .toolbar-item { - margin-right: 0.4em; -} - -/* Styling the buttons */ -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span { - background: hsl(220, 13%, 26%); - color: hsl(220, 9%, 55%); - padding: 0.1em 0.4em; - border-radius: 0.3em; -} - -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover, -div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus { - background: hsl(220, 13%, 28%); - color: hsl(220, 14%, 71%); -} - -/* Line Highlight plugin overrides */ -/* The highlighted line itself */ -.line-highlight.line-highlight { - background: hsla(220, 100%, 80%, 0.04); -} - -/* Default line numbers in Line Highlight plugin */ -.line-highlight.line-highlight:before, -.line-highlight.line-highlight[data-end]:after { - background: hsl(220, 13%, 26%); - color: hsl(220, 14%, 71%); - padding: 0.1em 0.6em; - border-radius: 0.3em; - box-shadow: 0 2px 0 0 rgba(0, 0, 0, 0.2); /* same as Toolbar plugin default */ -} - -/* Hovering over a linkable line number (in the gutter area) */ -/* Requires Line Numbers plugin as well */ -pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before { - background-color: hsla(220, 100%, 80%, 0.04); -} - -/* Line Numbers and Command Line plugins overrides */ -/* Line separating gutter from coding area */ -.line-numbers.line-numbers .line-numbers-rows, -.command-line .command-line-prompt { - border-right-color: hsla(220, 14%, 71%, 0.15); -} - -/* Stuff in the gutter */ -.line-numbers .line-numbers-rows > span:before, -.command-line .command-line-prompt > span:before { - color: hsl(220, 14%, 45%); -} - -/* Match Braces plugin overrides */ -/* Note: Outline colour is inherited from the braces */ -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-1, -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-5, -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-9 { - color: hsl(355, 65%, 65%); -} - -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-2, -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-6, -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-10 { - color: hsl(95, 38%, 62%); -} - -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-3, -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-7, -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-11 { - color: hsl(207, 82%, 66%); -} - -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-4, -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-8, -.rainbow-braces .one-theme-dark .token.one-theme-dark .token.punctuation.brace-level-12 { - color: hsl(286, 60%, 67%); -} - -/* Diff Highlight plugin overrides */ -/* Taken from https://github.com/atom/github/blob/master/styles/variables.less */ -pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix), -pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix) { - background-color: hsla(353, 100%, 66%, 0.15); -} - -pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix)::-moz-selection, -pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix) *::-moz-selection, -pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix)::-moz-selection, -pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix) *::-moz-selection { - background-color: hsla(353, 95%, 66%, 0.25); -} - -pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix)::selection, -pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix) *::selection, -pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix)::selection, -pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.deleted:not(.prefix) *::selection { - background-color: hsla(353, 95%, 66%, 0.25); -} - -pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix), -pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix) { - background-color: hsla(137, 100%, 55%, 0.15); -} - -pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix)::-moz-selection, -pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix) *::-moz-selection, -pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix)::-moz-selection, -pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix) *::-moz-selection { - background-color: hsla(135, 73%, 55%, 0.25); -} - -pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix)::selection, -pre.diff-highlight > code .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix) *::selection, -pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix)::selection, -pre > code.diff-highlight .one-theme-dark .token.one-theme-dark .token.inserted:not(.prefix) *::selection { - background-color: hsla(135, 73%, 55%, 0.25); -} - -/* Previewers plugin overrides */ -/* Based on https://github.com/atom-community/atom-ide-datatip/blob/master/styles/atom-ide-datatips.less and https://github.com/atom/atom/blob/master/packages/one-dark-ui */ -/* Border around popup */ -.prism-previewer.prism-previewer:before, -.prism-previewer-gradient.prism-previewer-gradient div { - border-color: hsl(224, 13%, 17%); -} - -/* Angle and time should remain as circles and are hence not included */ -.prism-previewer-color.prism-previewer-color:before, -.prism-previewer-gradient.prism-previewer-gradient div, -.prism-previewer-easing.prism-previewer-easing:before { - border-radius: 0.3em; -} - -/* Triangles pointing to the code */ -.prism-previewer.prism-previewer:after { - border-top-color: hsl(224, 13%, 17%); -} - -.prism-previewer-flipped.prism-previewer-flipped.after { - border-bottom-color: hsl(224, 13%, 17%); -} - -/* Background colour within the popup */ -.prism-previewer-angle.prism-previewer-angle:before, -.prism-previewer-time.prism-previewer-time:before, -.prism-previewer-easing.prism-previewer-easing { - background: hsl(219, 13%, 22%); -} - -/* For angle, this is the positive area (eg. 90deg will display one quadrant in this colour) */ -/* For time, this is the alternate colour */ -.prism-previewer-angle.prism-previewer-angle circle, -.prism-previewer-time.prism-previewer-time circle { - stroke: hsl(220, 14%, 71%); - stroke-opacity: 1; -} - -/* Stroke colours of the handle, direction point, and vector itself */ -.prism-previewer-easing.prism-previewer-easing circle, -.prism-previewer-easing.prism-previewer-easing path, -.prism-previewer-easing.prism-previewer-easing line { - stroke: hsl(220, 14%, 71%); -} - -/* Fill colour of the handle */ -.prism-previewer-easing.prism-previewer-easing circle { - fill: transparent; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-A352AF572179AB980583D41BC41ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css b/fastn-core/tests/22-http-headers/output/code-theme-A352AF572179AB980583D41BC41ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css deleted file mode 100644 index 5fc5648fb7..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-A352AF572179AB980583D41BC41ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css +++ /dev/null @@ -1,134 +0,0 @@ -code[class*=language-].fire-light, -pre[class*=language-].fire-light { - color: #000; - background: 0 0; - text-shadow: 0 1px #fff; - /*font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;*/ - /*font-size: 1em;*/ - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - /*line-height: 1.5;*/ - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none -} - -code[class*=language-].fire-light ::-moz-selection, -code[class*=language-].fire-light::-moz-selection, -pre[class*=language-].fire-light ::-moz-selection, -pre[class*=language-].fire-light::-moz-selection { - text-shadow: none; - background: #b3d4fc -} - -code[class*=language-].fire-light ::selection, -code[class*=language-].fire-light::selection, -pre[class*=language-].fire-light ::selection, -pre[class*=language-].fire-light::selection { - text-shadow: none; - background: #b3d4fc -} - -@media print { - - code[class*=language-].fire-light, - pre[class*=language-].fire-light { - text-shadow: none - } -} - -pre[class*=language-].fire-light { - padding: 1em; - overflow: auto -} - -:not(pre)>code[class*=language-].fire-light, -pre[class*=language-].fire-light { - background: #f5f2f0 -} - -:not(pre)>code[class*=language-].fire-light { - padding: .1em; - border-radius: .3em; - white-space: normal -} - -.fire-light .token.cdata, -.fire-light .token.comment, -.fire-light .token.doctype, -.fire-light .token.prolog { - color: #708090 -} - -.fire-light .token.punctuation { - color: #999 -} - -.fire-light .token.namespace { - opacity: .7 -} - -.fire-light .token.boolean, -.fire-light .token.constant, -.fire-light .token.deleted, -.fire-light .token.number, -.fire-light .token.property, -.fire-light .token.symbol, -.fire-light .token.tag { - color: #905 -} - -.fire-light .token.attr-name, -.fire-light .token.builtin, -.fire-light .token.char, -.fire-light .token.inserted, -.fire-light .token.selector, -.fire-light .token.string { - color: #690 -} - -.language-css .fire-light .token.string, -.style .fire-light .token.string, -.fire-light .token.entity, -.fire-light .token.operator, -.fire-light .token.url { - color: #9a6e3a; - background: hsla(0, 0%, 100%, .5) -} - -.fire-light .token.atrule, -.fire-light .token.attr-value, -.fire-light .token.keyword { - color: #07a -} - -.fire-light .token.class-name, -.fire-light .token.function { - color: #dd4a68 -} - -.fire-light .token.important, -.fire-light .token.regex, -.fire-light .token.variable { - color: #e90 -} - -.fire-light .token.bold, -.fire-light .token.important { - font-weight: 700 -} - -.fire-light .token.italic { - font-style: italic -} - -.fire-light .token.entity { - cursor: help -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-B3AEA322EADEDA61F0E219845A0E9C8E73F6345E49362B46E6F52CEE40471248.css b/fastn-core/tests/22-http-headers/output/code-theme-B3AEA322EADEDA61F0E219845A0E9C8E73F6345E49362B46E6F52CEE40471248.css deleted file mode 100644 index 7e3f7c4c3d..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-B3AEA322EADEDA61F0E219845A0E9C8E73F6345E49362B46E6F52CEE40471248.css +++ /dev/null @@ -1,140 +0,0 @@ -/** - * Coy without shadows - * Based on Tim Shedor's Coy theme for prism.js - * Author: RunDevelopment - */ - -code[class*="language-"].coy-theme, -pre[class*="language-"].coy-theme { - color: black; - background: none; - font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; - font-size: 1em; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - line-height: 1.5; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -/* Code blocks */ -pre[class*="language-"].coy-theme { - position: relative; - border-left: 10px solid #358ccb; - box-shadow: -1px 0 0 0 #358ccb, 0 0 0 1px #dfdfdf; - background-color: #fdfdfd; - background-image: linear-gradient(transparent 50%, rgba(69, 142, 209, 0.04) 50%); - background-size: 3em 3em; - background-origin: content-box; - background-attachment: local; - margin: .5em 0; - padding: 0 1em; -} - -pre[class*="language-"].coy-theme > code { - display: block; -} - -/* Inline code */ -:not(pre) > code[class*="language-"].coy-theme { - position: relative; - padding: .2em; - border-radius: 0.3em; - color: #c92c2c; - border: 1px solid rgba(0, 0, 0, 0.1); - display: inline; - white-space: normal; - background-color: #fdfdfd; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} - -.coy-theme .token.comment, -.coy-theme .token.block-comment, -.coy-theme .token.prolog, -.coy-theme .token.doctype, -.coy-theme .token.cdata { - color: #7D8B99; -} - -.coy-theme .token.punctuation { - color: #5F6364; -} - -.coy-theme .token.property, -.coy-theme .token.tag, -.coy-theme .token.boolean, -.coy-theme .token.number, -.coy-theme .token.function-name, -.coy-theme .token.constant, -.coy-theme .token.symbol, -.coy-theme .token.deleted { - color: #c92c2c; -} - -.coy-theme .token.selector, -.coy-theme .token.attr-name, -.coy-theme .token.string, -.coy-theme .token.char, -.coy-theme .token.function, -.coy-theme .token.builtin, -.coy-theme .token.inserted { - color: #2f9c0a; -} - -.coy-theme .token.operator, -.coy-theme .token.entity, -.coy-theme .token.url, -.coy-theme .token.variable { - color: #a67f59; - background: rgba(255, 255, 255, 0.5); -} - -.coy-theme .token.atrule, -.coy-theme .token.attr-value, -.coy-theme .token.keyword, -.coy-theme .token.class-name { - color: #1990b8; -} - -.coy-theme .token.regex, -.coy-theme .token.important { - color: #e90; -} - -.language-css .coy-theme .token.string, -.style .coy-theme .token.string { - color: #a67f59; - background: rgba(255, 255, 255, 0.5); -} - -.coy-theme .token.important { - font-weight: normal; -} - -.coy-theme .token.bold { - font-weight: bold; -} - -.coy-theme .token.italic { - font-style: italic; -} - -.coy-theme .token.entity { - cursor: help; -} - -.coy-theme .token.namespace { - opacity: .7; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-B68AA27E05B319F04A9CD747AADBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css b/fastn-core/tests/22-http-headers/output/code-theme-B68AA27E05B319F04A9CD747AADBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css deleted file mode 100644 index 834c3b19f6..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-B68AA27E05B319F04A9CD747AADBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css +++ /dev/null @@ -1,139 +0,0 @@ -/** - * Gruvbox dark theme - * - * Adapted from a theme based on: - * Vim Gruvbox dark Theme (https://github.com/morhetz/gruvbox) - * - * @author Azat S. <to@azat.io> - * @version 1.0 - */ - -code[class*="language-"].gruvbox-theme-dark, -pre[class*="language-"].gruvbox-theme-dark { - color: #ebdbb2; /* fg1 / fg */ - font-family: Consolas, Monaco, "Andale Mono", monospace; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - line-height: 1.5; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"].gruvbox-theme-dark::-moz-selection, -pre[class*="language-"].gruvbox-theme-dark ::-moz-selection, -code[class*="language-"].gruvbox-theme-dark::-moz-selection, -code[class*="language-"].gruvbox-theme-dark ::-moz-selection { - color: #fbf1c7; /* fg0 */ - background: #7c6f64; /* bg4 */ -} - -pre[class*="language-"].gruvbox-theme-dark::selection, -pre[class*="language-"].gruvbox-theme-dark ::selection, -code[class*="language-"].gruvbox-theme-dark::selection, -code[class*="language-"].gruvbox-theme-dark ::selection { - color: #fbf1c7; /* fg0 */ - background: #7c6f64; /* bg4 */ -} - -/* Code blocks */ -pre[class*="language-"].gruvbox-theme-dark { - padding: 1em; - margin: 0.5em 0; - overflow: auto; -} - -:not(pre) > code[class*="language-"].gruvbox-theme-dark, -pre[class*="language-"].gruvbox-theme-dark { - background: #1d2021; /* bg0_h */ -} - -/* Inline code */ -:not(pre) > code[class*="language-"].gruvbox-theme-dark { - padding: 0.1em; - border-radius: 0.3em; -} - -.gruvbox-theme-dark .token.comment, -.gruvbox-theme-dark .token.prolog, -.gruvbox-theme-dark .token.cdata { - color: #a89984; /* fg4 / gray1 */ -} - -.gruvbox-theme-dark .token.delimiter, -.gruvbox-theme-dark .token.boolean, -.gruvbox-theme-dark .token.keyword, -.gruvbox-theme-dark .token.selector, -.gruvbox-theme-dark .token.important, -.gruvbox-theme-dark .token.atrule { - color: #fb4934; /* red2 */ -} - -.gruvbox-theme-dark .token.operator, -.gruvbox-theme-dark .token.punctuation, -.gruvbox-theme-dark .token.attr-name { - color: #a89984; /* fg4 / gray1 */ -} - -.gruvbox-theme-dark .token.tag, -.gruvbox-theme-dark .token.tag .punctuation, -.gruvbox-theme-dark .token.doctype, -.gruvbox-theme-dark .token.builtin { - color: #fabd2f; /* yellow2 */ -} - -.gruvbox-theme-dark .token.entity, -.gruvbox-theme-dark .token.number, -.gruvbox-theme-dark .token.symbol { - color: #d3869b; /* purple2 */ -} - -.gruvbox-theme-dark .token.property, -.gruvbox-theme-dark .token.constant, -.gruvbox-theme-dark .token.variable { - color: #fb4934; /* red2 */ -} - -.gruvbox-theme-dark .token.string, -.gruvbox-theme-dark .token.char { - color: #b8bb26; /* green2 */ -} - -.gruvbox-theme-dark .token.attr-value, -.gruvbox-theme-dark .token.attr-value .punctuation { - color: #a89984; /* fg4 / gray1 */ -} - -.gruvbox-theme-dark .token.url { - color: #b8bb26; /* green2 */ - text-decoration: underline; -} - -.gruvbox-theme-dark .token.function { - color: #fabd2f; /* yellow2 */ -} - -.gruvbox-theme-dark .token.bold { - font-weight: bold; -} - -.gruvbox-theme-dark .token.italic { - font-style: italic; -} - -.gruvbox-theme-dark .token.inserted { - background: #a89984; /* fg4 / gray1 */ -} - -.gruvbox-theme-dark .token.deleted { - background: #fb4934; /* red2 */ -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-B8645DE281A38A3068C56919DE1BB0511696A1EE8002C5088748DA0BAC0806E6.css b/fastn-core/tests/22-http-headers/output/code-theme-B8645DE281A38A3068C56919DE1BB0511696A1EE8002C5088748DA0BAC0806E6.css deleted file mode 100644 index 5943471ef6..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-B8645DE281A38A3068C56919DE1BB0511696A1EE8002C5088748DA0BAC0806E6.css +++ /dev/null @@ -1,210 +0,0 @@ -code[class*=language-].fastn-theme-light, -pre[class*=language-].fastn-theme-light { - color: #000; - background: 0 0; - text-shadow: 0 1px #fff; - /*font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;*/ - /*font-size: 1em;*/ - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - word-wrap: normal; - /*line-height: 1.5;*/ - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none -} - -code[class*=language-].fastn-theme-light ::-moz-selection, -code[class*=language-].fastn-theme-light::-moz-selection, -pre[class*=language-].fastn-theme-light ::-moz-selection, -pre[class*=language-].fastn-theme-light::-moz-selection { - text-shadow: none; - background: #b3d4fc -} - -code[class*=language-].fastn-theme-light ::selection, -code[class*=language-].fastn-theme-light::selection, -pre[class*=language-].fastn-theme-light ::selection, -pre[class*=language-].fastn-theme-light::selection { - text-shadow: none; - background: #b3d4fc -} - -@media print { - - code[class*=language-].fastn-theme-light, - pre[class*=language-].fastn-theme-light { - text-shadow: none - } -} - -pre[class*=language-].fastn-theme-light { - padding: 1em; - overflow: auto -} - -:not(pre)>code[class*=language-].fastn-theme-light, -pre[class*=language-].fastn-theme-light { - background: #f5f2f0 -} - -:not(pre)>code[class*=language-].fastn-theme-light { - padding: .1em; - border-radius: .3em; - white-space: normal -} - -/* Fastn Language tokens -------------------------------------------------- */ - -.fastn-theme-light .token.section-identifier { - color: #36464e; -} - -.fastn-theme-light .token.section-name { - color: #07a; -} - -.fastn-theme-light .token.section-caption { - color: #1c7d4d; -} - -.fastn-theme-light .token.semi-colon { - color: #696b70; -} - -.fastn-theme-light .token.event { - color: #c46262; -} - -.fastn-theme-light .token.processor { - color: #c46262; -} - -.fastn-theme-light .token.type-modifier { - color: #5c43bd; -} - -.fastn-theme-light .token.value-type { - color: #5c43bd; -} - -.fastn-theme-light .token.kernel-type { - color: #5c43bd; -} - -.fastn-theme-light .token.header-type { - color: #5c43bd; -} - -.fastn-theme-light .token.header-name { - color: #a846b9; -} - -.fastn-theme-light .token.header-condition { - color: #8b3b3b; -} - -.fastn-theme-light .token.header-value { - color: #36464e; -} - -/* END ----------------------------------------------------------------- */ - -.fastn-theme-light .token.cdata, -.fastn-theme-light .token.comment, -.fastn-theme-light .token.doctype, -.fastn-theme-light .token.prolog { - color: #7f93a8 -} - -.fastn-theme-light .token.punctuation { - color: #999 -} - -.fastn-theme-light .token.namespace { - opacity: .7 -} - -.fastn-theme-light .token.boolean, -.fastn-theme-light .token.constant, -.fastn-theme-light .token.deleted, -.fastn-theme-light .token.number, -.fastn-theme-light .token.property, -.fastn-theme-light .token.symbol, -.fastn-theme-light .token.tag { - color: #905 -} - -.fastn-theme-light .token.attr-name, -.fastn-theme-light .token.builtin, -.fastn-theme-light .token.char, -.fastn-theme-light .token.inserted, -.fastn-theme-light .token.selector, -.fastn-theme-light .token.string { - color: #36464e -} - -.fastn-theme-light .token.important, -.fastn-theme-light .token.deliminator { - color: #1c7d4d; -} - -.language-css .fastn-theme-light .token.string, -.style .fastn-theme-light .token.string, -.fastn-theme-light .token.entity, -.fastn-theme-light .token.operator, -.fastn-theme-light .token.url { - color: #9a6e3a; - background: hsla(0, 0%, 100%, .5) -} - -.fastn-theme-light .token.atrule, -.fastn-theme-light .token.attr-value, -.fastn-theme-light .token.keyword { - color: #07a -} - -.fastn-theme-light .token.class-name, -.fastn-theme-light .token.function { - color: #3f6ec6 -} - -.fastn-theme-light .token.important, -.fastn-theme-light .token.regex, -.fastn-theme-light .token.variable { - color: #a846b9 -} - -.fastn-theme-light .token.bold, -.fastn-theme-light .token.important { - font-weight: 700 -} - -.fastn-theme-light .token.italic { - font-style: italic -} - -.fastn-theme-light .token.entity { - cursor: help -} - - -/* Line highlight plugin */ -.fastn-theme-light .line-highlight.line-highlight { - background-color: #87afff33; - box-shadow: inset 2px 0 0 #4387ff -} - -.fastn-theme-light .line-highlight.line-highlight:before, -.fastn-theme-light .line-highlight.line-highlight[data-end]:after { - top: auto; - background-color: #4387ff; - color: #fff; - border-radius: 50%; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-DC76F700474E809F7BA2D9914793D04881B17EA4699BA9C568C83D32A18B0173.css b/fastn-core/tests/22-http-headers/output/code-theme-DC76F700474E809F7BA2D9914793D04881B17EA4699BA9C568C83D32A18B0173.css deleted file mode 100644 index a94a172385..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-DC76F700474E809F7BA2D9914793D04881B17EA4699BA9C568C83D32A18B0173.css +++ /dev/null @@ -1,281 +0,0 @@ -/** - * VS Code Dark+ theme by tabuckner (https://github.com/tabuckner) - * Inspired by Visual Studio syntax coloring - */ - - -pre[class*="language-"].vs-theme-dark, -code[class*="language-"].vs-theme-dark { - color: #d4d4d4; - font-size: 13px; - text-shadow: none; - font-family: Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace; - direction: ltr; - text-align: left; - white-space: pre; - word-spacing: normal; - word-break: normal; - line-height: 1.5; - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*="language-"].vs-theme-dark::selection, -code[class*="language-"].vs-theme-dark::selection, -pre[class*="language-"].vs-theme-dark *::selection, -code[class*="language-"].vs-theme-dark *::selection { - text-shadow: none; - background: #264F78; -} - -@media print { - pre[class*="language-"].vs-theme-dark, - code[class*="language-"].vs-theme-dark { - text-shadow: none; - } -} - -pre[class*="language-"].vs-theme-dark { - padding: 1em; - margin: .5em 0; - overflow: auto; - background: #1e1e1e; -} - -:not(pre) > code[class*="language-"].vs-theme-dark { - padding: .1em .3em; - border-radius: .3em; - color: #db4c69; - background: #1e1e1e; -} -/********************************************************* -* Tokens -*/ -.namespace { - opacity: .7; -} - -.vs-theme-dark .token.doctype .token.doctype-tag { - color: #569CD6; -} - -.vs-theme-dark .token.doctype .token.name { - color: #9cdcfe; -} - -.vs-theme-dark .token.comment, -.vs-theme-dark .token.prolog { - color: #6a9955; -} - -.vs-theme-dark .token.punctuation, -.language-html .language-css .vs-theme-dark .token.punctuation, -.language-html .language-javascript .vs-theme-dark .token.punctuation { - color: #d4d4d4; -} - -.vs-theme-dark .token.property, -.vs-theme-dark .token.tag, -.vs-theme-dark .token.boolean, -.vs-theme-dark .token.number, -.vs-theme-dark .token.constant, -.vs-theme-dark .token.symbol, -.vs-theme-dark .token.inserted, -.vs-theme-dark .token.unit { - color: #b5cea8; -} - -.vs-theme-dark .token.selector, -.vs-theme-dark .token.attr-name, -.vs-theme-dark .token.string, -.vs-theme-dark .token.char, -.vs-theme-dark .token.builtin, -.vs-theme-dark .token.deleted { - color: #ce9178; -} - -.language-css .vs-theme-dark .token.string.url { - text-decoration: underline; -} - -.vs-theme-dark .token.operator, -.vs-theme-dark .token.entity { - color: #d4d4d4; -} - -.vs-theme-dark .token.operator.arrow { - color: #569CD6; -} - -.vs-theme-dark .token.atrule { - color: #ce9178; -} - -.vs-theme-dark .token.atrule .vs-theme-dark .token.rule { - color: #c586c0; -} - -.vs-theme-dark .token.atrule .vs-theme-dark .token.url { - color: #9cdcfe; -} - -.vs-theme-dark .token.atrule .vs-theme-dark .token.url .vs-theme-dark .token.function { - color: #dcdcaa; -} - -.vs-theme-dark .token.atrule .vs-theme-dark .token.url .vs-theme-dark .token.punctuation { - color: #d4d4d4; -} - -.vs-theme-dark .token.keyword { - color: #569CD6; -} - -.vs-theme-dark .token.keyword.module, -.vs-theme-dark .token.keyword.control-flow { - color: #c586c0; -} - -.vs-theme-dark .token.function, -.vs-theme-dark .token.function .vs-theme-dark .token.maybe-class-name { - color: #dcdcaa; -} - -.vs-theme-dark .token.regex { - color: #d16969; -} - -.vs-theme-dark .token.important { - color: #569cd6; -} - -.vs-theme-dark .token.italic { - font-style: italic; -} - -.vs-theme-dark .token.constant { - color: #9cdcfe; -} - -.vs-theme-dark .token.class-name, -.vs-theme-dark .token.maybe-class-name { - color: #4ec9b0; -} - -.vs-theme-dark .token.console { - color: #9cdcfe; -} - -.vs-theme-dark .token.parameter { - color: #9cdcfe; -} - -.vs-theme-dark .token.interpolation { - color: #9cdcfe; -} - -.vs-theme-dark .token.punctuation.interpolation-punctuation { - color: #569cd6; -} - -.vs-theme-dark .token.boolean { - color: #569cd6; -} - -.vs-theme-dark .token.property, -.vs-theme-dark .token.variable, -.vs-theme-dark .token.imports .vs-theme-dark .token.maybe-class-name, -.vs-theme-dark .token.exports .vs-theme-dark .token.maybe-class-name { - color: #9cdcfe; -} - -.vs-theme-dark .token.selector { - color: #d7ba7d; -} - -.vs-theme-dark .token.escape { - color: #d7ba7d; -} - -.vs-theme-dark .token.tag { - color: #569cd6; -} - -.vs-theme-dark .token.tag .vs-theme-dark .token.punctuation { - color: #808080; -} - -.vs-theme-dark .token.cdata { - color: #808080; -} - -.vs-theme-dark .token.attr-name { - color: #9cdcfe; -} - -.vs-theme-dark .token.attr-value, -.vs-theme-dark .token.attr-value .vs-theme-dark .token.punctuation { - color: #ce9178; -} - -.vs-theme-dark .token.attr-value .vs-theme-dark .token.punctuation.attr-equals { - color: #d4d4d4; -} - -.vs-theme-dark .token.entity { - color: #569cd6; -} - -.vs-theme-dark .token.namespace { - color: #4ec9b0; -} -/********************************************************* -* Language Specific -*/ - -pre[class*="language-javascript"], -code[class*="language-javascript"], -pre[class*="language-jsx"], -code[class*="language-jsx"], -pre[class*="language-typescript"], -code[class*="language-typescript"], -pre[class*="language-tsx"], -code[class*="language-tsx"] { - color: #9cdcfe; -} - -pre[class*="language-css"], -code[class*="language-css"] { - color: #ce9178; -} - -pre[class*="language-html"], -code[class*="language-html"] { - color: #d4d4d4; -} - -.language-regex .vs-theme-dark .token.anchor { - color: #dcdcaa; -} - -.language-html .vs-theme-dark .token.punctuation { - color: #808080; -} -/********************************************************* -* Line highlighting -*/ -pre[class*="language-"].vs-theme-dark > code[class*="language-"].vs-theme-dark { - position: relative; - z-index: 1; -} - -.line-highlight.line-highlight { - background: #f7ebc6; - box-shadow: inset 5px 0 0 #f7d87c; - z-index: 0; -} diff --git a/fastn-core/tests/22-http-headers/output/code-theme-F614177D3155EA8E915B35A3445175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css b/fastn-core/tests/22-http-headers/output/code-theme-F614177D3155EA8E915B35A3445175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css deleted file mode 100644 index 7483c06fc7..0000000000 --- a/fastn-core/tests/22-http-headers/output/code-theme-F614177D3155EA8E915B35A3445175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Based on Plugin: Syntax Highlighter CB - * Plugin URI: http://wp.tutsplus.com/tutorials/plugins/adding-a-syntax-highlighter-shortcode-using-prism-js - * Description: Highlight your code snippets with an easy to use shortcode based on Lea Verou's Prism.js. - * Version: 1.0.0 - * Author: c.bavota - * Author URI: http://bavotasan.comhttp://wp.tutsplus.com/tutorials/plugins/adding-a-syntax-highlighter-shortcode-using-prism-js/ */ -/* http://cbavota.bitbucket.org/syntax-highlighter/ */ - -/* ===== ===== */ -code[class*=language-].fastn-theme-dark, -pre[class*=language-].fastn-theme-dark { - color: #fff; - text-shadow: 0 1px 1px #000; - /*font-family: Menlo, Monaco, "Courier New", monospace;*/ - direction: ltr; - text-align: left; - word-spacing: normal; - white-space: pre; - word-wrap: normal; - /*line-height: 1.4;*/ - background: none; - border: 0; - - -moz-tab-size: 4; - -o-tab-size: 4; - tab-size: 4; - - -webkit-hyphens: none; - -moz-hyphens: none; - -ms-hyphens: none; - hyphens: none; -} - -pre[class*=language-].fastn-theme-dark code { - float: left; - padding: 0 15px 0 0; -} - -pre[class*=language-].fastn-theme-dark, -:not(pre) > code[class*=language-].fastn-theme-dark { - background: #222; -} - -/* Code blocks */ -pre[class*=language-].fastn-theme-dark { - padding: 15px; - overflow: auto; -} - -/* Inline code */ -:not(pre) > code[class*=language-].fastn-theme-dark { - padding: 5px 10px; - line-height: 1; -} - -/* Fastn Language tokens -------------------------------------------------- */ - -.fastn-theme-dark .token.section-identifier { - color: #d5d7e2; -} - -.fastn-theme-dark .token.section-name { - color: #6791e0; -} - -.fastn-theme-dark .token.section-caption { - color: #2fb170; -} - -.fastn-theme-dark .token.semi-colon { - color: #cecfd2; -} - -.fastn-theme-dark .token.event { - color: #6ae2ff; -} - -.fastn-theme-dark .token.processor { - color: #6ae2ff; -} - -.fastn-theme-dark .token.type-modifier { - color: #54b59e; -} - -.fastn-theme-dark .token.value-type { - color: #54b59e; -} - -.fastn-theme-dark .token.kernel-type { - color: #54b59e; -} - -.fastn-theme-dark .token.header-type { - color: #54b59e; -} - -.fastn-theme-dark .token.header-name { - color: #c973d9; -} - -.fastn-theme-dark .token.header-condition { - color: #9871ff; -} - -.fastn-theme-dark .token.header-value { - color: #d5d7e2; -} - -/* END ----------------------------------------------------------------- */ - -.fastn-theme-dark .token.comment, -.fastn-theme-dark .token.prolog, -.fastn-theme-dark .token.doctype, -.fastn-theme-dark .token.cdata { - color: #d4c8c896; -} - -.fastn-theme-dark .token.selector, -.fastn-theme-dark .token.operator, -.fastn-theme-dark .token.punctuation { - color: #fff; -} - -.fastn-theme-dark .token.namespace { - opacity: .7; -} - -.fastn-theme-dark .token.tag, -.fastn-theme-dark .token.boolean { - color: #ff5cac; -} - -.fastn-theme-dark .token.atrule, -.fastn-theme-dark .token.attr-value, -.fastn-theme-dark .token.hex, -.fastn-theme-dark .token.string { - color: #d5d7e2; -} - -.fastn-theme-dark .token.property, -.fastn-theme-dark .token.entity, -.fastn-theme-dark .token.url, -.fastn-theme-dark .token.attr-name, -.fastn-theme-dark .token.keyword { - color: #ffa05c; -} - -.fastn-theme-dark .token.regex { - color: #c973d9; -} - -.fastn-theme-dark .token.entity { - cursor: help; -} - -.fastn-theme-dark .token.function, -.fastn-theme-dark .token.constant { - color: #6791e0; -} - -.fastn-theme-dark .token.variable { - color: #fdfba8; -} - -.fastn-theme-dark .token.number { - color: #8799B0; -} - -.fastn-theme-dark .token.important, -.fastn-theme-dark .token.deliminator { - color: #2fb170; -} - -/* Line highlight plugin */ -.fastn-theme-dark .line-highlight.line-highlight { - background-color: #0734a533; - box-shadow: inset 2px 0 0 #2a77ff -} - -.fastn-theme-dark .line-highlight.line-highlight:before, -.fastn-theme-dark .line-highlight.line-highlight[data-end]:after { - top: auto; - background-color: #2a77ff; - color: #fff; - border-radius: 50%; -} - -/* for line numbers */ -/* span instead of span:before for a two-toned border */ -.fastn-theme-dark .line-numbers .line-numbers-rows > span { - border-right: 3px #d9d336 solid; -} diff --git a/fastn-core/tests/22-http-headers/output/default-B66C2B8914832538F78C67C1C127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js b/fastn-core/tests/22-http-headers/output/default-B66C2B8914832538F78C67C1C127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js deleted file mode 100644 index 42bd2468ac..0000000000 --- a/fastn-core/tests/22-http-headers/output/default-B66C2B8914832538F78C67C1C127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js +++ /dev/null @@ -1,6550 +0,0 @@ -/* ftd-language.js */ - -Prism.languages.ftd = { - comment: [ - { - pattern: /\/--\s*((?!--)[\S\s])*/g, - greedy: true, - alias: "section-comment", - }, - { - pattern: /[\s]*\/[\w]+(:).*\n/g, - greedy: true, - alias: "header-comment", - }, - { - pattern: /(;;).*\n/g, - greedy: true, - alias: "inline-or-line-comment", - }, - ], - /* - -- [section-type] <section-name>: [caption] - [header-type] <header>: [value] - - [block headers] - - [body] -> string - - [children] - - [-- end: <section-name>] - */ - string: { - pattern: /^[ \t\n]*--\s+(.*)(\n(?![ \n\t]*--).*)*/g, - inside: { - /* section-identifier */ - "section-identifier": /([ \t\n])*--\s+/g, - /* [section type] <section name>: */ - punctuation: { - pattern: /^(.*):/g, - inside: { - "semi-colon": /:/g, - keyword: /^(component|record|end|or-type)/g, - "value-type": /^(integer|boolean|decimal|string)/g, - "kernel-type": /\s*ftd[\S]+/g, - "type-modifier": { - pattern: /(\s)+list(?=\s)/g, - lookbehind: true, - }, - "section-name": { - pattern: /(\s)*.+/g, - lookbehind: true, - }, - }, - }, - /* section caption */ - "section-caption": /^.+(?=\n)*/g, - /* header name: header value */ - regex: { - pattern: /(?!--\s*).*[:]\s*(.*)(\n)*/g, - inside: { - /* if condition on component */ - "header-condition": /\s*if\s*:(.)+/g, - /* header event */ - event: /\s*\$on(.)+\$(?=:)/g, - /* header processor */ - processor: /\s*\$[^:]+\$(?=:)/g, - /* header name => [header-type] <name> [header-condition] */ - regex: { - pattern: /[^:]+(?=:)/g, - inside: { - /* [header-condition] */ - "header-condition": /if\s*{.+}/g, - /* [header-type] <name> */ - tag: { - pattern: /(.)+(?=if)?/g, - inside: { - "kernel-type": /^\s*ftd[\S]+/g, - "header-type": - /^(record|caption|body|caption or body|body or caption|integer|boolean|decimal|string)/g, - "type-modifier": { - pattern: /(\s)+list(?=\s)/g, - lookbehind: true, - }, - "header-name": { - pattern: /(\s)*(.)+/g, - lookbehind: true, - }, - }, - }, - }, - }, - /* semicolon */ - "semi-colon": /:/g, - /* header value (if any) */ - "header-value": { - pattern: /(\s)*(.+)/g, - lookbehind: true, - }, - }, - }, - }, - }, -}; -/** - * marked v9.1.4 - a markdown parser - * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed) - * https://github.com/markedjs/marked - */ -// Content taken from https://cdn.jsdelivr.net/npm/marked/marked.min.js -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,(function(e){"use strict";function t(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function n(t){e.defaults=t}e.defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};const s=/[&<>"']/,r=new RegExp(s.source,"g"),i=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,l=new RegExp(i.source,"g"),o={"&":"&","<":"<",">":">",'"':""","'":"'"},a=e=>o[e];function c(e,t){if(t){if(s.test(e))return e.replace(r,a)}else if(i.test(e))return e.replace(l,a);return e}const h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;const p=/(^|[^\[])\^/g;function u(e,t){e="string"==typeof e?e:e.source,t=t||"";const n={replace:(t,s)=>(s=(s="object"==typeof s&&"source"in s?s.source:s).replace(p,"$1"),e=e.replace(t,s),n),getRegex:()=>new RegExp(e,t)};return n}function g(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const k={exec:()=>null};function f(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let s=!1,r=t;for(;--r>=0&&"\\"===n[r];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(/\\\|/g,"|");return n}function d(e,t,n){const s=e.length;if(0===s)return"";let r=0;for(;r<s;){const i=e.charAt(s-r-1);if(i!==t||n){if(i===t||!n)break;r++}else r++}return e.slice(0,s-r)}function x(e,t,n,s){const r=t.href,i=t.title?c(t.title):null,l=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:n,href:r,title:i,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,e}return{type:"image",raw:n,href:r,title:i,text:c(l)}}class b{options;rules;lexer;constructor(t){this.options=t||e.defaults}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:d(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const s=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=d(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=d(t[0].replace(/^ *>[ \t]?/gm,""),"\n"),n=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const i=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let l="",o="",a=!1;for(;e;){let n=!1;if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;l=t[0],e=e.substring(l.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,o=s.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,o=s.slice(h),h+=t[1].length);let p=!1;if(!s&&/^ *$/.test(c)&&(l+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),r=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),i=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;e;){const a=e.split("\n",1)[0];if(c=a,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),r.test(c))break;if(i.test(c))break;if(t.test(c))break;if(n.test(e))break;if(c.search(/[^ ]/)>=h||!c.trim())o+="\n"+c.slice(h);else{if(p)break;if(s.search(/[^ ]/)>=4)break;if(r.test(s))break;if(i.test(s))break;if(n.test(s))break;o+="\n"+c}p||c.trim()||(p=!0),l+=a+"\n",e=e.substring(a.length+1),s=c.slice(h)}}r.loose||(a?r.loose=!0:/\n *\n *$/.test(l)&&(a=!0));let u,g=null;this.options.gfm&&(g=/^\[[ xX]\] /.exec(o),g&&(u="[ ] "!==g[0],o=o.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:l,task:!!g,checked:u,loose:!1,text:o,tokens:[]}),r.raw+=l}r.items[r.items.length-1].raw=l.trimEnd(),r.items[r.items.length-1].text=o.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e<r.items.length;e++)if(this.lexer.state.top=!1,r.items[e].tokens=this.lexer.blockTokens(r.items[e].text,[]),!r.loose){const t=r.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e<r.items.length;e++)r.items[e].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(t){if(!/[:|]/.test(t[2]))return;const e={type:"table",raw:t[0],header:f(t[1]).map((e=>({text:e,tokens:[]}))),align:t[2].replace(/^\||\| *$/g,"").split("|"),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){let t,n,s,r,i=e.align.length;for(t=0;t<i;t++){const n=e.align[t];n&&(/^ *-+: *$/.test(n)?e.align[t]="right":/^ *:-+: *$/.test(n)?e.align[t]="center":/^ *:-+ *$/.test(n)?e.align[t]="left":e.align[t]=null)}for(i=e.rows.length,t=0;t<i;t++)e.rows[t]=f(e.rows[t],e.header.length).map((e=>({text:e,tokens:[]})));for(i=e.header.length,n=0;n<i;n++)e.header[n].tokens=this.lexer.inline(e.header[n].text);for(i=e.rows.length,n=0;n<i;n++)for(r=e.rows[n],s=0;s<r.length;s++)r[s].tokens=this.lexer.inline(r[s].text);return e}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:c(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=d(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let s=0;s<e.length;s++)if("\\"===e[s])s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),x(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return x(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrong.lDelim.exec(e);if(!s)return;if(s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let r,i,l=n,o=0;const a="*"===s[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+s[0].length-1);null!=(s=a.exec(t));){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(i=[...r].length,s[3]||s[4]){l+=i;continue}if((s[5]||s[6])&&n%3&&!((n+i)%3)){o+=i;continue}if(l-=i,l>0)continue;i=Math.min(i,i+l+o);const t=[...e].slice(0,n+s.index+i+1).join("");if(Math.min(n,i)%2){const e=t.slice(1,-1);return{type:"em",raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}const a=t.slice(2,-2);return{type:"strong",raw:t,text:a,tokens:this.lexer.inlineTokens(a)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return n&&s&&(e=e.substring(1,e.length-1)),e=c(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=c(t[1]),n="mailto:"+e):(e=c(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=c(t[0]),n="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])[0]}while(s!==t[0]);e=c(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:c(t[0]),{type:"text",raw:t[0],text:e}}}}const m={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:k,lheading:/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};m.def=u(m.def).replace("label",m._label).replace("title",m._title).getRegex(),m.bullet=/(?:[*+-]|\d{1,9}[.)])/,m.listItemStart=u(/^( *)(bull) */).replace("bull",m.bullet).getRegex(),m.list=u(m.list).replace(/bull/g,m.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+m.def.source+")").getRegex(),m._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",m._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,m.html=u(m.html,"i").replace("comment",m._comment).replace("tag",m._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),m.lheading=u(m.lheading).replace(/bull/g,m.bullet).getRegex(),m.paragraph=u(m._paragraph).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.blockquote=u(m.blockquote).replace("paragraph",m.paragraph).getRegex(),m.normal={...m},m.gfm={...m.normal,table:"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"},m.gfm.table=u(m.gfm.table).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.gfm.paragraph=u(m._paragraph).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",m.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.pedantic={...m.normal,html:u("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",m._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:k,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(m.normal._paragraph).replace("hr",m.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",m.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const w={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:k,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:k,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^((?![*_])[\spunctuation])/,_punctuation:"\\p{P}$+<=>`^|~"};w.punctuation=u(w.punctuation,"u").replace(/punctuation/g,w._punctuation).getRegex(),w.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,w.anyPunctuation=/\\[punct]/g,w._escapes=/\\([punct])/g,w._comment=u(m._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),w.emStrong.lDelim=u(w.emStrong.lDelim,"u").replace(/punct/g,w._punctuation).getRegex(),w.emStrong.rDelimAst=u(w.emStrong.rDelimAst,"gu").replace(/punct/g,w._punctuation).getRegex(),w.emStrong.rDelimUnd=u(w.emStrong.rDelimUnd,"gu").replace(/punct/g,w._punctuation).getRegex(),w.anyPunctuation=u(w.anyPunctuation,"gu").replace(/punct/g,w._punctuation).getRegex(),w._escapes=u(w._escapes,"gu").replace(/punct/g,w._punctuation).getRegex(),w._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,w._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,w.autolink=u(w.autolink).replace("scheme",w._scheme).replace("email",w._email).getRegex(),w._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,w.tag=u(w.tag).replace("comment",w._comment).replace("attribute",w._attribute).getRegex(),w._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,w._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,w._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,w.link=u(w.link).replace("label",w._label).replace("href",w._href).replace("title",w._title).getRegex(),w.reflink=u(w.reflink).replace("label",w._label).replace("ref",m._label).getRegex(),w.nolink=u(w.nolink).replace("ref",m._label).getRegex(),w.reflinkSearch=u(w.reflinkSearch,"g").replace("reflink",w.reflink).replace("nolink",w.nolink).getRegex(),w.normal={...w},w.pedantic={...w.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",w._label).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",w._label).getRegex()},w.gfm={...w.normal,escape:u(w.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},w.gfm.url=u(w.gfm.url,"i").replace("email",w.gfm._extended_email).getRegex(),w.breaks={...w.gfm,br:u(w.br).replace("{2,}","*").getRegex(),text:u(w.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};class _{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||e.defaults,this.options.tokenizer=this.options.tokenizer||new b,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:m.normal,inline:w.normal};this.options.pedantic?(n.block=m.pedantic,n.inline=w.pedantic):this.options.gfm&&(n.block=m.gfm,this.options.breaks?n.inline=w.breaks:n.inline=w.gfm),this.tokenizer.rules=n}static get rules(){return{block:m,inline:w}}static lex(e,t){return new _(t).lex(e)}static lexInline(e,t){return new _(t).inlineTokens(e)}lex(e){let t;for(e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){let n,s,r,i;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(n):(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(s.raw+="\n"+n.raw,s.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(r=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r)))s=t[t.length-1],i&&"paragraph"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),i=r.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,r,i,l,o,a=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(a));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(a));)a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(a));)a=a.slice(0,i.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(o=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,a,o))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(r=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),l=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class y{options;constructor(t){this.options=t||e.defaults}code(e,t,n){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="language-'+c(s)+'">'+(n?e:c(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:c(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,n){const s=t?"ol":"ul";return"<"+s+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+s+">\n"}listitem(e,t,n){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const s=g(e);if(null===s)return n;let r='<a href="'+(e=s)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){const s=g(e);if(null===s)return n;let r=`<img src="${e=s}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(e){return e}}class ${strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class z{options;renderer;textRenderer;constructor(t){this.options=t||e.defaults,this.options.renderer=this.options.renderer||new y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new $}static parse(e,t){return new z(t).parse(e)}static parseInline(e,t){return new z(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}switch(r.type){case"space":continue;case"hr":n+=this.renderer.hr();continue;case"heading":{const e=r;n+=this.renderer.heading(this.parseInline(e.tokens),e.depth,this.parseInline(e.tokens,this.textRenderer).replace(h,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")));continue}case"code":{const e=r;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=r;let t="",s="";for(let t=0;t<e.header.length;t++)s+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(s);let i="";for(let t=0;t<e.rows.length;t++){const n=e.rows[t];s="";for(let t=0;t<n.length;t++)s+=this.renderer.tablecell(this.parseInline(n[t].tokens),{header:!1,align:e.align[t]});i+=this.renderer.tablerow(s)}n+=this.renderer.table(t,i);continue}case"blockquote":{const e=r,t=this.parse(e.tokens);n+=this.renderer.blockquote(t);continue}case"list":{const e=r,t=e.ordered,s=e.start,i=e.loose;let l="";for(let t=0;t<e.items.length;t++){const n=e.items[t],s=n.checked,r=n.task;let o="";if(n.task){const e=this.renderer.checkbox(!!s);i?n.tokens.length>0&&"paragraph"===n.tokens[0].type?(n.tokens[0].text=e+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&"text"===n.tokens[0].tokens[0].type&&(n.tokens[0].tokens[0].text=e+" "+n.tokens[0].tokens[0].text)):n.tokens.unshift({type:"text",text:e+" "}):o+=e+" "}o+=this.parse(n.tokens,i),l+=this.renderer.listitem(o,r,!!s)}n+=this.renderer.list(l,t,s);continue}case"html":{const e=r;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=r;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let i=r,l=i.tokens?this.parseInline(i.tokens):i.text;for(;s+1<e.length&&"text"===e[s+1].type;)i=e[++s],l+="\n"+(i.tokens?this.parseInline(i.tokens):i.text);n+=t?this.renderer.paragraph(l):l;continue}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=e||"";continue}}switch(r.type){case"escape":{const e=r;n+=t.text(e.text);break}case"html":{const e=r;n+=t.html(e.text);break}case"link":{const e=r;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=r;n+=t.image(e.href,e.title,e.text);break}case"strong":{const e=r;n+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=r;n+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=r;n+=t.codespan(e.text);break}case"br":n+=t.br();break;case"del":{const e=r;n+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=r;n+=t.text(e.text);break}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class T{options;constructor(t){this.options=t||e.defaults}static passThroughHooks=new Set(["preprocess","postprocess"]);preprocess(e){return e}postprocess(e){return e}}class R{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(_.lex,z.parse);parseInline=this.#e(_.lexInline,z.parseInline);Parser=z;parser=z.parse;Renderer=y;TextRenderer=$;Lexer=_;lexer=_.lex;Tokenizer=b;Hooks=T;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{const e=s;for(const s of e.header)n=n.concat(this.walkTokens(s.tokens,t));for(const s of e.rows)for(const e of s)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=s;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=s;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((s=>{n=n.concat(this.walkTokens(e[s],t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=n.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new y(this.defaults);for(const n in e.renderer){const s=e.renderer[n],r=n,i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new b(this.defaults);for(const n in e.tokenizer){const s=e.tokenizer[n],r=n,i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new T;for(const n in e.hooks){const s=e.hooks[n],r=n,i=t[r];T.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(s.call(t,e)).then((e=>i.call(t,e)));const n=s.call(t,e);return i.call(t,n)}:t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(s.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}#e(e,t){return(n,s)=>{const r={...s},i={...this.defaults,...r};!0===this.defaults.async&&!1===r.async&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const l=this.#t(!!i.silent,!!i.async);if(null==n)return l(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then((t=>e(t,i))).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>t(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(l);try{i.hooks&&(n=i.hooks.preprocess(n));const s=e(n,i);i.walkTokens&&this.walkTokens(s,i.walkTokens);let r=t(s,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return l(e)}}}#t(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+c(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}}const S=new R;function A(e,t){return S.parse(e,t)}A.options=A.setOptions=function(e){return S.setOptions(e),A.defaults=S.defaults,n(A.defaults),A},A.getDefaults=t,A.defaults=e.defaults,A.use=function(...e){return S.use(...e),A.defaults=S.defaults,n(A.defaults),A},A.walkTokens=function(e,t){return S.walkTokens(e,t)},A.parseInline=S.parseInline,A.Parser=z,A.parser=z.parse,A.Renderer=y,A.TextRenderer=$,A.Lexer=_,A.lexer=_.lex,A.Tokenizer=b,A.Hooks=T,A.parse=A;const I=A.options,E=A.setOptions,Z=A.use,q=A.walkTokens,L=A.parseInline,D=A,P=z.parse,v=_.lex;e.Hooks=T,e.Lexer=_,e.Marked=R,e.Parser=z,e.Renderer=y,e.TextRenderer=$,e.Tokenizer=b,e.getDefaults=t,e.lexer=v,e.marked=A,e.options=I,e.parse=D,e.parseInline=L,e.parser=P,e.setOptions=E,e.use=Z,e.walkTokens=q})); -const fastn = (function (fastn) { - class Closure { - #cached_value; - #node; - #property; - #formula; - #inherited; - constructor(func, execute = true) { - if (execute) { - this.#cached_value = func(); - } - this.#formula = func; - } - - get() { - return this.#cached_value; - } - getFormula() { - return this.#formula; - } - addNodeProperty(node, property, inherited) { - this.#node = node; - this.#property = property; - this.#inherited = inherited; - this.updateUi(); - - return this; - } - update() { - this.#cached_value = this.#formula(); - this.updateUi(); - } - getNode() { - return this.#node; - } - updateUi() { - if ( - !this.#node || - this.#property === null || - this.#property === undefined || - !this.#node.getNode() - ) { - return; - } - - this.#node.setStaticProperty( - this.#property, - this.#cached_value, - this.#inherited, - ); - } - } - - class Mutable { - #value; - #old_closure; - #closures; - #closureInstance; - constructor(val) { - this.#value = null; - this.#old_closure = null; - this.#closures = []; - this.#closureInstance = fastn.closure(() => - this.#closures.forEach((closure) => closure.update()), - ); - this.set(val); - } - get(key) { - if ( - !fastn_utils.isNull(key) && - (this.#value instanceof RecordInstance || - this.#value instanceof MutableList || - this.#value instanceof Mutable) - ) { - return this.#value.get(key); - } - return this.#value; - } - setWithoutUpdate(value) { - if (this.#old_closure) { - this.#value.removeClosure(this.#old_closure); - } - - if (this.#value instanceof RecordInstance) { - // this.#value.replace(value); will replace the record type - // variable instance created which we don't want. - // color: red - // color if { something }: $orange-green - // The `this.#value.replace(value);` will replace the value of - // `orange-green` with `{light: red, dark: red}` - this.#value = value; - } else { - this.#value = value; - } - - if (this.#value instanceof Mutable) { - this.#old_closure = fastn.closureWithoutExecute(() => - this.#closureInstance.update(), - ); - this.#value.addClosure(this.#old_closure); - } else { - this.#old_closure = null; - } - } - set(value) { - this.setWithoutUpdate(value); - - this.#closureInstance.update(); - } - // we have to unlink all nodes, else they will be kept in memory after the node is removed from DOM - unlinkNode(node) { - this.#closures = this.#closures.filter( - (closure) => closure.getNode() !== node, - ); - } - addClosure(closure) { - this.#closures.push(closure); - } - removeClosure(closure) { - this.#closures = this.#closures.filter((c) => c !== closure); - } - equalMutable(other) { - if (!fastn_utils.deepEqual(this.get(), other.get())) { - return false; - } - const thisClosures = this.#closures; - const otherClosures = other.#closures; - - return thisClosures === otherClosures; - } - getClone() { - return new Mutable(fastn_utils.clone(this.#value)); - } - } - - class Proxy { - #differentiator; - #cached_value; - #closures; - #closureInstance; - constructor(targets, differentiator) { - this.#differentiator = differentiator; - this.#cached_value = this.#differentiator().get(); - this.#closures = []; - - let proxy = this; - for (let idx in targets) { - targets[idx].addClosure( - new Closure(function () { - proxy.update(); - proxy.#closures.forEach((closure) => closure.update()); - }), - ); - targets[idx].addClosure(this); - } - } - addClosure(closure) { - this.#closures.push(closure); - } - removeClosure(closure) { - this.#closures = this.#closures.filter((c) => c !== closure); - } - update() { - this.#cached_value = this.#differentiator().get(); - } - get(key) { - if ( - !!key && - (this.#cached_value instanceof RecordInstance || - this.#cached_value instanceof MutableList || - this.#cached_value instanceof Mutable) - ) { - return this.#cached_value.get(key); - } - return this.#cached_value; - } - set(value) { - // Todo: Optimization removed. Reuse optimization later again - /*if (fastn_utils.deepEqual(this.#cached_value, value)) { - return; - }*/ - this.#differentiator().set(value); - } - } - - class MutableList { - #list; - #watchers; - #closures; - constructor(list) { - this.#list = []; - for (let idx in list) { - this.#list.push({ - item: fastn.wrapMutable(list[idx]), - index: new Mutable(parseInt(idx)), - }); - } - this.#watchers = []; - this.#closures = []; - } - addClosure(closure) { - this.#closures.push(closure); - } - unlinkNode(node) { - this.#closures = this.#closures.filter( - (closure) => closure.getNode() !== node, - ); - } - forLoop(root, dom_constructor) { - let l = fastn_dom.forLoop(root, dom_constructor, this); - this.#watchers.push(l); - return l; - } - getList() { - return this.#list; - } - getLength() { - return this.#list.length; - } - get(idx) { - if (fastn_utils.isNull(idx)) { - return this.getList(); - } - return this.#list[idx]; - } - set(index, value) { - if (value === undefined) { - value = index; - if (!(value instanceof MutableList)) { - if (!Array.isArray(value)) { - value = [value]; - } - value = new MutableList(value); - } - - let list = value.#list; - this.#list = []; - for (let i in list) { - this.#list.push(list[i]); - } - - for (let i in this.#watchers) { - this.#watchers[i].createAllNode(); - } - } else { - index = fastn_utils.getFlattenStaticValue(index); - this.#list[index].item.set(value); - } - - this.#closures.forEach((closure) => closure.update()); - } - insertAt(index, value) { - index = fastn_utils.getFlattenStaticValue(index); - let mutable = fastn.wrapMutable(value); - this.#list.splice(index, 0, { - item: mutable, - index: new Mutable(index), - }); - // for every item after the inserted item, update the index - for (let i = index + 1; i < this.#list.length; i++) { - this.#list[i].index.set(i); - } - - for (let i in this.#watchers) { - this.#watchers[i].createNode(index); - } - this.#closures.forEach((closure) => closure.update()); - } - push(value) { - this.insertAt(this.#list.length, value); - } - deleteAt(index) { - index = fastn_utils.getFlattenStaticValue(index); - this.#list.splice(index, 1); - // for every item after the deleted item, update the index - for (let i = index; i < this.#list.length; i++) { - this.#list[i].index.set(i); - } - - for (let i in this.#watchers) { - let forLoop = this.#watchers[i]; - forLoop.deleteNode(index); - } - this.#closures.forEach((closure) => closure.update()); - } - clearAll() { - this.#list = []; - for (let i in this.#watchers) { - this.#watchers[i].deleteAllNode(); - } - this.#closures.forEach((closure) => closure.update()); - } - pop() { - this.deleteAt(this.#list.length - 1); - } - getClone() { - let current_list = this.#list; - let new_list = []; - for (let idx in current_list) { - new_list.push(fastn_utils.clone(current_list[idx].item)); - } - return new MutableList(new_list); - } - } - - fastn.mutable = function (val) { - return new Mutable(val); - }; - - fastn.closure = function (func) { - return new Closure(func); - }; - - fastn.closureWithoutExecute = function (func) { - return new Closure(func, false); - }; - - fastn.formula = function (deps, func) { - let closure = fastn.closure(func); - let mutable = new Mutable(closure.get()); - for (let idx in deps) { - if (fastn_utils.isNull(deps[idx]) || !deps[idx].addClosure) { - continue; - } - deps[idx].addClosure( - new Closure(function () { - closure.update(); - mutable.set(closure.get()); - }), - ); - } - - return mutable; - }; - - fastn.proxy = function (targets, differentiator) { - return new Proxy(targets, differentiator); - }; - - fastn.wrapMutable = function (obj) { - if ( - !(obj instanceof Mutable) && - !(obj instanceof RecordInstance) && - !(obj instanceof MutableList) - ) { - obj = new Mutable(obj); - } - return obj; - }; - - fastn.mutableList = function (list) { - return new MutableList(list); - }; - - class RecordInstance { - #fields; - #closures; - constructor(obj) { - this.#fields = {}; - this.#closures = []; - - for (let key in obj) { - if (obj[key] instanceof fastn.mutableClass) { - this.#fields[key] = fastn.mutable(null); - this.#fields[key].setWithoutUpdate(obj[key]); - } else { - this.#fields[key] = fastn.mutable(obj[key]); - } - } - } - getAllFields() { - return this.#fields; - } - getClonedFields() { - let clonedFields = {}; - for (let key in this.#fields) { - let field_value = this.#fields[key]; - if ( - field_value instanceof fastn.recordInstanceClass || - field_value instanceof fastn.mutableClass || - field_value instanceof fastn.mutableListClass - ) { - clonedFields[key] = this.#fields[key].getClone(); - } else { - clonedFields[key] = this.#fields[key]; - } - } - return clonedFields; - } - addClosure(closure) { - this.#closures.push(closure); - } - unlinkNode(node) { - this.#closures = this.#closures.filter( - (closure) => closure.getNode() !== node, - ); - } - get(key) { - return this.#fields[key]; - } - set(key, value) { - if (value === undefined) { - value = key; - if (!(value instanceof RecordInstance)) { - value = new RecordInstance(value); - } - - let fields = {}; - for (let key in value.#fields) { - fields[key] = value.#fields[key]; - } - - this.#fields = fields; - } else if (this.#fields[key] === undefined) { - this.#fields[key] = fastn.mutable(null); - this.#fields[key].setWithoutUpdate(value); - } else { - this.#fields[key].set(value); - } - this.#closures.forEach((closure) => closure.update()); - } - setAndReturn(key, value) { - this.set(key, value); - return this; - } - replace(obj) { - for (let key in this.#fields) { - if (!(key in obj.#fields)) { - throw new Error( - "RecordInstance.replace: key " + - key + - " not present in new object", - ); - } - this.#fields[key] = fastn.wrapMutable(obj.#fields[key]); - } - this.#closures.forEach((closure) => closure.update()); - } - toObject() { - return Object.fromEntries( - Object.entries(this.#fields).map(([key, value]) => [ - key, - fastn_utils.getFlattenStaticValue(value), - ]), - ); - } - getClone() { - let current_fields = this.#fields; - let cloned_fields = {}; - for (let key in current_fields) { - let value = fastn_utils.clone(current_fields[key]); - if (value instanceof fastn.mutableClass) { - value = value.get(); - } - cloned_fields[key] = value; - } - return new RecordInstance(cloned_fields); - } - } - - class Module { - #name; - #global; - constructor(name, global) { - this.#name = name; - this.#global = global; - } - - getName() { - return this.#name; - } - - get(function_name) { - return this.#global[`${this.#name}__${function_name}`]; - } - } - - fastn.recordInstance = function (obj) { - return new RecordInstance(obj); - }; - - fastn.color = function (r, g, b) { - return `rgb(${r},${g},${b})`; - }; - - fastn.mutableClass = Mutable; - fastn.mutableListClass = MutableList; - fastn.recordInstanceClass = RecordInstance; - fastn.module = function (name, global) { - return new Module(name, global); - }; - fastn.moduleClass = Module; - - return fastn; -})({}); -let fastn_dom = {}; - -fastn_dom.styleClasses = ""; - -fastn_dom.InternalClass = { - FT_COLUMN: "ft_column", - FT_ROW: "ft_row", - FT_FULL_SIZE: "ft_full_size", -}; - -fastn_dom.codeData = { - availableThemes: {}, - addedCssFile: [], -}; - -fastn_dom.externalCss = new Set(); -fastn_dom.externalJs = new Set(); - -// Todo: Object (key, value) pair (counter type key) -fastn_dom.webComponent = []; - -fastn_dom.commentNode = "comment"; -fastn_dom.wrapperNode = "wrapper"; -fastn_dom.commentMessage = "***FASTN***"; -fastn_dom.webComponentArgument = "args"; - -fastn_dom.classes = {}; -fastn_dom.unsanitised_classes = {}; -fastn_dom.class_count = 0; -fastn_dom.propertyMap = { - "align-items": "ali", - "align-self": "as", - "background-color": "bgc", - "background-image": "bgi", - "background-position": "bgp", - "background-repeat": "bgr", - "background-size": "bgs", - "border-bottom-color": "bbc", - "border-bottom-left-radius": "bblr", - "border-bottom-right-radius": "bbrr", - "border-bottom-style": "bbs", - "border-bottom-width": "bbw", - "border-color": "bc", - "border-left-color": "blc", - "border-left-style": "bls", - "border-left-width": "blw", - "border-radius": "br", - "border-right-color": "brc", - "border-right-style": "brs", - "border-right-width": "brw", - "border-style": "bs", - "border-top-color": "btc", - "border-top-left-radius": "btlr", - "border-top-right-radius": "btrr", - "border-top-style": "bts", - "border-top-width": "btw", - "border-width": "bw", - bottom: "b", - color: "c", - shadow: "sh", - "text-shadow": "tsh", - cursor: "cur", - display: "d", - "flex-wrap": "fw", - "font-style": "fst", - "font-weight": "fwt", - gap: "g", - height: "h", - "justify-content": "jc", - left: "l", - link: "lk", - "link-color": "lkc", - margin: "m", - "margin-bottom": "mb", - "margin-horizontal": "mh", - "margin-left": "ml", - "margin-right": "mr", - "margin-top": "mt", - "margin-vertical": "mv", - "max-height": "mxh", - "max-width": "mxw", - "min-height": "mnh", - "min-width": "mnw", - opacity: "op", - overflow: "o", - "overflow-x": "ox", - "overflow-y": "oy", - "object-fit": "of", - padding: "p", - "padding-bottom": "pb", - "padding-horizontal": "ph", - "padding-left": "pl", - "padding-right": "pr", - "padding-top": "pt", - "padding-vertical": "pv", - position: "pos", - resize: "res", - role: "rl", - right: "r", - sticky: "s", - "text-align": "ta", - "text-decoration": "td", - "text-transform": "tt", - top: "t", - width: "w", - "z-index": "z", - "-webkit-box-orient": "wbo", - "-webkit-line-clamp": "wlc", - "backdrop-filter": "bdf", - "mask-image": "mi", - "-webkit-mask-image": "wmi", - "mask-size": "ms", - "-webkit-mask-size": "wms", - "mask-repeat": "mre", - "-webkit-mask-repeat": "wmre", - "mask-position": "mp", - "-webkit-mask-position": "wmp", - "fetch-priority": "ftp", -}; - -// dynamic-class-css.md -fastn_dom.getClassesAsString = function () { - return `<style id="styles"> - ${fastn_dom.getClassesAsStringWithoutStyleTag()} - </style>`; -}; - -fastn_dom.getClassesAsStringWithoutStyleTag = function () { - let classes = Object.entries(fastn_dom.classes).map((entry) => { - return getClassAsString(entry[0], entry[1]); - }); - - /*.ft_text { - padding: 0; - }*/ - return classes.join("\n\t"); -}; - -function getClassAsString(className, obj) { - if (typeof obj.value === "object" && obj.value !== null) { - let value = ""; - for (let key in obj.value) { - if (obj.value[key] === undefined || obj.value[key] === null) { - continue; - } - value = `${value} ${key}: ${obj.value[key]}${ - key === "color" ? " !important" : "" - };`; - } - return `${className} { ${value} }`; - } else { - return `${className} { ${obj.property}: ${obj.value}${ - obj.property === "color" ? " !important" : "" - }; }`; - } -} - -fastn_dom.ElementKind = { - Row: 0, - Column: 1, - Integer: 2, - Decimal: 3, - Boolean: 4, - Text: 5, - Image: 6, - IFrame: 7, - // To create parent for dynamic DOM - Comment: 8, - CheckBox: 9, - TextInput: 10, - ContainerElement: 11, - Rive: 12, - Document: 13, - Wrapper: 14, - Code: 15, - // Note: This is called internally, it gives `code` as tagName. This is used - // along with the Code: 15. - CodeChild: 16, - // Note: 'arguments' cant be used as function parameter name bcoz it has - // internal usage in js functions. - WebComponent: (webcomponent, args) => { - return [17, [webcomponent, args]]; - }, - Video: 18, -}; - -fastn_dom.PropertyKind = { - Color: 0, - IntegerValue: 1, - StringValue: 2, - DecimalValue: 3, - BooleanValue: 4, - Width: 5, - Padding: 6, - Height: 7, - Id: 8, - BorderWidth: 9, - BorderStyle: 10, - Margin: 11, - Background: 12, - PaddingHorizontal: 13, - PaddingVertical: 14, - PaddingLeft: 15, - PaddingRight: 16, - PaddingTop: 17, - PaddingBottom: 18, - MarginHorizontal: 19, - MarginVertical: 20, - MarginLeft: 21, - MarginRight: 22, - MarginTop: 23, - MarginBottom: 24, - Role: 25, - ZIndex: 26, - Sticky: 27, - Top: 28, - Bottom: 29, - Left: 30, - Right: 31, - Overflow: 32, - OverflowX: 33, - OverflowY: 34, - Spacing: 35, - Wrap: 36, - TextTransform: 37, - TextIndent: 38, - TextAlign: 39, - LineClamp: 40, - Opacity: 41, - Cursor: 42, - Resize: 43, - MinHeight: 44, - MaxHeight: 45, - MinWidth: 46, - MaxWidth: 47, - WhiteSpace: 48, - BorderTopWidth: 49, - BorderBottomWidth: 50, - BorderLeftWidth: 51, - BorderRightWidth: 52, - BorderRadius: 53, - BorderTopLeftRadius: 54, - BorderTopRightRadius: 55, - BorderBottomLeftRadius: 56, - BorderBottomRightRadius: 57, - BorderStyleVertical: 58, - BorderStyleHorizontal: 59, - BorderLeftStyle: 60, - BorderRightStyle: 61, - BorderTopStyle: 62, - BorderBottomStyle: 63, - BorderColor: 64, - BorderLeftColor: 65, - BorderRightColor: 66, - BorderTopColor: 67, - BorderBottomColor: 68, - AlignSelf: 69, - Classes: 70, - Anchor: 71, - Link: 72, - Children: 73, - OpenInNewTab: 74, - TextStyle: 75, - Region: 76, - AlignContent: 77, - Display: 78, - Checked: 79, - Enabled: 80, - TextInputType: 81, - Placeholder: 82, - Multiline: 83, - DefaultTextInputValue: 84, - Loading: 85, - Src: 86, - YoutubeSrc: 87, - Code: 88, - ImageSrc: 89, - Alt: 90, - DocumentProperties: { - MetaTitle: 91, - MetaOGTitle: 92, - MetaTwitterTitle: 93, - MetaDescription: 94, - MetaOGDescription: 95, - MetaTwitterDescription: 96, - MetaOGImage: 97, - MetaTwitterImage: 98, - MetaThemeColor: 99, - MetaFacebookDomainVerification: 123, - }, - Shadow: 100, - CodeTheme: 101, - CodeLanguage: 102, - CodeShowLineNumber: 103, - Css: 104, - Js: 105, - LinkRel: 106, - InputMaxLength: 107, - Favicon: 108, - Fit: 109, - VideoSrc: 110, - Autoplay: 111, - Poster: 112, - LoopVideo: 113, - Controls: 114, - Muted: 115, - LinkColor: 116, - TextShadow: 117, - Selectable: 118, - BackdropFilter: 119, - Mask: 120, - TextInputValue: 121, - FetchPriority: 122, -}; - -fastn_dom.Loading = { - Lazy: "lazy", - Eager: "eager", -}; - -fastn_dom.LinkRel = { - NoFollow: "nofollow", - Sponsored: "sponsored", - Ugc: "ugc", -}; - -fastn_dom.TextInputType = { - Text: "text", - Email: "email", - Password: "password", - Url: "url", - DateTime: "datetime", - Date: "date", - Time: "time", - Month: "month", - Week: "week", - Color: "color", - File: "file", -}; - -fastn_dom.AlignContent = { - TopLeft: "top-left", - TopCenter: "top-center", - TopRight: "top-right", - Right: "right", - Left: "left", - Center: "center", - BottomLeft: "bottom-left", - BottomRight: "bottom-right", - BottomCenter: "bottom-center", -}; - -fastn_dom.Region = { - H1: "h1", - H2: "h2", - H3: "h3", - H4: "h4", - H5: "h5", - H6: "h6", -}; - -fastn_dom.Anchor = { - Window: [1, "fixed"], - Parent: [2, "absolute"], - Id: (value) => { - return [3, value]; - }, -}; - -fastn_dom.DeviceData = { - Desktop: "desktop", - Mobile: "mobile", -}; - -fastn_dom.TextStyle = { - Underline: "underline", - Italic: "italic", - Strike: "line-through", - Heavy: "900", - Extrabold: "800", - Bold: "700", - SemiBold: "600", - Medium: "500", - Regular: "400", - Light: "300", - ExtraLight: "200", - Hairline: "100", -}; - -fastn_dom.Resizing = { - FillContainer: "100%", - HugContent: "fit-content", - Auto: "auto", - Fixed: (value) => { - return value; - }, -}; - -fastn_dom.Spacing = { - SpaceEvenly: [1, "space-evenly"], - SpaceBetween: [2, "space-between"], - SpaceAround: [3, "space-around"], - Fixed: (value) => { - return [4, value]; - }, -}; - -fastn_dom.BorderStyle = { - Solid: "solid", - Dashed: "dashed", - Dotted: "dotted", - Double: "double", - Ridge: "ridge", - Groove: "groove", - Inset: "inset", - Outset: "outset", -}; - -fastn_dom.Fit = { - none: "none", - fill: "fill", - contain: "contain", - cover: "cover", - scaleDown: "scale-down", -}; - -fastn_dom.FetchPriority = { - auto: "auto", - high: "high", - low: "low", -}; - -fastn_dom.Overflow = { - Scroll: "scroll", - Visible: "visible", - Hidden: "hidden", - Auto: "auto", -}; - -fastn_dom.Display = { - Block: "block", - Inline: "inline", - InlineBlock: "inline-block", -}; - -fastn_dom.AlignSelf = { - Start: "start", - Center: "center", - End: "end", -}; - -fastn_dom.TextTransform = { - None: "none", - Capitalize: "capitalize", - Uppercase: "uppercase", - Lowercase: "lowercase", - Inherit: "inherit", - Initial: "initial", -}; - -fastn_dom.TextAlign = { - Start: "start", - Center: "center", - End: "end", - Justify: "justify", -}; - -fastn_dom.Cursor = { - None: "none", - Default: "default", - ContextMenu: "context-menu", - Help: "help", - Pointer: "pointer", - Progress: "progress", - Wait: "wait", - Cell: "cell", - CrossHair: "crosshair", - Text: "text", - VerticalText: "vertical-text", - Alias: "alias", - Copy: "copy", - Move: "move", - NoDrop: "no-drop", - NotAllowed: "not-allowed", - Grab: "grab", - Grabbing: "grabbing", - EResize: "e-resize", - NResize: "n-resize", - NeResize: "ne-resize", - SResize: "s-resize", - SeResize: "se-resize", - SwResize: "sw-resize", - Wresize: "w-resize", - Ewresize: "ew-resize", - NsResize: "ns-resize", - NeswResize: "nesw-resize", - NwseResize: "nwse-resize", - ColResize: "col-resize", - RowResize: "row-resize", - AllScroll: "all-scroll", - ZoomIn: "zoom-in", - ZoomOut: "zoom-out", -}; - -fastn_dom.Resize = { - Vertical: "vertical", - Horizontal: "horizontal", - Both: "both", -}; - -fastn_dom.WhiteSpace = { - Normal: "normal", - NoWrap: "nowrap", - Pre: "pre", - PreLine: "pre-line", - PreWrap: "pre-wrap", - BreakSpaces: "break-spaces", -}; - -fastn_dom.BackdropFilter = { - Blur: (value) => { - return [1, value]; - }, - Brightness: (value) => { - return [2, value]; - }, - Contrast: (value) => { - return [3, value]; - }, - Grayscale: (value) => { - return [4, value]; - }, - Invert: (value) => { - return [5, value]; - }, - Opacity: (value) => { - return [6, value]; - }, - Sepia: (value) => { - return [7, value]; - }, - Saturate: (value) => { - return [8, value]; - }, - Multi: (value) => { - return [9, value]; - }, -}; - -fastn_dom.BackgroundStyle = { - Solid: (value) => { - return [1, value]; - }, - Image: (value) => { - return [2, value]; - }, - LinearGradient: (value) => { - return [3, value]; - }, -}; - -fastn_dom.BackgroundRepeat = { - Repeat: "repeat", - RepeatX: "repeat-x", - RepeatY: "repeat-y", - NoRepeat: "no-repeat", - Space: "space", - Round: "round", -}; - -fastn_dom.BackgroundSize = { - Auto: "auto", - Cover: "cover", - Contain: "contain", - Length: (value) => { - return value; - }, -}; - -fastn_dom.BackgroundPosition = { - Left: "left", - Right: "right", - Center: "center", - LeftTop: "left top", - LeftCenter: "left center", - LeftBottom: "left bottom", - CenterTop: "center top", - CenterCenter: "center center", - CenterBottom: "center bottom", - RightTop: "right top", - RightCenter: "right center", - RightBottom: "right bottom", - Length: (value) => { - return value; - }, -}; - -fastn_dom.LinearGradientDirection = { - Angle: (value) => { - return `${value}deg`; - }, - Turn: (value) => { - return `${value}turn`; - }, - Left: "270deg", - Right: "90deg", - Top: "0deg", - Bottom: "180deg", - TopLeft: "315deg", - TopRight: "45deg", - BottomLeft: "225deg", - BottomRight: "135deg", -}; - -fastn_dom.FontSize = { - Px: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${value.get()}px`; - }); - } - return `${value}px`; - }, - Em: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${value.get()}em`; - }); - } - return `${value}em`; - }, - Rem: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${value.get()}rem`; - }); - } - return `${value}rem`; - }, -}; - -fastn_dom.Length = { - Px: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}px`; - }); - } - return `${value}px`; - }, - Em: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}em`; - }); - } - return `${value}em`; - }, - Rem: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}rem`; - }); - } - return `${value}rem`; - }, - Percent: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}%`; - }); - } - return `${value}%`; - }, - Calc: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `calc(${fastn_utils.getStaticValue(value)})`; - }); - } - return `calc(${value})`; - }, - Vh: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}vh`; - }); - } - return `${value}vh`; - }, - Vw: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}vw`; - }); - } - return `${value}vw`; - }, - Dvh: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}dvh`; - }); - } - return `${value}dvh`; - }, - Lvh: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}lvh`; - }); - } - return `${value}lvh`; - }, - Svh: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}svh`; - }); - } - return `${value}svh`; - }, - - Vmin: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}vmin`; - }); - } - return `${value}vmin`; - }, - Vmax: (value) => { - if (value instanceof fastn.mutableClass) { - return fastn.formula([value], function () { - return `${fastn_utils.getStaticValue(value)}vmax`; - }); - } - return `${value}vmax`; - }, - Responsive: (length) => { - return new PropertyValueAsClosure(() => { - if (ftd.device.get() === "desktop") { - return length.get("desktop"); - } else { - let mobile = length.get("mobile"); - let desktop = length.get("desktop"); - return mobile ? mobile : desktop; - } - }, [ftd.device, length]); - }, -}; - -fastn_dom.Mask = { - Image: (value) => { - return [1, value]; - }, - Multi: (value) => { - return [2, value]; - }, -}; - -fastn_dom.MaskSize = { - Auto: "auto", - Cover: "cover", - Contain: "contain", - Fixed: (value) => { - return value; - }, -}; - -fastn_dom.MaskRepeat = { - Repeat: "repeat", - RepeatX: "repeat-x", - RepeatY: "repeat-y", - NoRepeat: "no-repeat", - Space: "space", - Round: "round", -}; - -fastn_dom.MaskPosition = { - Left: "left", - Right: "right", - Center: "center", - LeftTop: "left top", - LeftCenter: "left center", - LeftBottom: "left bottom", - CenterTop: "center top", - CenterCenter: "center center", - CenterBottom: "center bottom", - RightTop: "right top", - RightCenter: "right center", - RightBottom: "right bottom", - Length: (value) => { - return value; - }, -}; - -fastn_dom.Event = { - Click: 0, - MouseEnter: 1, - MouseLeave: 2, - ClickOutside: 3, - GlobalKey: (val) => { - return [4, val]; - }, - GlobalKeySeq: (val) => { - return [5, val]; - }, - Input: 6, - Change: 7, - Blur: 8, - Focus: 9, -}; - -class PropertyValueAsClosure { - closureFunction; - deps; - constructor(closureFunction, deps) { - this.closureFunction = closureFunction; - this.deps = deps; - } -} - -// Node2 -> Intermediate node -// Node -> similar to HTML DOM node (Node2.#node) -class Node2 { - #node; - #kind; - #parent; - #tagName; - #rawInnerValue; - /** - * This is where we store all the attached closures, so we can free them - * when we are done. - */ - #mutables; - /** - * This is where we store the extraData related to node. This is - * especially useful to store data for integrated external library (like - * rive). - */ - #extraData; - #children; - constructor(parentOrSibiling, kind) { - this.#kind = kind; - this.#parent = parentOrSibiling; - this.#children = []; - this.#rawInnerValue = null; - - let sibiling = undefined; - - if (parentOrSibiling instanceof ParentNodeWithSibiling) { - this.#parent = parentOrSibiling.getParent(); - while (this.#parent instanceof ParentNodeWithSibiling) { - this.#parent = this.#parent.getParent(); - } - sibiling = parentOrSibiling.getSibiling(); - } - - this.createNode(kind); - - this.#mutables = []; - this.#extraData = {}; - /*if (!!parent.parent) { - parent = parent.parent(); - }*/ - - if (this.#parent.getNode) { - this.#parent = this.#parent.getNode(); - } - - if (fastn_utils.isWrapperNode(this.#tagName)) { - this.#parent = parentOrSibiling; - return; - } - if (sibiling) { - this.#parent.insertBefore( - this.#node, - fastn_utils.nextSibling(sibiling, this.#parent), - ); - } else { - this.#parent.appendChild(this.#node); - } - } - createNode(kind) { - if (kind === fastn_dom.ElementKind.Code) { - let [node, classes, attributes] = fastn_utils.htmlNode(kind); - [this.#tagName, this.#node] = fastn_utils.createNodeHelper( - node, - classes, - attributes, - ); - let codeNode = new Node2( - this.#node, - fastn_dom.ElementKind.CodeChild, - ); - this.#children.push(codeNode); - } else { - let [node, classes, attributes] = fastn_utils.htmlNode(kind); - [this.#tagName, this.#node] = fastn_utils.createNodeHelper( - node, - classes, - attributes, - ); - } - } - getTagName() { - return this.#tagName; - } - getParent() { - return this.#parent; - } - removeAllFaviconLinks() { - if (doubleBuffering) { - const links = document.head.querySelectorAll( - 'link[rel="shortcut icon"]', - ); - links.forEach((link) => { - link.parentNode.removeChild(link); - }); - } - } - setFavicon(url) { - if (doubleBuffering) { - if (url instanceof fastn.recordInstanceClass) url = url.get("src"); - while (true) { - if (url instanceof fastn.mutableClass) url = url.get(); - else break; - } - - let link_element = document.createElement("link"); - link_element.rel = "shortcut icon"; - link_element.href = url; - - this.removeAllFaviconLinks(); - document.head.appendChild(link_element); - } - } - updateTextInputValue() { - if (fastn_utils.isNull(this.#rawInnerValue)) { - this.attachAttribute("value"); - return; - } - if (!ssr && this.#node.tagName.toLowerCase() === "textarea") { - this.#node.innerHTML = this.#rawInnerValue; - } else { - this.attachAttribute("value", this.#rawInnerValue); - } - } - // for attaching inline attributes - attachAttribute(property, value) { - // If the value is null, undefined, or false, the attribute will be removed. - // For example, if attributes like checked, muted, or autoplay have been assigned a "false" value. - if (fastn_utils.isNull(value)) { - this.#node.removeAttribute(property); - return; - } - this.#node.setAttribute(property, value); - } - removeAttribute(property) { - this.#node.removeAttribute(property); - } - updateTagName(name) { - if (ssr) { - this.#node.updateTagName(name); - } else { - let newElement = document.createElement(name); - newElement.innerHTML = this.#node.innerHTML; - newElement.className = this.#node.className; - newElement.style = this.#node.style; - for (var i = 0; i < this.#node.attributes.length; i++) { - var attr = this.#node.attributes[i]; - newElement.setAttribute(attr.name, attr.value); - } - var eventListeners = fastn_utils.getEventListeners(this.#node); - for (var eventType in eventListeners) { - newElement[eventType] = eventListeners[eventType]; - } - this.#parent.replaceChild(newElement, this.#node); - this.#node = newElement; - } - } - updateToAnchor(url) { - let node_kind = this.#kind; - if (ssr) { - if (node_kind !== fastn_dom.ElementKind.Image) { - this.updateTagName("a"); - this.attachAttribute("href", url); - } - return; - } - if (node_kind === fastn_dom.ElementKind.Image) { - let anchorElement = document.createElement("a"); - anchorElement.href = url; - anchorElement.appendChild(this.#node); - this.#parent.appendChild(anchorElement); - this.#node = anchorElement; - } else { - this.updateTagName("a"); - this.#node.href = url; - } - } - updatePositionForNodeById(node_id, value) { - if (!ssr) { - const target_node = fastnVirtual.root.querySelector( - `[id="${node_id}"]`, - ); - if (!fastn_utils.isNull(target_node)) - target_node.style["position"] = value; - } - } - updateParentPosition(value) { - if (ssr) { - let parent = this.#parent; - if (parent.style) parent.style["position"] = value; - } - if (!ssr) { - let current_node = this.#node; - if (current_node) { - let parent_node = current_node.parentNode; - parent_node.style["position"] = value; - } - } - } - updateMetaTitle(value) { - if (!ssr && doubleBuffering) { - if (!fastn_utils.isNull(value)) window.document.title = value; - } - } - addMetaTagByName(name, value) { - if (value === null || value === undefined) { - this.removeMetaTagByName(name); - return; - } - if (!ssr && doubleBuffering) { - const metaTag = window.document.createElement("meta"); - metaTag.setAttribute("name", name); - metaTag.setAttribute("content", value); - document.head.appendChild(metaTag); - } - } - addMetaTagByProperty(property, value) { - if (value === null || value === undefined) { - this.removeMetaTagByProperty(property); - return; - } - if (!ssr && doubleBuffering) { - const metaTag = window.document.createElement("meta"); - metaTag.setAttribute("property", property); - metaTag.setAttribute("content", value); - document.head.appendChild(metaTag); - } - } - removeMetaTagByName(name) { - if (!ssr && doubleBuffering) { - const metaTags = document.getElementsByTagName("meta"); - for (let i = 0; i < metaTags.length; i++) { - const metaTag = metaTags[i]; - if (metaTag.getAttribute("name") === name) { - metaTag.remove(); - break; - } - } - } - } - removeMetaTagByProperty(property) { - if (!ssr && doubleBuffering) { - const metaTags = document.getElementsByTagName("meta"); - for (let i = 0; i < metaTags.length; i++) { - const metaTag = metaTags[i]; - if (metaTag.getAttribute("property") === property) { - metaTag.remove(); - break; - } - } - } - } - // dynamic-class-css - attachCss(property, value, createClass, className) { - let propertyShort = fastn_dom.propertyMap[property] || property; - propertyShort = `__${propertyShort}`; - let cls = `${propertyShort}-${fastn_dom.class_count}`; - if (!!className) { - cls = className; - } else { - if (!fastn_dom.unsanitised_classes[cls]) { - fastn_dom.unsanitised_classes[cls] = ++fastn_dom.class_count; - } - cls = `${propertyShort}-${fastn_dom.unsanitised_classes[cls]}`; - } - let cssClass = className ? cls : `.${cls}`; - - const obj = { property, value }; - - if (value === undefined) { - if (!ssr) { - for (const className of this.#node.classList.values()) { - if (className.startsWith(`${propertyShort}-`)) { - this.#node.classList.remove(className); - } - } - this.#node.style[property] = null; - } - return cls; - } - - if (!ssr && !doubleBuffering) { - if (!!className) { - if (!fastn_dom.classes[cssClass]) { - fastn_dom.classes[cssClass] = - fastn_dom.classes[cssClass] || obj; - fastn_utils.createStyle(cssClass, obj); - } - return cls; - } - - for (const className of this.#node.classList.values()) { - if (className.startsWith(`${propertyShort}-`)) { - this.#node.classList.remove(className); - } - } - - if (createClass) { - if (!fastn_dom.classes[cssClass]) { - fastn_dom.classes[cssClass] = - fastn_dom.classes[cssClass] || obj; - fastn_utils.createStyle(cssClass, obj); - } - this.#node.style.removeProperty(property); - this.#node.classList.add(cls); - } else if (!fastn_dom.classes[cssClass]) { - if (typeof value === "object" && value !== null) { - for (let key in value) { - this.#node.style[key] = value[key]; - } - } else { - this.#node.style[property] = value; - } - } else { - this.#node.style.removeProperty(property); - this.#node.classList.add(cls); - } - - return cls; - } - - fastn_dom.classes[cssClass] = fastn_dom.classes[cssClass] || obj; - - if (!!className) { - return cls; - } - - this.#node.classList.add(cls); - return cls; - } - attachShadow(value) { - if (fastn_utils.isNull(value)) { - this.attachCss("box-shadow", value); - return; - } - - const color = value.get("color"); - - const lightColor = fastn_utils.getStaticValue(color.get("light")); - const darkColor = fastn_utils.getStaticValue(color.get("dark")); - - const blur = fastn_utils.getStaticValue(value.get("blur")); - const xOffset = fastn_utils.getStaticValue(value.get("x_offset")); - const yOffset = fastn_utils.getStaticValue(value.get("y_offset")); - const spread = fastn_utils.getStaticValue(value.get("spread")); - const inset = fastn_utils.getStaticValue(value.get("inset")); - - const shadowCommonCss = `${ - inset ? "inset " : "" - }${xOffset} ${yOffset} ${blur} ${spread}`; - const lightShadowCss = `${shadowCommonCss} ${lightColor}`; - const darkShadowCss = `${shadowCommonCss} ${darkColor}`; - - if (lightShadowCss === darkShadowCss) { - this.attachCss("box-shadow", lightShadowCss, false); - } else { - let lightClass = this.attachCss("box-shadow", lightShadowCss, true); - this.attachCss( - "box-shadow", - darkShadowCss, - true, - `body.dark .${lightClass}`, - ); - } - } - attachBackdropMultiFilter(value) { - const filters = { - blur: fastn_utils.getStaticValue(value.get("blur")), - brightness: fastn_utils.getStaticValue(value.get("brightness")), - contrast: fastn_utils.getStaticValue(value.get("contrast")), - grayscale: fastn_utils.getStaticValue(value.get("grayscale")), - invert: fastn_utils.getStaticValue(value.get("invert")), - opacity: fastn_utils.getStaticValue(value.get("opacity")), - sepia: fastn_utils.getStaticValue(value.get("sepia")), - saturate: fastn_utils.getStaticValue(value.get("saturate")), - }; - - const filterString = Object.entries(filters) - .filter(([_, value]) => !fastn_utils.isNull(value)) - .map(([name, value]) => `${name}(${value})`) - .join(" "); - - this.attachCss("backdrop-filter", filterString, false); - } - attachTextShadow(value) { - if (fastn_utils.isNull(value)) { - this.attachCss("text-shadow", value); - return; - } - - const color = value.get("color"); - - const lightColor = fastn_utils.getStaticValue(color.get("light")); - const darkColor = fastn_utils.getStaticValue(color.get("dark")); - - const blur = fastn_utils.getStaticValue(value.get("blur")); - const xOffset = fastn_utils.getStaticValue(value.get("x_offset")); - const yOffset = fastn_utils.getStaticValue(value.get("y_offset")); - - const shadowCommonCss = `${xOffset} ${yOffset} ${blur}`; - const lightShadowCss = `${shadowCommonCss} ${lightColor}`; - const darkShadowCss = `${shadowCommonCss} ${darkColor}`; - - if (lightShadowCss === darkShadowCss) { - this.attachCss("text-shadow", lightShadowCss, false); - } else { - let lightClass = this.attachCss("box-shadow", lightShadowCss, true); - this.attachCss( - "text-shadow", - darkShadowCss, - true, - `body.dark .${lightClass}`, - ); - } - } - getLinearGradientString(value) { - var lightGradientString = ""; - var darkGradientString = ""; - - let colorsList = value.get("colors").get().getList(); - colorsList.map(function (element) { - // LinearGradient RecordInstance - let lg_color = element.item; - - let color = lg_color.get("color").get(); - let lightColor = fastn_utils.getStaticValue(color.get("light")); - let darkColor = fastn_utils.getStaticValue(color.get("dark")); - - lightGradientString = `${lightGradientString} ${lightColor}`; - darkGradientString = `${darkGradientString} ${darkColor}`; - - let start = fastn_utils.getStaticValue(lg_color.get("start")); - if (start !== undefined && start !== null) { - lightGradientString = `${lightGradientString} ${start}`; - darkGradientString = `${darkGradientString} ${start}`; - } - - let end = fastn_utils.getStaticValue(lg_color.get("end")); - if (end !== undefined && end !== null) { - lightGradientString = `${lightGradientString} ${end}`; - darkGradientString = `${darkGradientString} ${end}`; - } - - let stop_position = fastn_utils.getStaticValue( - lg_color.get("stop_position"), - ); - if (stop_position !== undefined && stop_position !== null) { - lightGradientString = `${lightGradientString}, ${stop_position}`; - darkGradientString = `${darkGradientString}, ${stop_position}`; - } - - lightGradientString = `${lightGradientString},`; - darkGradientString = `${darkGradientString},`; - }); - - lightGradientString = lightGradientString.trim().slice(0, -1); - darkGradientString = darkGradientString.trim().slice(0, -1); - - return [lightGradientString, darkGradientString]; - } - attachLinearGradientCss(value) { - if (fastn_utils.isNull(value)) { - this.attachCss("background-image", value); - return; - } - - const closure = fastn - .closure(() => { - let direction = fastn_utils.getStaticValue( - value.get("direction"), - ); - - const [lightGradientString, darkGradientString] = - this.getLinearGradientString(value); - - if (lightGradientString === darkGradientString) { - this.attachCss( - "background-image", - `linear-gradient(${direction}, ${lightGradientString})`, - false, - ); - } else { - let lightClass = this.attachCss( - "background-image", - `linear-gradient(${direction}, ${lightGradientString})`, - true, - ); - this.attachCss( - "background-image", - `linear-gradient(${direction}, ${darkGradientString})`, - true, - `body.dark .${lightClass}`, - ); - } - }) - .addNodeProperty(this, null, inherited); - - const colorsList = value.get("colors").get().getList(); - - colorsList.forEach(({ item }) => { - const color = item.get("color"); - - [color.get("light"), color.get("dark")].forEach((variant) => { - variant.addClosure(closure); - this.#mutables.push(variant); - }); - }); - } - attachBackgroundImageCss(value) { - if (fastn_utils.isNull(value)) { - this.attachCss("background-repeat", value); - this.attachCss("background-position", value); - this.attachCss("background-size", value); - this.attachCss("background-image", value); - return; - } - - let src = fastn_utils.getStaticValue(value.get("src")); - let lightValue = fastn_utils.getStaticValue(src.get("light")); - let darkValue = fastn_utils.getStaticValue(src.get("dark")); - - let position = fastn_utils.getStaticValue(value.get("position")); - let positionX = null; - let positionY = null; - if (position !== null && position instanceof Object) { - positionX = fastn_utils.getStaticValue(position.get("x")); - positionY = fastn_utils.getStaticValue(position.get("y")); - - if (positionX !== null) position = `${positionX}`; - if (positionY !== null) { - if (positionX === null) position = `0px ${positionY}`; - else position = `${position} ${positionY}`; - } - } - let repeat = fastn_utils.getStaticValue(value.get("repeat")); - let size = fastn_utils.getStaticValue(value.get("size")); - let sizeX = null; - let sizeY = null; - if (size !== null && size instanceof Object) { - sizeX = fastn_utils.getStaticValue(size.get("x")); - sizeY = fastn_utils.getStaticValue(size.get("y")); - - if (sizeX !== null) size = `${sizeX}`; - if (sizeY !== null) { - if (sizeX === null) size = `0px ${sizeY}`; - else size = `${size} ${sizeY}`; - } - } - - if (repeat !== null) this.attachCss("background-repeat", repeat); - if (position !== null) this.attachCss("background-position", position); - if (size !== null) this.attachCss("background-size", size); - - if (lightValue === darkValue) { - this.attachCss("background-image", `url(${lightValue})`, false); - } else { - let lightClass = this.attachCss( - "background-image", - `url(${lightValue})`, - true, - ); - this.attachCss( - "background-image", - `url(${darkValue})`, - true, - `body.dark .${lightClass}`, - ); - } - } - attachMaskImageCss(value, vendorPrefix) { - const propertyWithPrefix = vendorPrefix - ? `${vendorPrefix}-mask-image` - : "mask-image"; - - if (fastn_utils.isNull(value)) { - this.attachCss(propertyWithPrefix, value); - return; - } - - let src = fastn_utils.getStaticValue(value.get("src")); - let linearGradient = fastn_utils.getStaticValue( - value.get("linear_gradient"), - ); - let color = fastn_utils.getStaticValue(value.get("color")); - - const maskLightImageValues = []; - const maskDarkImageValues = []; - - if (!fastn_utils.isNull(src)) { - let lightValue = fastn_utils.getStaticValue(src.get("light")); - let darkValue = fastn_utils.getStaticValue(src.get("dark")); - - const lightUrl = `url(${lightValue})`; - const darkUrl = `url(${darkValue})`; - - if (!fastn_utils.isNull(linearGradient)) { - const lightImageValues = [lightUrl]; - const darkImageValues = [darkUrl]; - - if (!fastn_utils.isNull(color)) { - const lightColor = fastn_utils.getStaticValue( - color.get("light"), - ); - const darkColor = fastn_utils.getStaticValue( - color.get("dark"), - ); - - lightImageValues.push(lightColor); - darkImageValues.push(darkColor); - } - maskLightImageValues.push( - `image(${lightImageValues.join(", ")})`, - ); - maskDarkImageValues.push( - `image(${darkImageValues.join(", ")})`, - ); - } else { - maskLightImageValues.push(lightUrl); - maskDarkImageValues.push(darkUrl); - } - } - - if (!fastn_utils.isNull(linearGradient)) { - let direction = fastn_utils.getStaticValue( - linearGradient.get("direction"), - ); - - const [lightGradientString, darkGradientString] = - this.getLinearGradientString(linearGradient); - - maskLightImageValues.push( - `linear-gradient(${direction}, ${lightGradientString})`, - ); - maskDarkImageValues.push( - `linear-gradient(${direction}, ${darkGradientString})`, - ); - } - - const maskLightImageString = maskLightImageValues.join(", "); - const maskDarkImageString = maskDarkImageValues.join(", "); - - if (maskLightImageString === maskDarkImageString) { - this.attachCss(propertyWithPrefix, maskLightImageString, true); - } else { - let lightClass = this.attachCss( - propertyWithPrefix, - maskLightImageString, - true, - ); - this.attachCss( - propertyWithPrefix, - maskDarkImageString, - true, - `body.dark .${lightClass}`, - ); - } - } - attachMaskSizeCss(value, vendorPrefix) { - const propertyNameWithPrefix = vendorPrefix - ? `${vendorPrefix}-mask-size` - : "mask-size"; - if (fastn_utils.isNull(value)) { - this.attachCss(propertyNameWithPrefix, value); - } - const [size, ...two_values] = ["size", "size_x", "size_y"].map((size) => - fastn_utils.getStaticValue(value.get(size)), - ); - - if (!fastn_utils.isNull(size)) { - this.attachCss(propertyNameWithPrefix, size, true); - } else { - const [size_x, size_y] = two_values.map((value) => value || "auto"); - this.attachCss(propertyNameWithPrefix, `${size_x} ${size_y}`, true); - } - } - attachMaskMultiCss(value, vendorPrefix) { - if (fastn_utils.isNull(value)) { - this.attachCss("mask-repeat", value); - this.attachCss("mask-position", value); - this.attachCss("mask-size", value); - this.attachCss("mask-image", value); - return; - } - - const maskImage = fastn_utils.getStaticValue(value.get("image")); - this.attachMaskImageCss(maskImage); - this.attachMaskImageCss(maskImage, vendorPrefix); - this.attachMaskSizeCss(value); - this.attachMaskSizeCss(value, vendorPrefix); - const maskRepeatValue = fastn_utils.getStaticValue(value.get("repeat")); - if (fastn_utils.isNull(maskRepeatValue)) { - this.attachCss("mask-repeat", maskRepeatValue, true); - this.attachCss("-webkit-mask-repeat", maskRepeatValue, true); - } else { - this.attachCss("mask-repeat", maskRepeatValue, true); - this.attachCss("-webkit-mask-repeat", maskRepeatValue, true); - } - const maskPositionValue = fastn_utils.getStaticValue( - value.get("position"), - ); - if (fastn_utils.isNull(maskPositionValue)) { - this.attachCss("mask-position", maskPositionValue, true); - this.attachCss("-webkit-mask-position", maskPositionValue, true); - } else { - this.attachCss("mask-position", maskPositionValue, true); - this.attachCss("-webkit-mask-position", maskPositionValue, true); - } - } - attachExternalCss(css) { - if (!ssr) { - let css_tag = document.createElement("link"); - css_tag.rel = "stylesheet"; - css_tag.type = "text/css"; - css_tag.href = css; - - let head = - document.head || document.getElementsByTagName("head")[0]; - if (!fastn_dom.externalCss.has(css)) { - head.appendChild(css_tag); - fastn_dom.externalCss.add(css); - } - } - } - attachExternalJs(js) { - if (!ssr) { - let js_tag = document.createElement("script"); - js_tag.src = js; - - let head = - document.head || document.getElementsByTagName("head")[0]; - if (!fastn_dom.externalJs.has(js)) { - head.appendChild(js_tag); - fastn_dom.externalCss.add(js); - } - } - } - attachColorCss(property, value, visited) { - if (fastn_utils.isNull(value)) { - this.attachCss(property, value); - return; - } - value = value instanceof fastn.mutableClass ? value.get() : value; - - const lightValue = value.get("light"); - const darkValue = value.get("dark"); - - const closure = fastn - .closure(() => { - let lightValueStatic = fastn_utils.getStaticValue(lightValue); - let darkValueStatic = fastn_utils.getStaticValue(darkValue); - - if (lightValueStatic === darkValueStatic) { - this.attachCss(property, lightValueStatic, false); - } else { - let lightClass = this.attachCss( - property, - lightValueStatic, - true, - ); - this.attachCss( - property, - darkValueStatic, - true, - `body.dark .${lightClass}`, - ); - if (visited) { - this.attachCss( - property, - lightValueStatic, - true, - `.${lightClass}:visited`, - ); - this.attachCss( - property, - darkValueStatic, - true, - `body.dark .${lightClass}:visited`, - ); - } - } - }) - .addNodeProperty(this, null, inherited); - - [lightValue, darkValue].forEach((modeValue) => { - modeValue.addClosure(closure); - this.#mutables.push(modeValue); - }); - } - attachRoleCss(value) { - if (fastn_utils.isNull(value)) { - this.attachCss("role", value); - return; - } - value.addClosure( - fastn - .closure(() => { - let desktopValue = value.get("desktop"); - let mobileValue = value.get("mobile"); - if ( - fastn_utils.sameResponsiveRole( - desktopValue, - mobileValue, - ) - ) { - this.attachCss( - "role", - fastn_utils.getRoleValues(desktopValue), - true, - ); - } else { - let desktopClass = this.attachCss( - "role", - fastn_utils.getRoleValues(desktopValue), - true, - ); - this.attachCss( - "role", - fastn_utils.getRoleValues(mobileValue), - true, - `body.mobile .${desktopClass}`, - ); - } - }) - .addNodeProperty(this, null, inherited), - ); - this.#mutables.push(value); - } - attachTextStyles(styles) { - if (fastn_utils.isNull(styles)) { - this.attachCss("font-style", styles); - this.attachCss("font-weight", styles); - this.attachCss("text-decoration", styles); - return; - } - for (var s of styles) { - switch (s) { - case "italic": - this.attachCss("font-style", s); - break; - case "underline": - case "line-through": - this.attachCss("text-decoration", s); - break; - default: - this.attachCss("font-weight", s); - } - } - } - attachAlignContent(value, node_kind) { - if (fastn_utils.isNull(value)) { - this.attachCss("align-items", value); - this.attachCss("justify-content", value); - return; - } - if (node_kind === fastn_dom.ElementKind.Column) { - switch (value) { - case "top-left": - this.attachCss("justify-content", "start"); - this.attachCss("align-items", "start"); - break; - case "top-center": - this.attachCss("justify-content", "start"); - this.attachCss("align-items", "center"); - break; - case "top-right": - this.attachCss("justify-content", "start"); - this.attachCss("align-items", "end"); - break; - case "left": - this.attachCss("justify-content", "center"); - this.attachCss("align-items", "start"); - break; - case "center": - this.attachCss("justify-content", "center"); - this.attachCss("align-items", "center"); - break; - case "right": - this.attachCss("justify-content", "center"); - this.attachCss("align-items", "end"); - break; - case "bottom-left": - this.attachCss("justify-content", "end"); - this.attachCss("align-items", "left"); - break; - case "bottom-center": - this.attachCss("justify-content", "end"); - this.attachCss("align-items", "center"); - break; - case "bottom-right": - this.attachCss("justify-content", "end"); - this.attachCss("align-items", "end"); - break; - } - } - - if (node_kind === fastn_dom.ElementKind.Row) { - switch (value) { - case "top-left": - this.attachCss("justify-content", "start"); - this.attachCss("align-items", "start"); - break; - case "top-center": - this.attachCss("justify-content", "center"); - this.attachCss("align-items", "start"); - break; - case "top-right": - this.attachCss("justify-content", "end"); - this.attachCss("align-items", "start"); - break; - case "left": - this.attachCss("justify-content", "start"); - this.attachCss("align-items", "center"); - break; - case "center": - this.attachCss("justify-content", "center"); - this.attachCss("align-items", "center"); - break; - case "right": - this.attachCss("justify-content", "right"); - this.attachCss("align-items", "center"); - break; - case "bottom-left": - this.attachCss("justify-content", "start"); - this.attachCss("align-items", "end"); - break; - case "bottom-center": - this.attachCss("justify-content", "center"); - this.attachCss("align-items", "end"); - break; - case "bottom-right": - this.attachCss("justify-content", "end"); - this.attachCss("align-items", "end"); - break; - } - } - } - attachLinkColor(value) { - ftd.dark_mode.addClosure( - fastn - .closure(() => { - if (!ssr) { - const anchors = - this.#node.tagName.toLowerCase() === "a" - ? [this.#node] - : Array.from(this.#node.querySelectorAll("a")); - let propertyShort = `__${fastn_dom.propertyMap["link-color"]}`; - - if (fastn_utils.isNull(value)) { - anchors.forEach((a) => { - a.classList.values().forEach((className) => { - if ( - className.startsWith( - `${propertyShort}-`, - ) - ) { - a.classList.remove(className); - } - }); - }); - } else { - const lightValue = fastn_utils.getStaticValue( - value.get("light"), - ); - const darkValue = fastn_utils.getStaticValue( - value.get("dark"), - ); - let cls = `${propertyShort}-${JSON.stringify( - lightValue, - )}`; - - if (!fastn_dom.unsanitised_classes[cls]) { - fastn_dom.unsanitised_classes[cls] = - ++fastn_dom.class_count; - } - - cls = `${propertyShort}-${fastn_dom.unsanitised_classes[cls]}`; - - const cssClass = `.${cls}`; - - if (!fastn_dom.classes[cssClass]) { - const obj = { - property: "color", - value: lightValue, - }; - fastn_dom.classes[cssClass] = - fastn_dom.classes[cssClass] || obj; - let styles = document.getElementById("styles"); - styles.innerHTML = `${ - styles.innerHTML - }${getClassAsString(cssClass, obj)}\n`; - } - - if (lightValue !== darkValue) { - const obj = { - property: "color", - value: darkValue, - }; - let darkCls = `body.dark ${cssClass}`; - if (!fastn_dom.classes[darkCls]) { - fastn_dom.classes[darkCls] = - fastn_dom.classes[darkCls] || obj; - let styles = - document.getElementById("styles"); - styles.innerHTML = `${ - styles.innerHTML - }${getClassAsString(darkCls, obj)}\n`; - } - } - - anchors.forEach((a) => a.classList.add(cls)); - } - } - }) - .addNodeProperty(this, null, inherited), - ); - this.#mutables.push(ftd.dark_mode); - } - setStaticProperty(kind, value, inherited) { - // value can be either static or mutable - let staticValue = fastn_utils.getStaticValue(value); - if (kind === fastn_dom.PropertyKind.Children) { - if (fastn_utils.isWrapperNode(this.#tagName)) { - let parentWithSibiling = this.#parent; - if (Array.isArray(staticValue)) { - staticValue.forEach((func, index) => { - if (index !== 0) { - parentWithSibiling = new ParentNodeWithSibiling( - this.#parent.getParent(), - this.#children[index - 1], - ); - } - this.#children.push( - fastn_utils.getStaticValue(func.item)( - parentWithSibiling, - inherited, - ), - ); - }); - } else { - this.#children.push( - staticValue(parentWithSibiling, inherited), - ); - } - } else { - if (Array.isArray(staticValue)) { - staticValue.forEach((func) => - this.#children.push( - fastn_utils.getStaticValue(func.item)( - this, - inherited, - ), - ), - ); - } else { - this.#children.push(staticValue(this, inherited)); - } - } - } else if (kind === fastn_dom.PropertyKind.Id) { - this.#node.id = staticValue; - } else if (kind === fastn_dom.PropertyKind.BreakpointWidth) { - if (fastn_utils.isNull(staticValue)) { - return; - } - ftd.breakpoint_width.set(fastn_utils.getStaticValue(staticValue)); - } else if (kind === fastn_dom.PropertyKind.Css) { - let css_list = staticValue.map((obj) => - fastn_utils.getStaticValue(obj.item), - ); - css_list.forEach((css) => { - this.attachExternalCss(css); - }); - } else if (kind === fastn_dom.PropertyKind.Js) { - let js_list = staticValue.map((obj) => - fastn_utils.getStaticValue(obj.item), - ); - js_list.forEach((js) => { - this.attachExternalJs(js); - }); - } else if (kind === fastn_dom.PropertyKind.Width) { - this.attachCss("width", staticValue); - } else if (kind === fastn_dom.PropertyKind.Height) { - fastn_utils.resetFullHeight(); - this.attachCss("height", staticValue); - fastn_utils.setFullHeight(); - } else if (kind === fastn_dom.PropertyKind.Padding) { - this.attachCss("padding", staticValue); - } else if (kind === fastn_dom.PropertyKind.PaddingHorizontal) { - this.attachCss("padding-left", staticValue); - this.attachCss("padding-right", staticValue); - } else if (kind === fastn_dom.PropertyKind.PaddingVertical) { - this.attachCss("padding-top", staticValue); - this.attachCss("padding-bottom", staticValue); - } else if (kind === fastn_dom.PropertyKind.PaddingLeft) { - this.attachCss("padding-left", staticValue); - } else if (kind === fastn_dom.PropertyKind.PaddingRight) { - this.attachCss("padding-right", staticValue); - } else if (kind === fastn_dom.PropertyKind.PaddingTop) { - this.attachCss("padding-top", staticValue); - } else if (kind === fastn_dom.PropertyKind.PaddingBottom) { - this.attachCss("padding-bottom", staticValue); - } else if (kind === fastn_dom.PropertyKind.Margin) { - this.attachCss("margin", staticValue); - } else if (kind === fastn_dom.PropertyKind.MarginHorizontal) { - this.attachCss("margin-left", staticValue); - this.attachCss("margin-right", staticValue); - } else if (kind === fastn_dom.PropertyKind.MarginVertical) { - this.attachCss("margin-top", staticValue); - this.attachCss("margin-bottom", staticValue); - } else if (kind === fastn_dom.PropertyKind.MarginLeft) { - this.attachCss("margin-left", staticValue); - } else if (kind === fastn_dom.PropertyKind.MarginRight) { - this.attachCss("margin-right", staticValue); - } else if (kind === fastn_dom.PropertyKind.MarginTop) { - this.attachCss("margin-top", staticValue); - } else if (kind === fastn_dom.PropertyKind.MarginBottom) { - this.attachCss("margin-bottom", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderWidth) { - this.attachCss("border-width", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderTopWidth) { - this.attachCss("border-top-width", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderBottomWidth) { - this.attachCss("border-bottom-width", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderLeftWidth) { - this.attachCss("border-left-width", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderRightWidth) { - this.attachCss("border-right-width", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderRadius) { - this.attachCss("border-radius", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderTopLeftRadius) { - this.attachCss("border-top-left-radius", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderTopRightRadius) { - this.attachCss("border-top-right-radius", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderBottomLeftRadius) { - this.attachCss("border-bottom-left-radius", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderBottomRightRadius) { - this.attachCss("border-bottom-right-radius", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderStyle) { - this.attachCss("border-style", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderStyleVertical) { - this.attachCss("border-top-style", staticValue); - this.attachCss("border-bottom-style", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderStyleHorizontal) { - this.attachCss("border-left-style", staticValue); - this.attachCss("border-right-style", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderLeftStyle) { - this.attachCss("border-left-style", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderRightStyle) { - this.attachCss("border-right-style", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderTopStyle) { - this.attachCss("border-top-style", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderBottomStyle) { - this.attachCss("border-bottom-style", staticValue); - } else if (kind === fastn_dom.PropertyKind.ZIndex) { - this.attachCss("z-index", staticValue); - } else if (kind === fastn_dom.PropertyKind.Shadow) { - this.attachShadow(staticValue); - } else if (kind === fastn_dom.PropertyKind.TextShadow) { - this.attachTextShadow(staticValue); - } else if (kind === fastn_dom.PropertyKind.BackdropFilter) { - if (fastn_utils.isNull(staticValue)) { - this.attachCss("backdrop-filter", staticValue); - return; - } - - let backdropType = staticValue[0]; - switch (backdropType) { - case 1: - this.attachCss( - "backdrop-filter", - `blur(${fastn_utils.getStaticValue(staticValue[1])})`, - ); - break; - case 2: - this.attachCss( - "backdrop-filter", - `brightness(${fastn_utils.getStaticValue( - staticValue[1], - )})`, - ); - break; - case 3: - this.attachCss( - "backdrop-filter", - `contrast(${fastn_utils.getStaticValue( - staticValue[1], - )})`, - ); - break; - case 4: - this.attachCss( - "backdrop-filter", - `greyscale(${fastn_utils.getStaticValue( - staticValue[1], - )})`, - ); - break; - case 5: - this.attachCss( - "backdrop-filter", - `invert(${fastn_utils.getStaticValue(staticValue[1])})`, - ); - break; - case 6: - this.attachCss( - "backdrop-filter", - `opacity(${fastn_utils.getStaticValue( - staticValue[1], - )})`, - ); - break; - case 7: - this.attachCss( - "backdrop-filter", - `sepia(${fastn_utils.getStaticValue(staticValue[1])})`, - ); - break; - case 8: - this.attachCss( - "backdrop-filter", - `saturate(${fastn_utils.getStaticValue( - staticValue[1], - )})`, - ); - break; - case 9: - this.attachBackdropMultiFilter(staticValue[1]); - break; - } - } else if (kind === fastn_dom.PropertyKind.Mask) { - if (fastn_utils.isNull(staticValue)) { - this.attachCss("mask-image", staticValue); - return; - } - - const [backgroundType, value] = staticValue; - - switch (backgroundType) { - case fastn_dom.Mask.Image()[0]: - this.attachMaskImageCss(value); - this.attachMaskImageCss(value, "-webkit"); - break; - case fastn_dom.Mask.Multi()[0]: - this.attachMaskMultiCss(value); - this.attachMaskMultiCss(value, "-webkit"); - break; - } - } else if (kind === fastn_dom.PropertyKind.Classes) { - fastn_utils.removeNonFastnClasses(this); - if (!fastn_utils.isNull(staticValue)) { - let cls = staticValue.map((obj) => - fastn_utils.getStaticValue(obj.item), - ); - cls.forEach((c) => { - this.#node.classList.add(c); - }); - } - } else if (kind === fastn_dom.PropertyKind.Anchor) { - // todo: this needs fixed for anchor.id = v - // need to change position of element with id = v to relative - if (fastn_utils.isNull(staticValue)) { - this.attachCss("position", staticValue); - return; - } - - let anchorType = staticValue[0]; - switch (anchorType) { - case 1: - this.attachCss("position", staticValue[1]); - break; - case 2: - this.attachCss("position", staticValue[1]); - this.updateParentPosition("relative"); - break; - case 3: - const parent_node_id = staticValue[1]; - this.attachCss("position", "absolute"); - this.updatePositionForNodeById(parent_node_id, "relative"); - break; - } - } else if (kind === fastn_dom.PropertyKind.Sticky) { - // sticky is boolean type - switch (staticValue) { - case "true": - case true: - this.attachCss("position", "sticky"); - break; - case "false": - case false: - this.attachCss("position", "static"); - break; - default: - this.attachCss("position", staticValue); - } - } else if (kind === fastn_dom.PropertyKind.Top) { - this.attachCss("top", staticValue); - } else if (kind === fastn_dom.PropertyKind.Bottom) { - this.attachCss("bottom", staticValue); - } else if (kind === fastn_dom.PropertyKind.Left) { - this.attachCss("left", staticValue); - } else if (kind === fastn_dom.PropertyKind.Right) { - this.attachCss("right", staticValue); - } else if (kind === fastn_dom.PropertyKind.Overflow) { - this.attachCss("overflow", staticValue); - } else if (kind === fastn_dom.PropertyKind.OverflowX) { - this.attachCss("overflow-x", staticValue); - } else if (kind === fastn_dom.PropertyKind.OverflowY) { - this.attachCss("overflow-y", staticValue); - } else if (kind === fastn_dom.PropertyKind.Spacing) { - if (fastn_utils.isNull(staticValue)) { - this.attachCss("justify-content", staticValue); - this.attachCss("gap", staticValue); - return; - } - - let spacingType = staticValue[0]; - switch (spacingType) { - case fastn_dom.Spacing.SpaceEvenly[0]: - case fastn_dom.Spacing.SpaceBetween[0]: - case fastn_dom.Spacing.SpaceAround[0]: - this.attachCss("justify-content", staticValue[1]); - break; - case fastn_dom.Spacing.Fixed()[0]: - this.attachCss( - "gap", - fastn_utils.getStaticValue(staticValue[1]), - ); - break; - } - } else if (kind === fastn_dom.PropertyKind.Wrap) { - // sticky is boolean type - switch (staticValue) { - case "true": - case true: - this.attachCss("flex-wrap", "wrap"); - break; - case "false": - case false: - this.attachCss("flex-wrap", "no-wrap"); - break; - default: - this.attachCss("flex-wrap", staticValue); - } - } else if (kind === fastn_dom.PropertyKind.TextTransform) { - this.attachCss("text-transform", staticValue); - } else if (kind === fastn_dom.PropertyKind.TextIndent) { - this.attachCss("text-indent", staticValue); - } else if (kind === fastn_dom.PropertyKind.TextAlign) { - this.attachCss("text-align", staticValue); - } else if (kind === fastn_dom.PropertyKind.LineClamp) { - // -webkit-line-clamp: staticValue - // display: -webkit-box, overflow: hidden - // -webkit-box-orient: vertical - this.attachCss("-webkit-line-clamp", staticValue); - this.attachCss("display", "-webkit-box"); - this.attachCss("overflow", "hidden"); - this.attachCss("-webkit-box-orient", "vertical"); - } else if (kind === fastn_dom.PropertyKind.Opacity) { - this.attachCss("opacity", staticValue); - } else if (kind === fastn_dom.PropertyKind.Cursor) { - this.attachCss("cursor", staticValue); - } else if (kind === fastn_dom.PropertyKind.Resize) { - // overflow: auto, resize: staticValue - this.attachCss("resize", staticValue); - this.attachCss("overflow", "auto"); - } else if (kind === fastn_dom.PropertyKind.Selectable) { - if (staticValue === false) { - this.attachCss("user-select", "none"); - } else { - this.attachCss("user-select", null); - } - } else if (kind === fastn_dom.PropertyKind.MinHeight) { - this.attachCss("min-height", staticValue); - } else if (kind === fastn_dom.PropertyKind.MaxHeight) { - this.attachCss("max-height", staticValue); - } else if (kind === fastn_dom.PropertyKind.MinWidth) { - this.attachCss("min-width", staticValue); - } else if (kind === fastn_dom.PropertyKind.MaxWidth) { - this.attachCss("max-width", staticValue); - } else if (kind === fastn_dom.PropertyKind.WhiteSpace) { - this.attachCss("white-space", staticValue); - } else if (kind === fastn_dom.PropertyKind.AlignSelf) { - this.attachCss("align-self", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderColor) { - this.attachColorCss("border-color", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderLeftColor) { - this.attachColorCss("border-left-color", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderRightColor) { - this.attachColorCss("border-right-color", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderTopColor) { - this.attachColorCss("border-top-color", staticValue); - } else if (kind === fastn_dom.PropertyKind.BorderBottomColor) { - this.attachColorCss("border-bottom-color", staticValue); - } else if (kind === fastn_dom.PropertyKind.LinkColor) { - this.attachLinkColor(staticValue); - } else if (kind === fastn_dom.PropertyKind.Color) { - this.attachColorCss("color", staticValue, true); - } else if (kind === fastn_dom.PropertyKind.Background) { - if (fastn_utils.isNull(staticValue)) { - this.attachColorCss("background-color", staticValue); - this.attachBackgroundImageCss(staticValue); - this.attachLinearGradientCss(staticValue); - return; - } - - let backgroundType = staticValue[0]; - switch (backgroundType) { - case fastn_dom.BackgroundStyle.Solid()[0]: - this.attachColorCss("background-color", staticValue[1]); - break; - case fastn_dom.BackgroundStyle.Image()[0]: - this.attachBackgroundImageCss(staticValue[1]); - break; - case fastn_dom.BackgroundStyle.LinearGradient()[0]: - this.attachLinearGradientCss(staticValue[1]); - break; - } - } else if (kind === fastn_dom.PropertyKind.Display) { - this.attachCss("display", staticValue); - } else if (kind === fastn_dom.PropertyKind.Checked) { - switch (staticValue) { - case "true": - case true: - this.attachAttribute("checked", ""); - break; - case "false": - case false: - this.removeAttribute("checked"); - break; - default: - this.attachAttribute("checked", staticValue); - } - if (!ssr) this.#node.checked = staticValue; - } else if (kind === fastn_dom.PropertyKind.Enabled) { - switch (staticValue) { - case "false": - case false: - this.attachAttribute("disabled", ""); - break; - case "true": - case true: - this.removeAttribute("disabled"); - break; - default: - this.attachAttribute("disabled", staticValue); - } - } else if (kind === fastn_dom.PropertyKind.TextInputType) { - this.attachAttribute("type", staticValue); - } else if (kind === fastn_dom.PropertyKind.TextInputValue) { - this.#rawInnerValue = staticValue; - this.updateTextInputValue(); - } else if (kind === fastn_dom.PropertyKind.DefaultTextInputValue) { - if (!fastn_utils.isNull(this.#rawInnerValue)) { - return; - } - this.#rawInnerValue = staticValue; - this.updateTextInputValue(); - } else if (kind === fastn_dom.PropertyKind.InputMaxLength) { - this.attachAttribute("maxlength", staticValue); - } else if (kind === fastn_dom.PropertyKind.Placeholder) { - this.attachAttribute("placeholder", staticValue); - } else if (kind === fastn_dom.PropertyKind.Multiline) { - switch (staticValue) { - case "true": - case true: - this.updateTagName("textarea"); - break; - case "false": - case false: - this.updateTagName("input"); - break; - } - this.updateTextInputValue(); - } else if (kind === fastn_dom.PropertyKind.Link) { - // Changing node type to `a` for link - // todo: needs fix for image links - if (fastn_utils.isNull(staticValue)) { - return; - } - this.updateToAnchor(staticValue); - } else if (kind === fastn_dom.PropertyKind.LinkRel) { - if (fastn_utils.isNull(staticValue)) { - this.removeAttribute("rel"); - } - let rel_list = staticValue.map((obj) => - fastn_utils.getStaticValue(obj.item), - ); - this.attachAttribute("rel", rel_list.join(" ")); - } else if (kind === fastn_dom.PropertyKind.OpenInNewTab) { - // open_in_new_tab is boolean type - switch (staticValue) { - case "true": - case true: - this.attachAttribute("target", "_blank"); - break; - default: - this.attachAttribute("target", staticValue); - } - } else if (kind === fastn_dom.PropertyKind.TextStyle) { - let styles = staticValue?.map((obj) => - fastn_utils.getStaticValue(obj.item), - ); - this.attachTextStyles(styles); - } else if (kind === fastn_dom.PropertyKind.Region) { - this.updateTagName(staticValue); - if (this.#node.innerHTML) { - this.#node.id = fastn_utils.slugify(this.#rawInnerValue); - } - } else if (kind === fastn_dom.PropertyKind.AlignContent) { - let node_kind = this.#kind; - this.attachAlignContent(staticValue, node_kind); - } else if (kind === fastn_dom.PropertyKind.Loading) { - this.attachAttribute("loading", staticValue); - } else if (kind === fastn_dom.PropertyKind.Src) { - this.attachAttribute("src", staticValue); - } else if (kind === fastn_dom.PropertyKind.ImageSrc) { - ftd.dark_mode.addClosure( - fastn - .closure(() => { - if (fastn_utils.isNull(staticValue)) { - this.attachAttribute("src", staticValue); - return; - } - const is_dark_mode = ftd.dark_mode.get(); - const src = staticValue.get( - is_dark_mode ? "dark" : "light", - ); - if (!ssr) { - let image_node = this.#node; - if (!fastn_utils.isNull(image_node)) { - if (image_node.nodeName.toLowerCase() === "a") { - let childNodes = image_node.childNodes; - childNodes.forEach(function (child) { - if ( - child.nodeName.toLowerCase() === - "img" - ) - image_node = child; - }); - } - image_node.setAttribute( - "src", - fastn_utils.getStaticValue(src), - ); - } - } else { - this.attachAttribute( - "src", - fastn_utils.getStaticValue(src), - ); - } - }) - .addNodeProperty(this, null, inherited), - ); - this.#mutables.push(ftd.dark_mode); - } else if (kind === fastn_dom.PropertyKind.Alt) { - this.attachAttribute("alt", staticValue); - } else if (kind === fastn_dom.PropertyKind.VideoSrc) { - ftd.dark_mode.addClosure( - fastn - .closure(() => { - if (fastn_utils.isNull(staticValue)) { - this.attachAttribute("src", staticValue); - return; - } - const is_dark_mode = ftd.dark_mode.get(); - const src = staticValue.get( - is_dark_mode ? "dark" : "light", - ); - - this.attachAttribute( - "src", - fastn_utils.getStaticValue(src), - ); - }) - .addNodeProperty(this, null, inherited), - ); - this.#mutables.push(ftd.dark_mode); - } else if (kind === fastn_dom.PropertyKind.Autoplay) { - if (staticValue) { - this.attachAttribute("autoplay", staticValue); - } else { - this.removeAttribute("autoplay"); - } - } else if (kind === fastn_dom.PropertyKind.Muted) { - if (staticValue) { - this.attachAttribute("muted", staticValue); - } else { - this.removeAttribute("muted"); - } - } else if (kind === fastn_dom.PropertyKind.Controls) { - if (staticValue) { - this.attachAttribute("controls", staticValue); - } else { - this.removeAttribute("controls"); - } - } else if (kind === fastn_dom.PropertyKind.LoopVideo) { - if (staticValue) { - this.attachAttribute("loop", staticValue); - } else { - this.removeAttribute("loop"); - } - } else if (kind === fastn_dom.PropertyKind.Poster) { - ftd.dark_mode.addClosure( - fastn - .closure(() => { - if (fastn_utils.isNull(staticValue)) { - this.attachAttribute("poster", staticValue); - return; - } - const is_dark_mode = ftd.dark_mode.get(); - const posterSrc = staticValue.get( - is_dark_mode ? "dark" : "light", - ); - - this.attachAttribute( - "poster", - fastn_utils.getStaticValue(posterSrc), - ); - }) - .addNodeProperty(this, null, inherited), - ); - this.#mutables.push(ftd.dark_mode); - } else if (kind === fastn_dom.PropertyKind.Fit) { - this.attachCss("object-fit", staticValue); - } else if (kind === fastn_dom.PropertyKind.FetchPriority) { - this.attachAttribute("fetchpriority", staticValue); - } else if (kind === fastn_dom.PropertyKind.YoutubeSrc) { - if (fastn_utils.isNull(staticValue)) { - this.attachAttribute("src", staticValue); - return; - } - const id_pattern = "^([a-zA-Z0-9_-]{11})$"; - let id = staticValue.match(id_pattern); - if (!fastn_utils.isNull(id)) { - this.attachAttribute( - "src", - `https:\/\/youtube.com/embed/${id[0]}`, - ); - } else { - this.attachAttribute("src", staticValue); - } - } else if (kind === fastn_dom.PropertyKind.Role) { - this.attachRoleCss(staticValue); - } else if (kind === fastn_dom.PropertyKind.Code) { - if (!fastn_utils.isNull(staticValue)) { - let { modifiedText, highlightedLines } = - fastn_utils.findAndRemoveHighlighter(staticValue); - if (highlightedLines.length !== 0) { - this.attachAttribute("data-line", highlightedLines); - } - staticValue = modifiedText; - } - let codeNode = this.#children[0].getNode(); - let codeText = fastn_utils.escapeHtmlInCode(staticValue); - codeNode.innerHTML = codeText; - this.#extraData.code = this.#extraData.code - ? this.#extraData.code - : {}; - fastn_utils.highlightCode(codeNode, this.#extraData.code); - } else if (kind === fastn_dom.PropertyKind.CodeShowLineNumber) { - if (staticValue) { - this.#node.classList.add("line-numbers"); - } else { - this.#node.classList.remove("line-numbers"); - } - } else if (kind === fastn_dom.PropertyKind.CodeTheme) { - this.#extraData.code = this.#extraData.code - ? this.#extraData.code - : {}; - if (fastn_utils.isNull(staticValue)) { - if (!fastn_utils.isNull(this.#extraData.code.theme)) { - this.#node.classList.remove(this.#extraData.code.theme); - } - return; - } - if (!ssr) { - fastn_utils.addCodeTheme(staticValue); - } - staticValue = fastn_utils.getStaticValue(staticValue); - let theme = staticValue.replace(".", "-"); - if (this.#extraData.code.theme !== theme) { - let codeNode = this.#children[0].getNode(); - this.#node.classList.remove(this.#extraData.code.theme); - codeNode.classList.remove(this.#extraData.code.theme); - this.#extraData.code.theme = theme; - this.#node.classList.add(theme); - codeNode.classList.add(theme); - fastn_utils.highlightCode(codeNode, this.#extraData.code); - } - } else if (kind === fastn_dom.PropertyKind.CodeLanguage) { - let language = `language-${staticValue}`; - this.#extraData.code = this.#extraData.code - ? this.#extraData.code - : {}; - if (this.#extraData.code.language) { - this.#node.classList.remove(language); - } - this.#extraData.code.language = language; - this.#node.classList.add(language); - let codeNode = this.#children[0].getNode(); - codeNode.classList.add(language); - fastn_utils.highlightCode(codeNode, this.#extraData.code); - } else if (kind === fastn_dom.PropertyKind.Favicon) { - if (fastn_utils.isNull(staticValue)) return; - this.setFavicon(staticValue); - } else if ( - kind === fastn_dom.PropertyKind.DocumentProperties.MetaTitle - ) { - this.updateMetaTitle(staticValue); - } else if ( - kind === fastn_dom.PropertyKind.DocumentProperties.MetaOGTitle - ) { - this.addMetaTagByProperty("og:title", staticValue); - } else if ( - kind === fastn_dom.PropertyKind.DocumentProperties.MetaTwitterTitle - ) { - this.addMetaTagByName("twitter:title", staticValue); - } else if ( - kind === fastn_dom.PropertyKind.DocumentProperties.MetaDescription - ) { - this.addMetaTagByName("description", staticValue); - } else if ( - kind === fastn_dom.PropertyKind.DocumentProperties.MetaOGDescription - ) { - this.addMetaTagByProperty("og:description", staticValue); - } else if ( - kind === - fastn_dom.PropertyKind.DocumentProperties.MetaTwitterDescription - ) { - this.addMetaTagByName("twitter:description", staticValue); - } else if ( - kind === fastn_dom.PropertyKind.DocumentProperties.MetaOGImage - ) { - // staticValue is of ftd.raw-image-src RecordInstance type - if (fastn_utils.isNull(staticValue)) { - this.removeMetaTagByProperty("og:image"); - return; - } - this.addMetaTagByProperty( - "og:image", - fastn_utils.getStaticValue(staticValue.get("src")), - ); - } else if ( - kind === fastn_dom.PropertyKind.DocumentProperties.MetaTwitterImage - ) { - // staticValue is of ftd.raw-image-src RecordInstance type - if (fastn_utils.isNull(staticValue)) { - this.removeMetaTagByName("twitter:image"); - return; - } - this.addMetaTagByName( - "twitter:image", - fastn_utils.getStaticValue(staticValue.get("src")), - ); - } else if ( - kind === fastn_dom.PropertyKind.DocumentProperties.MetaThemeColor - ) { - // staticValue is of ftd.color RecordInstance type - if (fastn_utils.isNull(staticValue)) { - this.removeMetaTagByName("theme-color"); - return; - } - this.addMetaTagByName( - "theme-color", - fastn_utils.getStaticValue(staticValue.get("light")), - ); - } else if ( - kind === - fastn_dom.PropertyKind.DocumentProperties - .MetaFacebookDomainVerification - ) { - if (fastn_utils.isNull(staticValue)) { - this.removeMetaTagByName("facebook-domain-verification"); - return; - } - this.addMetaTagByName( - "facebook-domain-verification", - fastn_utils.getStaticValue(staticValue), - ); - } else if ( - kind === fastn_dom.PropertyKind.IntegerValue || - kind === fastn_dom.PropertyKind.DecimalValue || - kind === fastn_dom.PropertyKind.BooleanValue - ) { - this.#node.innerHTML = staticValue; - this.#rawInnerValue = staticValue; - } else if (kind === fastn_dom.PropertyKind.StringValue) { - this.#rawInnerValue = staticValue; - staticValue = fastn_utils.markdown_inline( - fastn_utils.escapeHtmlInMarkdown(staticValue), - ); - staticValue = fastn_utils.process_post_markdown( - this.#node, - staticValue, - ); - if (!fastn_utils.isNull(staticValue)) { - this.#node.innerHTML = staticValue; - } else { - this.#node.innerHTML = ""; - } - } else { - throw "invalid fastn_dom.PropertyKind: " + kind; - } - } - setProperty(kind, value, inherited) { - if (value instanceof fastn.mutableClass) { - this.setDynamicProperty( - kind, - [value], - () => { - return value.get(); - }, - inherited, - ); - } else if (value instanceof PropertyValueAsClosure) { - this.setDynamicProperty( - kind, - value.deps, - value.closureFunction, - inherited, - ); - } else { - this.setStaticProperty(kind, value, inherited); - } - } - setDynamicProperty(kind, deps, func, inherited) { - let closure = fastn - .closure(func) - .addNodeProperty(this, kind, inherited); - for (let dep in deps) { - if (fastn_utils.isNull(deps[dep]) || !deps[dep].addClosure) { - continue; - } - deps[dep].addClosure(closure); - this.#mutables.push(deps[dep]); - } - } - getNode() { - return this.#node; - } - getExtraData() { - return this.#extraData; - } - getChildren() { - return this.#children; - } - mergeFnCalls(current, newFunc) { - return () => { - if (current instanceof Function) current(); - if (newFunc instanceof Function) newFunc(); - }; - } - addEventHandler(event, func) { - if (event === fastn_dom.Event.Click) { - let onclickEvents = this.mergeFnCalls(this.#node.onclick, func); - if (fastn_utils.isNull(this.#node.onclick)) - this.attachCss("cursor", "pointer"); - this.#node.onclick = onclickEvents; - } else if (event === fastn_dom.Event.MouseEnter) { - let mouseEnterEvents = this.mergeFnCalls( - this.#node.onmouseenter, - func, - ); - this.#node.onmouseenter = mouseEnterEvents; - } else if (event === fastn_dom.Event.MouseLeave) { - let mouseLeaveEvents = this.mergeFnCalls( - this.#node.onmouseleave, - func, - ); - this.#node.onmouseleave = mouseLeaveEvents; - } else if (event === fastn_dom.Event.ClickOutside) { - ftd.clickOutsideEvents.push([this, func]); - } else if (!!event[0] && event[0] === fastn_dom.Event.GlobalKey()[0]) { - ftd.globalKeyEvents.push([this, func, event[1]]); - } else if ( - !!event[0] && - event[0] === fastn_dom.Event.GlobalKeySeq()[0] - ) { - ftd.globalKeySeqEvents.push([this, func, event[1]]); - } else if (event === fastn_dom.Event.Input) { - let onInputEvents = this.mergeFnCalls(this.#node.oninput, func); - this.#node.oninput = onInputEvents; - } else if (event === fastn_dom.Event.Change) { - let onChangeEvents = this.mergeFnCalls(this.#node.onchange, func); - this.#node.onchange = onChangeEvents; - } else if (event === fastn_dom.Event.Blur) { - let onBlurEvents = this.mergeFnCalls(this.#node.onblur, func); - this.#node.onblur = onBlurEvents; - } else if (event === fastn_dom.Event.Focus) { - let onFocusEvents = this.mergeFnCalls(this.#node.onfocus, func); - this.#node.onfocus = onFocusEvents; - } - } - destroy() { - for (let i = 0; i < this.#mutables.length; i++) { - this.#mutables[i].unlinkNode(this); - } - // Todo: We don't need this condition as after destroying this node - // ConditionalDom reset this.#conditionUI to null or some different - // value. Not sure why this is still needed. - if (!fastn_utils.isNull(this.#node)) { - this.#node.remove(); - } - this.#mutables = []; - this.#parent = null; - this.#node = null; - } -} - -class ConditionalDom { - #marker; - #parent; - #node_constructor; - #condition; - #mutables; - #conditionUI; - - constructor(parent, deps, condition, node_constructor) { - this.#marker = fastn_dom.createKernel( - parent, - fastn_dom.ElementKind.Comment, - ); - this.#parent = parent; - - this.#conditionUI = null; - let closure = fastn.closure(() => { - fastn_utils.resetFullHeight(); - if (condition()) { - if (this.#conditionUI) { - let conditionUI = fastn_utils.flattenArray( - this.#conditionUI, - ); - while (conditionUI.length > 0) { - let poppedElement = conditionUI.pop(); - poppedElement.destroy(); - } - } - this.#conditionUI = node_constructor( - new ParentNodeWithSibiling(this.#parent, this.#marker), - ); - if ( - !Array.isArray(this.#conditionUI) && - fastn_utils.isWrapperNode(this.#conditionUI.getTagName()) - ) { - this.#conditionUI = this.#conditionUI.getChildren(); - } - } else if (this.#conditionUI) { - let conditionUI = fastn_utils.flattenArray(this.#conditionUI); - while (conditionUI.length > 0) { - let poppedElement = conditionUI.pop(); - poppedElement.destroy(); - } - this.#conditionUI = null; - } - fastn_utils.setFullHeight(); - }); - deps.forEach((dep) => { - if (!fastn_utils.isNull(dep) && dep.addClosure) { - dep.addClosure(closure); - } - }); - - this.#node_constructor = node_constructor; - this.#condition = condition; - this.#mutables = []; - } - - getParent() { - let nodes = [this.#marker]; - if (this.#conditionUI) { - nodes.push(this.#conditionUI); - } - return nodes; - } -} - -fastn_dom.createKernel = function (parent, kind) { - return new Node2(parent, kind); -}; - -fastn_dom.conditionalDom = function ( - parent, - deps, - condition, - node_constructor, -) { - return new ConditionalDom(parent, deps, condition, node_constructor); -}; - -class ParentNodeWithSibiling { - #parent; - #sibiling; - constructor(parent, sibiling) { - this.#parent = parent; - this.#sibiling = sibiling; - } - getParent() { - return this.#parent; - } - getSibiling() { - return this.#sibiling; - } -} - -class ForLoop { - #node_constructor; - #list; - #wrapper; - #parent; - #nodes; - constructor(parent, node_constructor, list) { - this.#wrapper = fastn_dom.createKernel( - parent, - fastn_dom.ElementKind.Comment, - ); - this.#parent = parent; - this.#node_constructor = node_constructor; - this.#list = list; - this.#nodes = []; - - fastn_utils.resetFullHeight(); - for (let idx in list.getList()) { - this.createNode(idx, false); - } - fastn_utils.setFullHeight(); - } - createNode(index, resizeBodyHeight = true) { - if (resizeBodyHeight) { - fastn_utils.resetFullHeight(); - } - let parentWithSibiling = new ParentNodeWithSibiling( - this.#parent, - this.#wrapper, - ); - if (index !== 0) { - parentWithSibiling = new ParentNodeWithSibiling( - this.#parent, - this.#nodes[index - 1], - ); - } - let v = this.#list.get(index); - let node = this.#node_constructor(parentWithSibiling, v.item, v.index); - this.#nodes.splice(index, 0, node); - if (resizeBodyHeight) { - fastn_utils.setFullHeight(); - } - return node; - } - createAllNode() { - fastn_utils.resetFullHeight(); - this.deleteAllNode(false); - for (let idx in this.#list.getList()) { - this.createNode(idx, false); - } - fastn_utils.setFullHeight(); - } - deleteAllNode(resizeBodyHeight = true) { - if (resizeBodyHeight) { - fastn_utils.resetFullHeight(); - } - while (this.#nodes.length > 0) { - this.#nodes.pop().destroy(); - } - if (resizeBodyHeight) { - fastn_utils.setFullHeight(); - } - } - getWrapper() { - return this.#wrapper; - } - deleteNode(index) { - fastn_utils.resetFullHeight(); - let node = this.#nodes.splice(index, 1)[0]; - node.destroy(); - fastn_utils.setFullHeight(); - } - getParent() { - return this.#parent; - } -} - -fastn_dom.forLoop = function (parent, node_constructor, list) { - return new ForLoop(parent, node_constructor, list); -}; -let fastn_utils = { - htmlNode(kind) { - let node = "div"; - let css = []; - let attributes = {}; - if (kind === fastn_dom.ElementKind.Column) { - css.push(fastn_dom.InternalClass.FT_COLUMN); - } else if (kind === fastn_dom.ElementKind.Document) { - css.push(fastn_dom.InternalClass.FT_COLUMN); - css.push(fastn_dom.InternalClass.FT_FULL_SIZE); - } else if (kind === fastn_dom.ElementKind.Row) { - css.push(fastn_dom.InternalClass.FT_ROW); - } else if (kind === fastn_dom.ElementKind.IFrame) { - node = "iframe"; - // To allow fullscreen support - // Reference: https://stackoverflow.com/questions/27723423/youtube-iframe-embed-full-screen - attributes["allowfullscreen"] = ""; - } else if (kind === fastn_dom.ElementKind.Image) { - node = "img"; - } else if (kind === fastn_dom.ElementKind.Video) { - node = "video"; - } else if ( - kind === fastn_dom.ElementKind.ContainerElement || - kind === fastn_dom.ElementKind.Text - ) { - node = "div"; - } else if (kind === fastn_dom.ElementKind.Rive) { - node = "canvas"; - } else if (kind === fastn_dom.ElementKind.CheckBox) { - node = "input"; - attributes["type"] = "checkbox"; - } else if (kind === fastn_dom.ElementKind.TextInput) { - node = "input"; - } else if (kind === fastn_dom.ElementKind.Comment) { - node = fastn_dom.commentNode; - } else if (kind === fastn_dom.ElementKind.Wrapper) { - node = fastn_dom.wrapperNode; - } else if (kind === fastn_dom.ElementKind.Code) { - node = "pre"; - } else if (kind === fastn_dom.ElementKind.CodeChild) { - node = "code"; - } else if (kind[0] === fastn_dom.ElementKind.WebComponent()[0]) { - let [webcomponent, args] = kind[1]; - node = `${webcomponent}`; - fastn_dom.webComponent.push(args); - attributes[fastn_dom.webComponentArgument] = - fastn_dom.webComponent.length - 1; - } - return [node, css, attributes]; - }, - createStyle(cssClass, obj) { - if (doubleBuffering) { - fastn_dom.styleClasses = `${ - fastn_dom.styleClasses - }${getClassAsString(cssClass, obj)}\n`; - } else { - let styles = document.getElementById("styles"); - let newClasses = getClassAsString(cssClass, obj); - let textNode = document.createTextNode(newClasses); - if (styles.styleSheet) { - styles.styleSheet.cssText = newClasses; - } else { - styles.appendChild(textNode); - } - } - }, - getStaticValue(obj) { - if (obj instanceof fastn.mutableClass) { - return this.getStaticValue(obj.get()); - } else if (obj instanceof fastn.mutableListClass) { - return obj.getList(); - } /* - Todo: Make this work - else if (obj instanceof fastn.recordInstanceClass) { - return obj.getAllFields(); - }*/ else { - return obj; - } - }, - getInheritedValues(default_args, inherited, function_args) { - let record_fields = { - colors: ftd.default_colors.getClone().setAndReturn("is_root", true), - types: ftd.default_types.getClone().setAndReturn("is_root", true), - }; - Object.assign(record_fields, default_args); - let fields = {}; - if (inherited instanceof fastn.recordInstanceClass) { - fields = inherited.getClonedFields(); - if (fastn_utils.getStaticValue(fields["colors"].get("is_root"))) { - delete fields.colors; - } - if (fastn_utils.getStaticValue(fields["types"].get("is_root"))) { - delete fields.types; - } - } - Object.assign(record_fields, fields); - Object.assign(record_fields, function_args); - return fastn.recordInstance({ - ...record_fields, - }); - }, - removeNonFastnClasses(node) { - let classList = node.getNode().classList; - let extraCodeData = node.getExtraData().code; - let iterativeClassList = classList; - if (ssr) { - iterativeClassList = iterativeClassList.getClasses(); - } - const internalClassNames = Object.values(fastn_dom.InternalClass); - const classesToRemove = []; - - for (const className of iterativeClassList) { - if ( - !className.startsWith("__") && - !internalClassNames.includes(className) && - className !== extraCodeData?.language && - className !== extraCodeData?.theme - ) { - classesToRemove.push(className); - } - } - - for (const classNameToRemove of classesToRemove) { - classList.remove(classNameToRemove); - } - }, - staticToMutables(obj) { - if ( - !(obj instanceof fastn.mutableClass) && - !(obj instanceof fastn.mutableListClass) && - !(obj instanceof fastn.recordInstanceClass) - ) { - if (Array.isArray(obj)) { - let list = []; - for (let index in obj) { - list.push(fastn_utils.staticToMutables(obj[index])); - } - return fastn.mutableList(list); - } else if (obj instanceof Object) { - let fields = {}; - for (let objKey in obj) { - fields[objKey] = fastn_utils.staticToMutables(obj[objKey]); - } - return fastn.recordInstance(fields); - } else { - return fastn.mutable(obj); - } - } else { - return obj; - } - }, - getFlattenStaticValue(obj) { - let staticValue = fastn_utils.getStaticValue(obj); - if (Array.isArray(staticValue)) { - return staticValue.map((func) => - fastn_utils.getFlattenStaticValue(func.item), - ); - } /* - Todo: Make this work - else if (typeof staticValue === 'object' && fastn_utils.isNull(staticValue)) { - return Object.fromEntries( - Object.entries(staticValue).map(([k,v]) => - [k, fastn_utils.getFlattenStaticValue(v)] - ) - ); - }*/ - return staticValue; - }, - getter(value) { - if (value instanceof fastn.mutableClass) { - return value.get(); - } else { - return value; - } - }, - // Todo: Merge getterByKey with getter - getterByKey(value, index) { - if ( - value instanceof fastn.mutableClass || - value instanceof fastn.recordInstanceClass - ) { - return value.get(index); - } else if (value instanceof fastn.mutableListClass) { - return value.get(index).item; - } else { - return value; - } - }, - setter(variable, value) { - if (!fastn_utils.isNull(variable) && variable.set) { - variable.set(value); - return true; - } - return false; - }, - defaultPropertyValue(_propertyValue) { - return null; - }, - sameResponsiveRole(desktop, mobile) { - return ( - desktop.get("font_family") === mobile.get("font_family") && - desktop.get("letter_spacing") === mobile.get("letter_spacing") && - desktop.get("line_height") === mobile.get("line_height") && - desktop.get("size") === mobile.get("size") && - desktop.get("weight") === mobile.get("weight") - ); - }, - getRoleValues(value) { - let font_families = fastn_utils.getStaticValue( - value.get("font_family"), - ); - if (Array.isArray(font_families)) - font_families = font_families - .map((obj) => fastn_utils.getStaticValue(obj.item)) - .join(", "); - return { - "font-family": font_families, - "letter-spacing": fastn_utils.getStaticValue( - value.get("letter_spacing"), - ), - "font-size": fastn_utils.getStaticValue(value.get("size")), - "font-weight": fastn_utils.getStaticValue(value.get("weight")), - "line-height": fastn_utils.getStaticValue(value.get("line_height")), - }; - }, - clone(value) { - if (value === null || value === undefined) { - return value; - } - if ( - value instanceof fastn.mutableClass || - value instanceof fastn.mutableListClass - ) { - return value.getClone(); - } - if (value instanceof fastn.recordInstanceClass) { - return value.getClone(); - } - return value; - }, - getListItem(value) { - if (value === undefined) { - return null; - } - if (value instanceof Object && value.hasOwnProperty("item")) { - value = value.item; - } - return value; - }, - getEventKey(event) { - if (65 <= event.keyCode && event.keyCode <= 90) { - return String.fromCharCode(event.keyCode).toLowerCase(); - } else { - return event.key; - } - }, - createNestedObject(currentObject, path, value) { - const properties = path.split("."); - - for (let i = 0; i < properties.length - 1; i++) { - let property = fastn_utils.private.addUnderscoreToStart( - properties[i], - ); - if (currentObject instanceof fastn.recordInstanceClass) { - if (currentObject.get(property) === undefined) { - currentObject.set(property, fastn.recordInstance({})); - } - currentObject = currentObject.get(property).get(); - } else { - if (!currentObject.hasOwnProperty(property)) { - currentObject[property] = fastn.recordInstance({}); - } - currentObject = currentObject[property]; - } - } - - const innermostProperty = properties[properties.length - 1]; - if (currentObject instanceof fastn.recordInstanceClass) { - currentObject.set(innermostProperty, value); - } else { - currentObject[innermostProperty] = value; - } - }, - /** - * Takes an input string and processes it as inline markdown using the - * 'marked' library. The function removes the last occurrence of - * wrapping <p> tags (i.e. <p> tag found at the end) from the result and - * adjusts spaces around the content. - * - * @param {string} i - The input string to be processed as inline markdown. - * @returns {string} - The processed string with inline markdown. - */ - markdown_inline(i) { - if (fastn_utils.isNull(i)) return; - i = i.toString(); - const { space_before, space_after } = fastn_utils.private.spaces(i); - const o = (() => { - let g = fastn_utils.private.replace_last_occurrence( - marked.parse(i), - "<p>", - "", - ); - g = fastn_utils.private.replace_last_occurrence(g, "</p>", ""); - return g; - })(); - return `${fastn_utils.private.repeated_space( - space_before, - )}${o}${fastn_utils.private.repeated_space(space_after)}`.replace( - /\n+$/, - "", - ); - }, - - process_post_markdown(node, body) { - if (!ssr) { - const divElement = document.createElement("div"); - divElement.innerHTML = body; - - const current_node = node; - const colorClasses = Array.from(current_node.classList).filter( - (className) => className.startsWith("__c"), - ); - const roleClasses = Array.from(current_node.classList).filter( - (className) => className.startsWith("__rl"), - ); - const tableElements = Array.from( - divElement.getElementsByTagName("table"), - ); - const codeElements = Array.from( - divElement.getElementsByTagName("code"), - ); - - tableElements.forEach((table) => { - colorClasses.forEach((colorClass) => { - table.classList.add(colorClass); - }); - }); - - codeElements.forEach((code) => { - roleClasses.forEach((roleClass) => { - var roleCls = "." + roleClass; - let role = fastn_dom.classes[roleCls]; - let roleValue = role["value"]; - let fontFamily = roleValue["font-family"]; - code.style.fontFamily = fontFamily; - }); - }); - - body = divElement.innerHTML; - } - return body; - }, - isNull(a) { - return a === null || a === undefined; - }, - isCommentNode(node) { - return node === fastn_dom.commentNode; - }, - isWrapperNode(node) { - return node === fastn_dom.wrapperNode; - }, - nextSibling(node, parent) { - // For Conditional DOM - while (Array.isArray(node)) { - node = node[node.length - 1]; - } - if (node.nextSibling) { - return node.nextSibling; - } - if (node.getNode && node.getNode().nextSibling !== undefined) { - return node.getNode().nextSibling; - } - return parent.getChildren().indexOf(node.getNode()) + 1; - }, - createNodeHelper(node, classes, attributes) { - let tagName = node; - let element = fastnVirtual.document.createElement(node); - for (let key in attributes) { - element.setAttribute(key, attributes[key]); - } - for (let c in classes) { - element.classList.add(classes[c]); - } - - return [tagName, element]; - }, - addCssFile(url) { - // Create a new link element - const linkElement = document.createElement("link"); - - // Set the attributes of the link element - linkElement.rel = "stylesheet"; - linkElement.href = url; - - // Append the link element to the head section of the document - document.head.appendChild(linkElement); - }, - addCodeTheme(theme) { - if (!fastn_dom.codeData.addedCssFile.includes(theme)) { - let themeCssUrl = fastn_dom.codeData.availableThemes[theme]; - fastn_utils.addCssFile(themeCssUrl); - fastn_dom.codeData.addedCssFile.push(theme); - } - }, - /** - * Searches for highlighter occurrences in the text, removes them, - * and returns the modified text along with highlighted line numbers. - * - * @param {string} text - The input text to process. - * @returns {{ modifiedText: string, highlightedLines: number[] }} - * Object containing modified text and an array of highlighted line numbers. - * - * @example - * const text = `/-- ftd.text: Hello ;; hello - * - * -- some-component: caption-value - * attr-name: attr-value ;; <hl> - * - * - * -- other-component: caption-value ;; <hl> - * attr-name: attr-value`; - * - * const result = findAndRemoveHighlighter(text); - * console.log(result.modifiedText); - * console.log(result.highlightedLines); - */ - findAndRemoveHighlighter(text) { - const lines = text.split("\n"); - const highlighter = ";; <hl>"; - const result = { - modifiedText: "", - highlightedLines: "", - }; - - let highlightedLines = []; - for (let i = 0; i < lines.length; i++) { - const line = lines[i]; - const highlighterIndex = line.indexOf(highlighter); - - if (highlighterIndex !== -1) { - highlightedLines.push(i + 1); // Adding 1 to convert to human-readable line numbers - result.modifiedText += - line.substring(0, highlighterIndex) + - line.substring(highlighterIndex + highlighter.length) + - "\n"; - } else { - result.modifiedText += line + "\n"; - } - } - - result.highlightedLines = - fastn_utils.private.mergeNumbers(highlightedLines); - - return result; - }, - getNodeValue(node) { - return node.getNode().value; - }, - getNodeCheckedState(node) { - return node.getNode().checked; - }, - setFullHeight() { - if (!ssr) { - document.body.style.height = `max(${document.documentElement.scrollHeight}px, 100%)`; - } - }, - resetFullHeight() { - if (!ssr) { - document.body.style.height = `100%`; - } - }, - highlightCode(codeElement, extraCodeData) { - if ( - !ssr && - !fastn_utils.isNull(extraCodeData.language) && - !fastn_utils.isNull(extraCodeData.theme) - ) { - Prism.highlightElement(codeElement); - } - }, - - //Taken from: https://byby.dev/js-slugify-string - slugify(str) { - return String(str) - .normalize("NFKD") // split accented characters into their base characters and diacritical marks - .replace(".", "-") - .replace(/[\u0300-\u036f]/g, "") // remove all the accents, which happen to be all in the \u03xx UNICODE block. - .trim() // trim leading or trailing whitespace - .toLowerCase() // convert to lowercase - .replace(/[^a-z0-9 -]/g, "") // remove non-alphanumeric characters - .replace(/\s+/g, "-") // replace spaces with hyphens - .replace(/-+/g, "-"); // remove consecutive hyphens - }, - - getEventListeners(node) { - return { - onclick: node.onclick, - onmouseleave: node.onmouseleave, - onmouseenter: node.onmouseenter, - oninput: node.oninput, - onblur: node.onblur, - onfocus: node.onfocus, - }; - }, - - flattenArray(arr) { - return fastn_utils.private.flattenArray([arr]); - }, - toSnakeCase(value) { - return value - .trim() - .split("") - .map((v, i) => { - const lowercased = v.toLowerCase(); - if (v == " ") { - return "_"; - } - if (v != lowercased && i > 0) { - return `_${lowercased}`; - } - return lowercased; - }) - .join(""); - }, - escapeHtmlInCode(str) { - return str.replace(/[<]/g, "<"); - }, - - escapeHtmlInMarkdown(str) { - if (typeof str !== "string") { - return str; - } - - let result = ""; - let ch_map = { - "<": "<", - ">": ">", - "&": "&", - '"': """, - "'": "'", - "/": "/", - }; - let foundBackTick = false; - for (var i = 0; i < str.length; i++) { - let current = str[i]; - if (current === "`") { - foundBackTick = !foundBackTick; - } - // Ignore escaping html inside backtick (as marked function - // escape html for backtick content): - // For instance: In `hello <title>`, `<` and `>` should not be - // escaped. (`foundBackTick`) - // Also the `/` which is followed by `<` should be escaped. - // For instance: `</` should be escaped but `http://` should not - // be escaped. (`(current === '/' && !(i > 0 && str[i-1] === "<"))`) - if ( - foundBackTick || - (current === "/" && !(i > 0 && str[i - 1] === "<")) - ) { - result += current; - continue; - } - result += ch_map[current] ?? current; - } - return result; - }, - - // Used to initialize __args__ inside component and UDF js functions - getArgs(default_args, passed_args) { - // Note: arguments as variable name not allowed in strict mode - let args = default_args; - for (var arg in passed_args) { - if (!default_args.hasOwnProperty(arg)) { - args[arg] = passed_args[arg]; - continue; - } - if ( - default_args.hasOwnProperty(arg) && - fastn_utils.getStaticValue(passed_args[arg]) !== undefined - ) { - args[arg] = passed_args[arg]; - } - } - return args; - }, - - /** - * Replaces the children of `document.body` with the children from - * newChildrenWrapper and updates the styles based on the - * `fastn_dom.styleClasses`. - * - * @param {HTMLElement} newChildrenWrapper - The wrapper element - * containing the new children. - */ - replaceBodyStyleAndChildren(newChildrenWrapper) { - // Update styles based on `fastn_dom.styleClasses` - let styles = document.getElementById("styles"); - styles.innerHTML = fastn_dom.getClassesAsStringWithoutStyleTag(); - - // Replace the children of document.body with the children from - // newChildrenWrapper - fastn_utils.private.replaceChildren(document.body, newChildrenWrapper); - }, -}; - -fastn_utils.private = { - flattenArray(arr) { - return arr.reduce((acc, item) => { - return acc.concat( - Array.isArray(item) - ? fastn_utils.private.flattenArray(item) - : item, - ); - }, []); - }, - /** - * Helper function for `fastn_utils.markdown_inline` to find the number of - * spaces before and after the content. - * - * @param {string} s - The input string. - * @returns {Object} - An object with 'space_before' and 'space_after' properties - * representing the number of spaces before and after the content. - */ - spaces(s) { - let space_before = 0; - for (let i = 0; i < s.length; i++) { - if (s[i] !== " ") { - space_before = i; - break; - } - space_before = i + 1; - } - if (space_before === s.length) { - return { space_before, space_after: 0 }; - } - - let space_after = 0; - for (let i = s.length - 1; i >= 0; i--) { - if (s[i] !== " ") { - space_after = s.length - 1 - i; - break; - } - space_after = i + 1; - } - - return { space_before, space_after }; - }, - /** - * Helper function for `fastn_utils.markdown_inline` to replace the last - * occurrence of a substring in a string. - * - * @param {string} s - The input string. - * @param {string} old_word - The substring to be replaced. - * @param {string} new_word - The replacement substring. - * @returns {string} - The string with the last occurrence of 'old_word' replaced by 'new_word'. - */ - replace_last_occurrence(s, old_word, new_word) { - if (!s.includes(old_word)) { - return s; - } - - const idx = s.lastIndexOf(old_word); - return s.slice(0, idx) + new_word + s.slice(idx + old_word.length); - }, - /** - * Helper function for `fastn_utils.markdown_inline` to generate a string - * containing a specified number of spaces. - * - * @param {number} n - The number of spaces to be generated. - * @returns {string} - A string with 'n' spaces concatenated together. - */ - repeated_space(n) { - return Array.from({ length: n }, () => " ").join(""); - }, - /** - * Merges consecutive numbers in a comma-separated list into ranges. - * - * @param {string} input - Comma-separated list of numbers. - * @returns {string} Merged number ranges. - * - * @example - * const input = '1,2,3,5,6,7,8,9,11'; - * const output = mergeNumbers(input); - * console.log(output); // Output: '1-3,5-9,11' - */ - mergeNumbers(numbers) { - if (numbers.length === 0) { - return ""; - } - const mergedRanges = []; - - let start = numbers[0]; - let end = numbers[0]; - - for (let i = 1; i < numbers.length; i++) { - if (numbers[i] === end + 1) { - end = numbers[i]; - } else { - if (start === end) { - mergedRanges.push(start.toString()); - } else { - mergedRanges.push(`${start}-${end}`); - } - start = end = numbers[i]; - } - } - - if (start === end) { - mergedRanges.push(start.toString()); - } else { - mergedRanges.push(`${start}-${end}`); - } - - return mergedRanges.join(","); - }, - addUnderscoreToStart(text) { - if (/^\d/.test(text)) { - return "_" + text; - } - return text; - }, - - /** - * Replaces the children of a parent element with the children from a - * new children wrapper. - * - * @param {HTMLElement} parent - The parent element whose children will - * be replaced. - * @param {HTMLElement} newChildrenWrapper - The wrapper element - * containing the new children. - * @returns {void} - */ - replaceChildren(parent, newChildrenWrapper) { - // Remove existing children of the parent - var children = parent.children; - // Loop through the direct children and remove those with tagName 'div' - for (var i = children.length - 1; i >= 0; i--) { - var child = children[i]; - if (child.tagName === "DIV") { - parent.removeChild(child); - } - } - - // Cut and append the children from newChildrenWrapper to the parent - while (newChildrenWrapper.firstChild) { - parent.appendChild(newChildrenWrapper.firstChild); - } - }, - - // Cookie related functions ---------------------------------------------- - setCookie(cookieName, cookieValue) { - cookieName = fastn_utils.getStaticValue(cookieName); - cookieValue = fastn_utils.getStaticValue(cookieValue); - - // Default expiration period of 30 days - var expires = ""; - var expirationDays = 30; - if (expirationDays) { - var date = new Date(); - date.setTime(date.getTime() + expirationDays * 24 * 60 * 60 * 1000); - expires = "; expires=" + date.toUTCString(); - } - - document.cookie = - cookieName + - "=" + - encodeURIComponent(cookieValue) + - expires + - "; path=/"; - }, - getCookie(cookieName) { - cookieName = fastn_utils.getStaticValue(cookieName); - var name = cookieName + "="; - var decodedCookie = decodeURIComponent(document.cookie); - var cookieArray = decodedCookie.split(";"); - - for (var i = 0; i < cookieArray.length; i++) { - var cookie = cookieArray[i].trim(); - if (cookie.indexOf(name) === 0) { - return cookie.substring(name.length, cookie.length); - } - } - - return "None"; - }, -}; - -/*Object.prototype.get = function(index) { - return this[index]; -}*/ -let fastnVirtual = {}; - -let id_counter = 0; -let ssr = false; -let doubleBuffering = false; - -class ClassList { - #classes = []; - add(item) { - this.#classes.push(item); - } - - remove(itemToRemove) { - this.#classes.filter((item) => item !== itemToRemove); - } - toString() { - return this.#classes.join(" "); - } - getClasses() { - return this.#classes; - } -} - -class Node { - id; - #dataId; - #tagName; - #children; - #attributes; - constructor(id, tagName) { - this.#tagName = tagName; - this.#dataId = id; - this.classList = new ClassList(); - this.#children = []; - this.#attributes = {}; - this.innerHTML = ""; - this.style = {}; - this.onclick = null; - this.id = null; - } - appendChild(c) { - this.#children.push(c); - } - - insertBefore(node, index) { - this.#children.splice(index, 0, node); - } - - getChildren() { - return this.#children; - } - - setAttribute(attribute, value) { - this.#attributes[attribute] = value; - } - - getAttribute(attribute) { - return this.#attributes[attribute]; - } - - removeAttribute(attribute) { - if (attribute in this.#attributes) delete this.#attributes[attribute]; - } - - // Caution: This is only supported in ssr mode - updateTagName(tagName) { - this.#tagName = tagName; - } - // Caution: This is only supported in ssr mode - toHtmlAsString() { - const openingTag = `<${ - this.#tagName - }${this.getDataIdString()}${this.getIdString()}${this.getAttributesString()}${this.getClassString()}${this.getStyleString()}>`; - const closingTag = `</${this.#tagName}>`; - const innerHTML = this.innerHTML; - const childNodes = this.#children - .map((child) => child.toHtmlAsString()) - .join(""); - - return `${openingTag}${innerHTML}${childNodes}${closingTag}`; - } - // Caution: This is only supported in ssr mode - getDataIdString() { - return ` data-id="${this.#dataId}"`; - } - // Caution: This is only supported in ssr mode - getIdString() { - return fastn_utils.isNull(this.id) ? "" : ` id="${this.id}"`; - } - // Caution: This is only supported in ssr mode - getClassString() { - const classList = this.classList.toString(); - return classList ? ` class="${classList}"` : ""; - } - // Caution: This is only supported in ssr mode - getStyleString() { - const styleProperties = Object.entries(this.style) - .map(([prop, value]) => `${prop}:${value}`) - .join(";"); - return styleProperties ? ` style="${styleProperties}"` : ""; - } - // Caution: This is only supported in ssr mode - getAttributesString() { - const nodeAttributes = Object.entries(this.#attributes) - .map(([attribute, value]) => { - if (value !== undefined && value !== null && value !== "") { - return `${attribute}=\"${value}\"`; - } - return `${attribute}`; - }) - .join(" "); - return nodeAttributes ? ` ${nodeAttributes}` : ""; - } -} - -class Document2 { - createElement(tagName) { - id_counter++; - - if (ssr) { - return new Node(id_counter, tagName); - } - - if (tagName === "body") { - return window.document.body; - } - - if (fastn_utils.isWrapperNode(tagName)) { - return window.document.createComment(fastn_dom.commentMessage); - } - if (fastn_utils.isCommentNode(tagName)) { - return window.document.createComment(fastn_dom.commentMessage); - } - return window.document.createElement(tagName); - } -} - -fastnVirtual.document = new Document2(); - -function addClosureToBreakpointWidth() { - let closure = fastn.closureWithoutExecute(function () { - let current = ftd.get_device(); - let lastDevice = ftd.device.get(); - if (current === lastDevice) { - return; - } - console.log("last_device", lastDevice, "current_device", current); - ftd.device.set(current); - }); - - ftd.breakpoint_width.addClosure(closure); -} - -fastnVirtual.doubleBuffer = function (main) { - addClosureToBreakpointWidth(); - let parent = document.createElement("div"); - let current_device = ftd.get_device(); - ftd.device = fastn.mutable(current_device); - doubleBuffering = true; - fastnVirtual.root = parent; - main(parent); - fastn_utils.replaceBodyStyleAndChildren(parent); - doubleBuffering = false; - fastnVirtual.root = document.body; -}; - -fastnVirtual.ssr = function (main) { - ssr = true; - let body = fastnVirtual.document.createElement("body"); - main(body); - ssr = false; - id_counter = 0; - return body.toHtmlAsString() + fastn_dom.getClassesAsString(); -}; -class MutableVariable { - #value; - constructor(value) { - this.#value = value; - } - - get() { - return fastn_utils.getStaticValue(this.#value); - } - - set(value) { - this.#value.set(value); - } - // Todo: Remove closure when node is removed. - on_change(func) { - this.#value.addClosure(fastn.closureWithoutExecute(func)); - } -} - -class MutableListVariable { - #value; - constructor(value) { - this.#value = value; - } - get() { - return fastn_utils.getStaticValue(this.#value); - } - set(index, list) { - if (list === undefined) { - this.#value.set(fastn_utils.staticToMutables(index)); - return; - } - this.#value.set(index, fastn_utils.staticToMutables(list)); - } - insertAt(index, value) { - this.#value.insertAt(index, fastn_utils.staticToMutables(value)); - } - deleteAt(index) { - this.#value.deleteAt(index); - } - push(value) { - this.#value.push(value); - } - pop() { - this.#value.pop(); - } - clearAll() { - this.#value.clearAll(); - } - on_change(func) { - this.#value.addClosure(fastn.closureWithoutExecute(func)); - } -} - -class RecordVariable { - #value; - constructor(value) { - this.#value = value; - } - - get() { - return fastn_utils.getStaticValue(this.#value); - } - - set(record) { - this.#value.set(fastn_utils.staticToMutables(record)); - } - - on_change(func) { - this.#value.addClosure(fastn.closureWithoutExecute(func)); - } -} -class StaticVariable { - #value; - #closures; - constructor(value) { - this.#value = value; - this.#closures = []; - if (this.#value instanceof fastn.mutableClass) { - this.#value.addClosure( - fastn.closure(() => - this.#closures.forEach((closure) => closure.update()), - ), - ); - } - } - - get() { - return fastn_utils.getStaticValue(this.#value); - } - - on_change(func) { - if (this.#value instanceof fastn.mutableClass) { - this.#value.addClosure(fastn.closure(func)); - } - } -} - -fastn.webComponentVariable = { - mutable: (value) => { - return new MutableVariable(value); - }, - mutableList: (value) => { - return new MutableListVariable(value); - }, - static: (value) => { - return new StaticVariable(value); - }, - record: (value) => { - return new RecordVariable(value); - }, -}; -const ftd = (function () { - const exports = {}; - - const riveNodes = {}; - - const global = {}; - - const onLoadListeners = new Set(); - - let fastnLoaded = false; - - exports.global = global; - - exports.riveNodes = riveNodes; - - exports.is_empty = (value) => { - value = fastn_utils.getFlattenStaticValue(value); - return fastn_utils.isNull(value) || value.length === 0; - }; - - exports.len = (data) => { - if (!!data && data instanceof fastn.mutableListClass) { - if (data.getLength) return data.getLength(); - return -1; - } - if (!!data && data instanceof fastn.mutableClass) { - let inner_data = data.get(); - return exports.len(inner_data); - } - if (!!data && data.length) { - return data.length; - } - return -2; - }; - - exports.copy_to_clipboard = (args) => { - let text = args.a; - if (text instanceof fastn.mutableClass) - text = fastn_utils.getStaticValue(text); - if (text.startsWith("\\", 0)) { - text = text.substring(1); - } - if (!navigator.clipboard) { - fallbackCopyTextToClipboard(text); - return; - } - navigator.clipboard.writeText(text).then( - function () { - console.log("Async: Copying to clipboard was successful!"); - }, - function (err) { - console.error("Async: Could not copy text: ", err); - }, - ); - }; - - // Todo: Implement this (Remove highlighter) - exports.clean_code = (args) => args.a; - - exports.set_rive_boolean = (args, node) => { - if (!!args.rive) { - let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; - node = riveNode ? riveNode : node; - } - let riveConst = node.getExtraData().rive; - const stateMachineName = riveConst.stateMachineNames[0]; - const inputs = riveConst.stateMachineInputs(stateMachineName); - const bumpTrigger = inputs.find((i) => i.name === args.input); - bumpTrigger.value = args.value; - }; - - exports.toggle_rive_boolean = (args, node) => { - if (!!args.rive) { - let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; - node = riveNode ? riveNode : node; - } - let riveConst = node.getExtraData().rive; - const stateMachineName = riveConst.stateMachineNames[0]; - const inputs = riveConst.stateMachineInputs(stateMachineName); - const trigger = inputs.find((i) => i.name === args.input); - trigger.value = !trigger.value; - }; - - exports.set_rive_integer = (args, node) => { - if (!!args.rive) { - let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; - node = riveNode ? riveNode : node; - } - let riveConst = node.getExtraData().rive; - const stateMachineName = riveConst.stateMachineNames[0]; - const inputs = riveConst.stateMachineInputs(stateMachineName); - const trigger = inputs.find((i) => i.name === args.input); - trigger.value = args.value; - }; - - exports.fire_rive = (args, node) => { - if (!!args.rive) { - let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; - node = riveNode ? riveNode : node; - } - let riveConst = node.getExtraData().rive; - const stateMachineName = riveConst.stateMachineNames[0]; - const inputs = riveConst.stateMachineInputs(stateMachineName); - const trigger = inputs.find((i) => i.name === args.input); - trigger.fire(); - }; - - exports.play_rive = (args, node) => { - if (!!args.rive) { - let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; - node = riveNode ? riveNode : node; - } - node.getExtraData().rive.play(args.input); - }; - - exports.pause_rive = (args, node) => { - if (!!args.rive) { - let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; - node = riveNode ? riveNode : node; - } - node.getExtraData().rive.pause(args.input); - }; - - exports.toggle_play_rive = (args, node) => { - if (!!args.rive) { - let riveNode = riveNodes[`${args.rive}__${exports.device.get()}`]; - node = riveNode ? riveNode : node; - } - let riveConst = node.getExtraData().rive; - riveConst.playingAnimationNames.includes(args.input) - ? riveConst.pause(args.input) - : riveConst.play(args.input); - }; - - exports.get = (value, index) => { - return fastn_utils.getStaticValue( - fastn_utils.getterByKey(value, index), - ); - }; - - exports.component_data = (component) => { - let attributesIndex = component.getAttribute( - fastn_dom.webComponentArgument, - ); - let attributes = fastn_dom.webComponent[attributesIndex]; - return Object.fromEntries( - Object.entries(attributes).map(([k, v]) => { - // Todo: check if argument is mutable reference or not - if (v instanceof fastn.mutableClass) { - v = fastn.webComponentVariable.mutable(v); - } else if (v instanceof fastn.mutableListClass) { - v = fastn.webComponentVariable.mutableList(v); - } else if (v instanceof fastn.recordInstanceClass) { - v = fastn.webComponentVariable.record(v); - } else { - v = fastn.webComponentVariable.static(v); - } - return [k, v]; - }), - ); - }; - - exports.append = function (list, item) { - list.push(item); - }; - exports.pop = function (list) { - list.pop(); - }; - exports.insert_at = function (list, index, item) { - list.insertAt(index, item); - }; - exports.delete_at = function (list, index) { - list.deleteAt(index); - }; - exports.clear_all = function (list) { - list.clearAll(); - }; - exports.clear = exports.clear_all; - exports.set_list = function (list, value) { - list.set(value); - }; - - exports.http = function (url, opts, ...body) { - if ((!opts) instanceof fastn.recordInstanceClass) { - console.info(`opts must be a record instance of - -- record ftd.http-options: - string method: GET - string redirect: manual - string fastn-module: - `); - throw new Error("invalid opts"); - } - - let method = opts.get("method").get(); - let fastn_module = opts.get("fastn_module").get(); - let redirect = opts.get("redirect").get(); - - if (!["manual", "follow", "error"].includes(redirect)) { - throw new Error( - `redirect must be one of "manual", "follow", "error"`, - ); - } - - if (url instanceof fastn.mutableClass) url = url.get(); - method = method.trim().toUpperCase(); - let request_json = {}; - - const init = { - method, - headers: { "Content-Type": "application/json" }, - json: null, - redirect, - }; - - if (method === "GET") { - console.warn("Method `GET` is not yet supported."); - return; - } - - if (body && method !== "GET") { - if (body[0] instanceof fastn.recordInstanceClass) { - if (body.length !== 1) { - console.warn( - "body is a record instance, but has more than 1 element, ignoring", - ); - } - request_json = body[0].toObject(); - } else { - let json = body[0]; - if ( - body.length !== 1 || - (body[0].length === 2 && Array.isArray(body[0])) - ) { - let new_json = {}; - // @ts-ignore - for (let [header, value] of Object.entries(body)) { - let [key, val] = - value.length === 2 ? value : [header, value]; - new_json[key] = fastn_utils.getStaticValue(val); - } - json = new_json; - } - request_json = json; - } - } - - init.body = JSON.stringify(request_json); - - let json; - fetch(url, init) - .then((res) => { - if (res.redirected) { - window.location.href = res.url; - return; - } - - if (!res.ok) { - return new Error("[http]: Request failed", res); - } - - return res.json(); - }) - .then((response) => { - console.log("[http]: Response OK", response); - if (response.redirect) { - window.location.href = response.redirect; - } else if (!!response && !!response.reload) { - window.location.reload(); - } else { - let data = {}; - if (!!response.errors) { - for (let key of Object.keys(response.errors)) { - let value = response.errors[key]; - if (Array.isArray(value)) { - // django returns a list of strings - value = value.join(" "); - } - // also django does not append `-error` - key = key + "-error"; - key = fastn_module + "#" + key; - data[key] = value; - } - } - if (!!response.data) { - if (Object.keys(data).length !== 0) { - console.log( - "both .errors and .data are present in response, ignoring .data", - ); - } else { - data = response.data; - } - } - for (let ftd_variable of Object.keys(data)) { - // @ts-ignore - window.ftd.set_value(ftd_variable, data[ftd_variable]); - } - } - }) - .catch(console.error); - return json; - }; - - exports.navigate = function (url, request_data) { - let query_parameters = new URLSearchParams(); - if (request_data instanceof fastn.recordInstanceClass) { - // @ts-ignore - for (let [header, value] of Object.entries( - request_data.toObject(), - )) { - let [key, val] = value.length === 2 ? value : [header, value]; - query_parameters.set(key, val); - } - } - let query_string = query_parameters.toString(); - if (query_string) { - window.location.href = url + "?" + query_parameters.toString(); - } else { - window.location.href = url; - } - }; - - exports.toggle_dark_mode = function () { - const is_dark_mode = exports.get(exports.dark_mode); - if (is_dark_mode) { - enable_light_mode(); - } else { - enable_dark_mode(); - } - }; - - exports.local_storage = { - _get_key(key) { - if (key instanceof fastn.mutableClass) { - key = key.get(); - } - const packageNamePrefix = __fastn_package_name__ - ? `${__fastn_package_name__}_` - : ""; - const snakeCaseKey = fastn_utils.toSnakeCase(key); - - return `${packageNamePrefix}${snakeCaseKey}`; - }, - set(key, value) { - key = this._get_key(key); - value = fastn_utils.getFlattenStaticValue(value); - localStorage.setItem( - key, - value && typeof value === "object" - ? JSON.stringify(value) - : value, - ); - }, - get(key) { - key = this._get_key(key); - if (ssr) { - return; - } - const item = localStorage.getItem(key); - if (!item) { - return; - } - try { - const obj = JSON.parse(item); - - return fastn_utils.staticToMutables(obj); - } catch { - return item; - } - }, - delete(key) { - key = this._get_key(key); - localStorage.removeItem(key); - }, - }; - - exports.on_load = (listener) => { - if (typeof listener !== "function") { - throw new Error("listener must be a function"); - } - - if (fastnLoaded) { - listener(); - return; - } - - onLoadListeners.add(listener); - }; - - exports.emit_on_load = () => { - if (fastnLoaded) return; - - fastnLoaded = true; - onLoadListeners.forEach((listener) => listener()); - }; - - // LEGACY - - function legacyNameToJS(s) { - let name = s.toString(); - - if (name[0].charCodeAt(0) >= 48 && name[0].charCodeAt(0) <= 57) { - name = "_" + name; - } - - return name - .replaceAll("#", "__") - .replaceAll("-", "_") - .replaceAll(":", "___") - .replaceAll(",", "$") - .replaceAll("\\", "/") - .replaceAll("/", "_") - .replaceAll(".", "_"); - } - - function getDocNameAndRemaining(s) { - let part1 = ""; - let patternToSplitAt = s; - - const split1 = s.split("#"); - if (split1.length === 2) { - part1 = split1[0] + "#"; - patternToSplitAt = split1[1]; - } - - const split2 = patternToSplitAt.split("."); - if (split2.length === 2) { - return [part1 + split2[0], split2[1]]; - } else { - return [s, null]; - } - } - - function isMutable(obj) { - return ( - obj instanceof fastn.mutableClass || - obj instanceof fastn.mutableListClass || - obj instanceof fastn.recordInstanceClass - ); - } - - exports.set_value = function (variable, value) { - const [var_name, remaining] = getDocNameAndRemaining(variable); - let name = legacyNameToJS(var_name); - if (global[name] === undefined) { - console.log( - `[ftd-legacy]: ${variable} is not in global map, ignoring`, - ); - return; - } - const mutable = global[name]; - if (!isMutable(mutable)) { - console.log(`[ftd-legacy]: ${variable} is not a mutable, ignoring`); - return; - } - if (remaining) { - mutable.get(remaining).set(value); - } else { - mutable.set(value); - } - }; - - exports.get_value = function (variable) { - const [var_name, remaining] = getDocNameAndRemaining(variable); - let name = legacyNameToJS(var_name); - if (global[name] === undefined) { - console.log( - `[ftd-legacy]: ${variable} is not in global map, ignoring`, - ); - return; - } - const value = global[name]; - if (isMutable(value)) { - if (remaining) { - return value.get(remaining); - } else { - return value.get(); - } - } else { - return value; - } - }; - - // Language related functions --------------------------------------------- - exports.set_current_language = function (language) { - language = fastn_utils.getStaticValue(language); - fastn_utils.private.setCookie("fastn-lang", language); - location.reload(); - }; - - exports.get_current_language = function () { - return fastn_utils.private.getCookie("fastn-lang"); - }; - - return exports; -})(); - -const len = ftd.len; - -const global = ftd.global; -ftd.clickOutsideEvents = []; -ftd.globalKeyEvents = []; -ftd.globalKeySeqEvents = []; - -ftd.get_device = function () { - const MOBILE_CLASS = "mobile"; - // not at all sure about this function logic. - let width = window.innerWidth; - // In the future, we may want to have more than one break points, and - // then we may also want the theme builders to decide where the - // breakpoints should go. we should be able to fetch fpm variables - // here, or maybe simply pass the width, user agent etc. to fpm and - // let people put the checks on width user agent etc., but it would - // be good if we can standardize few breakpoints. or maybe we should - // do both, some standard breakpoints and pass the raw data. - // we would then rename this function to detect_device() which will - // return one of "desktop", "mobile". and also maybe have another - // function detect_orientation(), "landscape" and "portrait" etc., - // and instead of setting `ftd#mobile: boolean` we set `ftd#device` - // and `ftd#view-port-orientation` etc. - let mobile_breakpoint = fastn_utils.getStaticValue( - ftd.breakpoint_width.get("mobile"), - ); - if (width <= mobile_breakpoint) { - document.body.classList.add(MOBILE_CLASS); - return fastn_dom.DeviceData.Mobile; - } - if (document.body.classList.contains(MOBILE_CLASS)) { - document.body.classList.remove(MOBILE_CLASS); - } - return fastn_dom.DeviceData.Desktop; -}; - -ftd.post_init = function () { - const DARK_MODE_COOKIE = "fastn-dark-mode"; - const COOKIE_SYSTEM_LIGHT = "system-light"; - const COOKIE_SYSTEM_DARK = "system-dark"; - const COOKIE_DARK_MODE = "dark"; - const COOKIE_LIGHT_MODE = "light"; - const DARK_MODE_CLASS = "dark"; - let last_device = ftd.device.get(); - - window.onresize = function () { - initialise_device(); - }; - function initialise_click_outside_events() { - document.addEventListener("click", function (event) { - ftd.clickOutsideEvents.forEach(([ftdNode, func]) => { - let node = ftdNode.getNode(); - if ( - !!node && - node.style.display !== "none" && - !node.contains(event.target) - ) { - func(); - } - }); - }); - } - function initialise_global_key_events() { - let globalKeys = {}; - let buffer = []; - let lastKeyTime = Date.now(); - - document.addEventListener("keydown", function (event) { - let eventKey = fastn_utils.getEventKey(event); - globalKeys[eventKey] = true; - const currentTime = Date.now(); - if (currentTime - lastKeyTime > 1000) { - buffer = []; - } - lastKeyTime = currentTime; - if ( - (event.target.nodeName === "INPUT" || - event.target.nodeName === "TEXTAREA") && - eventKey !== "ArrowDown" && - eventKey !== "ArrowUp" && - eventKey !== "ArrowRight" && - eventKey !== "ArrowLeft" && - event.target.nodeName === "INPUT" && - eventKey !== "Enter" - ) { - return; - } - buffer.push(eventKey); - - ftd.globalKeyEvents.forEach(([_ftdNode, func, array]) => { - let globalKeysPresent = array.reduce( - (accumulator, currentValue) => - accumulator && !!globalKeys[currentValue], - true, - ); - if ( - globalKeysPresent && - buffer.join(",").includes(array.join(",")) - ) { - func(); - globalKeys[eventKey] = false; - buffer = []; - } - return; - }); - - ftd.globalKeySeqEvents.forEach(([_ftdNode, func, array]) => { - if (buffer.join(",").includes(array.join(","))) { - func(); - globalKeys[eventKey] = false; - buffer = []; - } - return; - }); - }); - - document.addEventListener("keyup", function (event) { - globalKeys[fastn_utils.getEventKey(event)] = false; - }); - } - function initialise_device() { - let current = ftd.get_device(); - if (current === last_device) { - return; - } - console.log("last_device", last_device, "current_device", current); - ftd.device.set(current); - last_device = current; - } - - /* - ftd.dark-mode behaviour: - - ftd.dark-mode is a boolean, default false, it tells the UI to show - the UI in dark or light mode. Themes should use this variable to decide - which mode to show in UI. - - ftd.follow-system-dark-mode, boolean, default true, keeps track if - we are reading the value of `dark-mode` from system preference, or user - has overridden the system preference. - - These two variables must not be set by ftd code directly, but they must - use `$on-click$: message-host enable-dark-mode`, to ignore system - preference and use dark mode. `$on-click$: message-host - disable-dark-mode` to ignore system preference and use light mode and - `$on-click$: message-host follow-system-dark-mode` to ignore user - preference and start following system preference. - - we use a cookie: `ftd-dark-mode` to store the preference. The cookie can - have three values: - - cookie missing / user wants us to honour system preference - system-light and currently its light. - - system-dark follow system and currently its dark. - - light: user prefers light - - dark: user prefers light - - We use cookie instead of localstorage so in future `fpm-repo` can see - users preferences up front and renders the HTML on service wide - following user's preference. - - */ - window.enable_dark_mode = function () { - // TODO: coalesce the two set_bool-s into one so there is only one DOM - // update - ftd.dark_mode.set(true); - ftd.follow_system_dark_mode.set(false); - ftd.system_dark_mode.set(system_dark_mode()); - document.body.classList.add(DARK_MODE_CLASS); - set_cookie(DARK_MODE_COOKIE, COOKIE_DARK_MODE); - }; - window.enable_light_mode = function () { - // TODO: coalesce the two set_bool-s into one so there is only one DOM - // update - ftd.dark_mode.set(false); - ftd.follow_system_dark_mode.set(false); - ftd.system_dark_mode.set(system_dark_mode()); - if (document.body.classList.contains(DARK_MODE_CLASS)) { - document.body.classList.remove(DARK_MODE_CLASS); - } - set_cookie(DARK_MODE_COOKIE, COOKIE_LIGHT_MODE); - }; - window.enable_system_mode = function () { - // TODO: coalesce the two set_bool-s into one so there is only one DOM - // update - let systemMode = system_dark_mode(); - ftd.follow_system_dark_mode.set(true); - ftd.system_dark_mode.set(systemMode); - if (systemMode) { - ftd.dark_mode.set(true); - document.body.classList.add(DARK_MODE_CLASS); - set_cookie(DARK_MODE_COOKIE, COOKIE_SYSTEM_DARK); - } else { - ftd.dark_mode.set(false); - if (document.body.classList.contains(DARK_MODE_CLASS)) { - document.body.classList.remove(DARK_MODE_CLASS); - } - set_cookie(DARK_MODE_COOKIE, COOKIE_SYSTEM_LIGHT); - } - }; - function set_cookie(name, value) { - document.cookie = name + "=" + value + "; path=/"; - } - function system_dark_mode() { - return !!( - window.matchMedia && - window.matchMedia("(prefers-color-scheme: dark)").matches - ); - } - function initialise_dark_mode() { - update_dark_mode(); - start_watching_dark_mode_system_preference(); - } - function get_cookie(name, def) { - // source: https://stackoverflow.com/questions/5639346/ - let regex = document.cookie.match( - "(^|;)\\s*" + name + "\\s*=\\s*([^;]+)", - ); - return regex !== null ? regex.pop() : def; - } - function update_dark_mode() { - let current_dark_mode_cookie = get_cookie( - DARK_MODE_COOKIE, - COOKIE_SYSTEM_LIGHT, - ); - switch (current_dark_mode_cookie) { - case COOKIE_SYSTEM_LIGHT: - case COOKIE_SYSTEM_DARK: - window.enable_system_mode(); - break; - case COOKIE_LIGHT_MODE: - window.enable_light_mode(); - break; - case COOKIE_DARK_MODE: - window.enable_dark_mode(); - break; - default: - console_log("cookie value is wrong", current_dark_mode_cookie); - window.enable_system_mode(); - } - } - function start_watching_dark_mode_system_preference() { - window - .matchMedia("(prefers-color-scheme: dark)") - .addEventListener("change", update_dark_mode); - } - initialise_device(); - initialise_dark_mode(); - initialise_click_outside_events(); - initialise_global_key_events(); - fastn_utils.resetFullHeight(); - fastn_utils.setFullHeight(); -}; - -window.ftd = ftd; - -ftd.toggle = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - let fastn_utils_val___args___a = fastn_utils.clone(!fastn_utils.getStaticValue(__args__.a)); - if (fastn_utils_val___args___a instanceof fastn.mutableClass) { - fastn_utils_val___args___a = fastn_utils_val___args___a.get(); - } - if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { - __args__.a = fastn_utils_val___args___a; - } - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.increment = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - let fastn_utils_val___args___a = fastn_utils.clone(fastn_utils.getStaticValue(__args__.a) + 1); - if (fastn_utils_val___args___a instanceof fastn.mutableClass) { - fastn_utils_val___args___a = fastn_utils_val___args___a.get(); - } - if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { - __args__.a = fastn_utils_val___args___a; - } - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.increment_by = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - let fastn_utils_val___args___a = fastn_utils.clone(fastn_utils.getStaticValue(__args__.a) + fastn_utils.getStaticValue(__args__.v)); - if (fastn_utils_val___args___a instanceof fastn.mutableClass) { - fastn_utils_val___args___a = fastn_utils_val___args___a.get(); - } - if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { - __args__.a = fastn_utils_val___args___a; - } - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.decrement = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - let fastn_utils_val___args___a = fastn_utils.clone(fastn_utils.getStaticValue(__args__.a) - 1); - if (fastn_utils_val___args___a instanceof fastn.mutableClass) { - fastn_utils_val___args___a = fastn_utils_val___args___a.get(); - } - if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { - __args__.a = fastn_utils_val___args___a; - } - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.decrement_by = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - let fastn_utils_val___args___a = fastn_utils.clone(fastn_utils.getStaticValue(__args__.a) - fastn_utils.getStaticValue(__args__.v)); - if (fastn_utils_val___args___a instanceof fastn.mutableClass) { - fastn_utils_val___args___a = fastn_utils_val___args___a.get(); - } - if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { - __args__.a = fastn_utils_val___args___a; - } - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.enable_light_mode = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - return (enable_light_mode()); - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.enable_dark_mode = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - return (enable_dark_mode()); - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.enable_system_mode = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - return (enable_system_mode()); - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.set_bool = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - let fastn_utils_val___args___a = fastn_utils.clone(__args__.v); - if (fastn_utils_val___args___a instanceof fastn.mutableClass) { - fastn_utils_val___args___a = fastn_utils_val___args___a.get(); - } - if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { - __args__.a = fastn_utils_val___args___a; - } - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.set_boolean = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - let fastn_utils_val___args___a = fastn_utils.clone(__args__.v); - if (fastn_utils_val___args___a instanceof fastn.mutableClass) { - fastn_utils_val___args___a = fastn_utils_val___args___a.get(); - } - if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { - __args__.a = fastn_utils_val___args___a; - } - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.set_string = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - let fastn_utils_val___args___a = fastn_utils.clone(__args__.v); - if (fastn_utils_val___args___a instanceof fastn.mutableClass) { - fastn_utils_val___args___a = fastn_utils_val___args___a.get(); - } - if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { - __args__.a = fastn_utils_val___args___a; - } - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.set_integer = function (args) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - let fastn_utils_val___args___a = fastn_utils.clone(__args__.v); - if (fastn_utils_val___args___a instanceof fastn.mutableClass) { - fastn_utils_val___args___a = fastn_utils_val___args___a.get(); - } - if (!fastn_utils.setter(__args__.a, fastn_utils_val___args___a)) { - __args__.a = fastn_utils_val___args___a; - } - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -ftd.dark_mode = fastn.mutable(false); -ftd.empty = ""; -ftd.space = " "; -ftd.nbsp = " "; -ftd.non_breaking_space = " "; -ftd.system_dark_mode = fastn.mutable(false); -ftd.follow_system_dark_mode = fastn.mutable(true); -ftd.font_display = fastn.mutable("sans-serif"); -ftd.font_copy = fastn.mutable("sans-serif"); -ftd.font_code = fastn.mutable("sans-serif"); -ftd.default_types = function () { - let record = fastn.recordInstance({ - }); - record.set("heading_large", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(50)); - record.set("line_height", fastn_dom.FontSize.Px(65)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(36)); - record.set("line_height", fastn_dom.FontSize.Px(54)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - record.set("heading_medium", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(38)); - record.set("line_height", fastn_dom.FontSize.Px(57)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(26)); - record.set("line_height", fastn_dom.FontSize.Px(40)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - record.set("heading_small", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(24)); - record.set("line_height", fastn_dom.FontSize.Px(31)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(22)); - record.set("line_height", fastn_dom.FontSize.Px(29)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - record.set("heading_hero", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(80)); - record.set("line_height", fastn_dom.FontSize.Px(104)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(48)); - record.set("line_height", fastn_dom.FontSize.Px(64)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - record.set("heading_tiny", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(20)); - record.set("line_height", fastn_dom.FontSize.Px(26)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(18)); - record.set("line_height", fastn_dom.FontSize.Px(24)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - record.set("copy_small", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(14)); - record.set("line_height", fastn_dom.FontSize.Px(24)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_copy); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(12)); - record.set("line_height", fastn_dom.FontSize.Px(16)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_copy); - return record; - }()); - return record; - }()); - record.set("copy_regular", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(18)); - record.set("line_height", fastn_dom.FontSize.Px(30)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_copy); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(16)); - record.set("line_height", fastn_dom.FontSize.Px(24)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_copy); - return record; - }()); - return record; - }()); - record.set("copy_large", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(22)); - record.set("line_height", fastn_dom.FontSize.Px(34)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_copy); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(18)); - record.set("line_height", fastn_dom.FontSize.Px(28)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_copy); - return record; - }()); - return record; - }()); - record.set("fine_print", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(12)); - record.set("line_height", fastn_dom.FontSize.Px(16)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_code); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(12)); - record.set("line_height", fastn_dom.FontSize.Px(16)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_code); - return record; - }()); - return record; - }()); - record.set("blockquote", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(16)); - record.set("line_height", fastn_dom.FontSize.Px(21)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_code); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(16)); - record.set("line_height", fastn_dom.FontSize.Px(21)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_code); - return record; - }()); - return record; - }()); - record.set("source_code", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(18)); - record.set("line_height", fastn_dom.FontSize.Px(30)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_code); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(16)); - record.set("line_height", fastn_dom.FontSize.Px(21)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_code); - return record; - }()); - return record; - }()); - record.set("button_small", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(14)); - record.set("line_height", fastn_dom.FontSize.Px(19)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(14)); - record.set("line_height", fastn_dom.FontSize.Px(19)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - record.set("button_medium", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(16)); - record.set("line_height", fastn_dom.FontSize.Px(21)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(16)); - record.set("line_height", fastn_dom.FontSize.Px(21)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - record.set("button_large", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(18)); - record.set("line_height", fastn_dom.FontSize.Px(24)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(18)); - record.set("line_height", fastn_dom.FontSize.Px(24)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - record.set("link", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(14)); - record.set("line_height", fastn_dom.FontSize.Px(19)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(14)); - record.set("line_height", fastn_dom.FontSize.Px(19)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - record.set("label_large", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(14)); - record.set("line_height", fastn_dom.FontSize.Px(19)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(14)); - record.set("line_height", fastn_dom.FontSize.Px(19)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - record.set("label_small", function () { - let record = fastn.recordInstance({ - }); - record.set("desktop", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(12)); - record.set("line_height", fastn_dom.FontSize.Px(16)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - record.set("mobile", function () { - let record = fastn.recordInstance({ - }); - record.set("size", fastn_dom.FontSize.Px(12)); - record.set("line_height", fastn_dom.FontSize.Px(16)); - record.set("letter_spacing", null); - record.set("weight", 400); - record.set("font_family", ftd.font_display); - return record; - }()); - return record; - }()); - return record; -}(); -ftd.default_colors = function () { - let record = fastn.recordInstance({ - }); - record.set("background", function () { - let record = fastn.recordInstance({ - }); - record.set("base", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#e7e7e4"); - record.set("dark", "#18181b"); - return record; - }()); - record.set("step_1", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#f3f3f3"); - record.set("dark", "#141414"); - return record; - }()); - record.set("step_2", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#c9cece"); - record.set("dark", "#585656"); - return record; - }()); - record.set("overlay", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "rgba(0, 0, 0, 0.8)"); - record.set("dark", "rgba(0, 0, 0, 0.8)"); - return record; - }()); - record.set("code", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#F5F5F5"); - record.set("dark", "#21222C"); - return record; - }()); - return record; - }()); - record.set("border", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#434547"); - record.set("dark", "#434547"); - return record; - }()); - record.set("border_strong", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#919192"); - record.set("dark", "#919192"); - return record; - }()); - record.set("text", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#584b42"); - record.set("dark", "#a8a29e"); - return record; - }()); - record.set("text_strong", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#141414"); - record.set("dark", "#ffffff"); - return record; - }()); - record.set("shadow", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#007f9b"); - record.set("dark", "#007f9b"); - return record; - }()); - record.set("scrim", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#007f9b"); - record.set("dark", "#007f9b"); - return record; - }()); - record.set("cta_primary", function () { - let record = fastn.recordInstance({ - }); - record.set("base", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#2dd4bf"); - record.set("dark", "#2dd4bf"); - return record; - }()); - record.set("hover", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#2c9f90"); - record.set("dark", "#2c9f90"); - return record; - }()); - record.set("pressed", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#2cc9b5"); - record.set("dark", "#2cc9b5"); - return record; - }()); - record.set("disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "rgba(44, 201, 181, 0.1)"); - record.set("dark", "rgba(44, 201, 181, 0.1)"); - return record; - }()); - record.set("focused", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#2cbfac"); - record.set("dark", "#2cbfac"); - return record; - }()); - record.set("border", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#2b8074"); - record.set("dark", "#2b8074"); - return record; - }()); - record.set("border_disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#65b693"); - record.set("dark", "#65b693"); - return record; - }()); - record.set("text", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#feffff"); - record.set("dark", "#feffff"); - return record; - }()); - record.set("text_disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#65b693"); - record.set("dark", "#65b693"); - return record; - }()); - return record; - }()); - record.set("cta_secondary", function () { - let record = fastn.recordInstance({ - }); - record.set("base", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#4fb2df"); - record.set("dark", "#4fb2df"); - return record; - }()); - record.set("hover", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#40afe1"); - record.set("dark", "#40afe1"); - return record; - }()); - record.set("pressed", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#4fb2df"); - record.set("dark", "#4fb2df"); - return record; - }()); - record.set("disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "rgba(79, 178, 223, 0.1)"); - record.set("dark", "rgba(79, 178, 223, 0.1)"); - return record; - }()); - record.set("focused", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#4fb1df"); - record.set("dark", "#4fb1df"); - return record; - }()); - record.set("border", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#209fdb"); - record.set("dark", "#209fdb"); - return record; - }()); - record.set("border_disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#65b693"); - record.set("dark", "#65b693"); - return record; - }()); - record.set("text", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#584b42"); - record.set("dark", "#ffffff"); - return record; - }()); - record.set("text_disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#65b693"); - record.set("dark", "#65b693"); - return record; - }()); - return record; - }()); - record.set("cta_tertiary", function () { - let record = fastn.recordInstance({ - }); - record.set("base", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#556375"); - record.set("dark", "#556375"); - return record; - }()); - record.set("hover", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#c7cbd1"); - record.set("dark", "#c7cbd1"); - return record; - }()); - record.set("pressed", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#3b4047"); - record.set("dark", "#3b4047"); - return record; - }()); - record.set("disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "rgba(85, 99, 117, 0.1)"); - record.set("dark", "rgba(85, 99, 117, 0.1)"); - return record; - }()); - record.set("focused", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#e0e2e6"); - record.set("dark", "#e0e2e6"); - return record; - }()); - record.set("border", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#e2e4e7"); - record.set("dark", "#e2e4e7"); - return record; - }()); - record.set("border_disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#65b693"); - record.set("dark", "#65b693"); - return record; - }()); - record.set("text", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#ffffff"); - record.set("dark", "#ffffff"); - return record; - }()); - record.set("text_disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#65b693"); - record.set("dark", "#65b693"); - return record; - }()); - return record; - }()); - record.set("cta_danger", function () { - let record = fastn.recordInstance({ - }); - record.set("base", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#1C1B1F"); - record.set("dark", "#1C1B1F"); - return record; - }()); - record.set("hover", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#1C1B1F"); - record.set("dark", "#1C1B1F"); - return record; - }()); - record.set("pressed", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#1C1B1F"); - record.set("dark", "#1C1B1F"); - return record; - }()); - record.set("disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#1C1B1F"); - record.set("dark", "#1C1B1F"); - return record; - }()); - record.set("focused", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#1C1B1F"); - record.set("dark", "#1C1B1F"); - return record; - }()); - record.set("border", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#1C1B1F"); - record.set("dark", "#1C1B1F"); - return record; - }()); - record.set("border_disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#feffff"); - record.set("dark", "#feffff"); - return record; - }()); - record.set("text", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#1C1B1F"); - record.set("dark", "#1C1B1F"); - return record; - }()); - record.set("text_disabled", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#feffff"); - record.set("dark", "#feffff"); - return record; - }()); - return record; - }()); - record.set("accent", function () { - let record = fastn.recordInstance({ - }); - record.set("primary", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#2dd4bf"); - record.set("dark", "#2dd4bf"); - return record; - }()); - record.set("secondary", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#4fb2df"); - record.set("dark", "#4fb2df"); - return record; - }()); - record.set("tertiary", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#c5cbd7"); - record.set("dark", "#c5cbd7"); - return record; - }()); - return record; - }()); - record.set("error", function () { - let record = fastn.recordInstance({ - }); - record.set("base", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#f5bdbb"); - record.set("dark", "#311b1f"); - return record; - }()); - record.set("text", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#c62a21"); - record.set("dark", "#c62a21"); - return record; - }()); - record.set("border", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#df2b2b"); - record.set("dark", "#df2b2b"); - return record; - }()); - return record; - }()); - record.set("success", function () { - let record = fastn.recordInstance({ - }); - record.set("base", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#e3f0c4"); - record.set("dark", "#405508ad"); - return record; - }()); - record.set("text", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#467b28"); - record.set("dark", "#479f16"); - return record; - }()); - record.set("border", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#3d741f"); - record.set("dark", "#3d741f"); - return record; - }()); - return record; - }()); - record.set("info", function () { - let record = fastn.recordInstance({ - }); - record.set("base", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#c4edfd"); - record.set("dark", "#15223a"); - return record; - }()); - record.set("text", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#205694"); - record.set("dark", "#1f6feb"); - return record; - }()); - record.set("border", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#205694"); - record.set("dark", "#205694"); - return record; - }()); - return record; - }()); - record.set("warning", function () { - let record = fastn.recordInstance({ - }); - record.set("base", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#fbefba"); - record.set("dark", "#544607a3"); - return record; - }()); - record.set("text", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#966220"); - record.set("dark", "#d07f19"); - return record; - }()); - record.set("border", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#966220"); - record.set("dark", "#966220"); - return record; - }()); - return record; - }()); - record.set("custom", function () { - let record = fastn.recordInstance({ - }); - record.set("one", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#ed753a"); - record.set("dark", "#ed753a"); - return record; - }()); - record.set("two", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#f3db5f"); - record.set("dark", "#f3db5f"); - return record; - }()); - record.set("three", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#8fdcf8"); - record.set("dark", "#8fdcf8"); - return record; - }()); - record.set("four", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#7a65c7"); - record.set("dark", "#7a65c7"); - return record; - }()); - record.set("five", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#eb57be"); - record.set("dark", "#eb57be"); - return record; - }()); - record.set("six", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#ef8dd6"); - record.set("dark", "#ef8dd6"); - return record; - }()); - record.set("seven", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#7564be"); - record.set("dark", "#7564be"); - return record; - }()); - record.set("eight", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#d554b3"); - record.set("dark", "#d554b3"); - return record; - }()); - record.set("nine", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#ec8943"); - record.set("dark", "#ec8943"); - return record; - }()); - record.set("ten", function () { - let record = fastn.recordInstance({ - }); - record.set("light", "#da7a4a"); - record.set("dark", "#da7a4a"); - return record; - }()); - return record; - }()); - return record; -}(); -ftd.breakpoint_width = function () { - let record = fastn.recordInstance({ - }); - record.set("mobile", 768); - return record; -}(); -ftd.device = fastn.mutable(fastn_dom.DeviceData.Mobile); -let inherited = function () { - let record = fastn.recordInstance({ - }); - record.set("colors", ftd.default_colors.getClone().setAndReturn("is_root", true)); - record.set("types", ftd.default_types.getClone().setAndReturn("is_root", true)); - return record; -}(); diff --git a/fastn-core/tests/22-http-headers/output/index.ftd b/fastn-core/tests/22-http-headers/output/index.ftd deleted file mode 100644 index a28d9716c0..0000000000 --- a/fastn-core/tests/22-http-headers/output/index.ftd +++ /dev/null @@ -1,74 +0,0 @@ --- import: fastn/processors as pr - --- record auth-response: -string token: - --- record user-response: -integer id: -string username: -string email: -string firstName: -string lastName: - - - --- auth-response auth-res: -$processor$: pr.http -method: post -url: https://dummyjson.com/auth/login -username: kminchelle -password: 0lelplR -$header-content-type$: application/json - - - --- string bearer-token: $join(a = Bearer, b = *$auth-res.token) - - - --- user-response user-res: -$processor$: pr.http -method: get -url: https://dummyjson.com/auth/me -$header-authorization$: $bearer-token - - - --- display-user: $user-res - - - --- string join(a, b): -string a: -string b: - -a + " " + b - - - --- component display-user: -caption user-res user: - --- ftd.column: - --- ftd.row: -spacing.fixed.rem: 1 - --- ftd.text: Username: - --- ftd.text: $user-res.username - --- end: ftd.row - --- ftd.row: -spacing.fixed.rem: 1 - --- ftd.text: Email: - --- ftd.text: $user-res.email - --- end: ftd.row - --- end: ftd.column - --- end: display-user diff --git a/fastn-core/tests/22-http-headers/output/index.html b/fastn-core/tests/22-http-headers/output/index.html deleted file mode 100644 index 69ef7aa6db..0000000000 --- a/fastn-core/tests/22-http-headers/output/index.html +++ /dev/null @@ -1,474 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta charset="UTF-8"> - <base href="/"> - <meta content="fastn" name="generator"> - - - <script> - let __fastn_package_name__ = "fastn-stack.github.io/http-headers-test"; - - </script> - - - <script src="markdown-24E09EFC0C2B9A11DEA9AC71888EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js"></script> - <script src="prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js"></script> - <script src="default-B66C2B8914832538F78C67C1C127D24F3EA6B09FCD87BE0BFA432DD090583C5D.js"></script> - <link rel="stylesheet" href="prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css"> - - - - - <style> - /* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) - */ - -/*html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, embed, -figure, figcaption, footer, header, hgroup, -menu, nav, output, ruby, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} -!* HTML5 display-role reset for older browsers *! -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} -body { - line-height: 1; -} -ol, ul { - list-style: none; -} -blockquote, q { - quotes: none; -} -blockquote:before, blockquote:after, -q:before, q:after { - content: ''; - content: none; -} -table { - border-collapse: collapse; - border-spacing: 0; -}*/ - -*, :after, :before { - /*box-sizing: inherit;*/ - box-sizing: border-box; - text-decoration: none; - box-sizing: border-box; - border-top-width: 0px; - border-bottom-width: 0px; - border-left-width: 0px; - border-right-width: 0px; - border-style: solid; - height: auto; - width: auto; -} - -*, pre, div { - padding: 0; - margin: 0; - gap: 0; - outline: none; -} - - -body, ol ol, ol ul, ul ol, ul ul { - margin:0 -} -pre, table{ - overflow:auto -} -html { - height: 100%; - width: 100%; -} - -body { - height: 100%; - width: 100%; -} - -input { - vertical-align: middle; -} -pre { - white-space: break-spaces; - word-wrap: break-word; -} -html { - -webkit-font-smoothing: antialiased; - text-rendering: optimizelegibility; - -webkit-text-size-adjust: 100%; - text-size-adjust: 100%; -} -iframe { - border: 0; - color-scheme: auto; -} - -pre code { - /* - This break show-line-number in `ftd.code` - overflow-x: auto; - */ - display: block; - padding: 0 1em !important; -} - -/* Common styles */ -.ft_common{ - text-decoration: none; - box-sizing: border-box; - border-top-width: 0px; - border-bottom-width: 0px; - border-left-width: 0px; - border-right-width: 0px; - border-style: solid; - height: auto; - width: auto; -} - -/* Common container attributes */ -.ft_row, .ft_column { - display: flex; - align-items: start; - justify-content: start -} - -.ft_full_size { - width: 100%; - height: 100%; -} - -.ft_row { - display: flex; - align-items: start; - justify-content: start; - flex-direction: row; - box-sizing: border-box; -} -.ft_column { - display: flex; - align-items: start; - justify-content: start; - flex-direction: column; - box-sizing: border-box; -} - -.ft_row { - flex-direction: row; -} - -.ft_column { - flex-direction: column; -} - -.ft_md ul, -.ft_md ol{ - margin: 10px 0; -} - -.ft_md ul ul, -.ft_md ul ol, -.ft_md ol ul, -.ft_md ol ol { - margin: 0; -} - -.ft_md ul li, -.ft_md ol li, -.ft_md ul ol li .ft_md ul ul li .ft_md ol ul li .ft_md ol ol li { - position: relative; - padding-left: 32px; - margin: 4px 0; -} - -.ft_md ul { - list-style: none; - padding-left: 0; -} - -.ft_md ol { - list-style: none; - padding-left: 0; - counter-reset: item; -} - -.ft_md ol li:before, -.ft_md ol ol li:before, -.ft_md ul ol li:before { - content: counter(item); - counter-increment: item; - font-size: 11px; - line-height: 10px; - text-align: center; - padding: 4px 0; - height: 10px; - width: 18px; - border-radius: 10px; - position: absolute; - left: 0; - top: 5px; -} - -.ft_md ul li::before, -.ft_md ul ul li::before, -.ft_md ol ul li::before { - content: ""; - position: absolute; - width: 6px; - height: 6px; - left: 8px; - top: 10px; - border-radius: 50%; - background: #c1c8ce; -} - -ul, ol { - /* Added padding to the left to move the ol number/ ul bullet to the right */ - padding-left: 20px; -} - -a { - color: #2952a3; -} - -a:visited { - color: #856ab9; -} - -a:hover { - color: #24478f; -} - -.ft_md a { - text-decoration: none; -} - -.ft_md a:visited { - text-decoration: none; -} - -.ft_md a:hover { - text-decoration: none; -} - -code { - padding: 0.1rem 0.25rem; - border-radius: 4px; - background-color: #0000000d; -} - -.ft_md blockquote { - padding: 0.25rem 1rem; - margin: 1rem 0; - border-radius: 3px; -} - -.ft_md blockquote > blockquote { - margin: 0; -} - - -body.dark code { - padding: 0.1rem 0.25rem; - border-radius: 4px; - background-color: #ffffff1f; -} - - -body.dark a { - color: #6498ff -} - -body.dark a:visited { - color: #b793fb; -} - - -p { - margin-block-end: 1em; -} - -h1:only-child { - margin-block-end: 0.67em -} - -table, td, th { - border: 1px solid; -} - -th { - padding: 6px; -} - -td { - padding-left: 6px; - padding-right: 6px; - padding-top: 3px; - padding-bottom: 3px; -} - - </style> -</head> -<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"> -<body data-id="1"><div data-id="2" class="ft_column __w-1 __h-2"><div data-id="3" class="ft_column"><div data-id="4" class="ft_row __g-3"><div data-id="5">Username:</div><div data-id="6">kminchelle</div></div><div data-id="7" class="ft_row __g-4"><div data-id="8">Email:</div><div data-id="9"><a href="mailto:kminchelle@qq.com">kminchelle@qq.com</a></div></div></div></div></body><style id="styles"> - .__w-1 { width: 100%; } - .__h-2 { height: 100%; } - .__g-3 { gap: 1rem; } - .__g-4 { gap: 1rem; } - </style> -<script> - (function() { - let main = function (parent) { - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let parenti0 = fastn_stack_github_io_http_headers_test___display_user(parent, inherited, { - user: global.fastn_stack_github_io_http_headers_test___user_res - }); - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -global["main"] = main; -let fastn_stack_github_io_http_headers_test___join = function (args) -{ - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = fastn_utils.getArgs({ - }, args); - return (fastn_utils.getStaticValue(__args__.a) + " " + fastn_utils.getStaticValue(__args__.b)); - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -global["fastn_stack_github_io_http_headers_test___join"] = fastn_stack_github_io_http_headers_test___join; -fastn_utils.createNestedObject(global, "fastn_stack_github_io_http_headers_test___auth_res", function () { - let record = fastn.recordInstance({ - }); - record.set("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTUsInVzZXJuYW1lIjoia21pbmNoZWxsZSIsImVtYWlsIjoia21pbmNoZWxsZUBxcS5jb20iLCJmaXJzdE5hbWUiOiJKZWFubmUiLCJsYXN0TmFtZSI6IkhhbHZvcnNvbiIsImdlbmRlciI6ImZlbWFsZSIsImltYWdlIjoiaHR0cHM6Ly9yb2JvaGFzaC5vcmcvSmVhbm5lLnBuZz9zZXQ9c2V0NCIsImlhdCI6MTcwOTEwNTYzOSwiZXhwIjoxNzA5MTA5MjM5fQ.6JvfYxsrUZxctYe0nJ63eujlcRSnT1KQ9QRhSGqa2Wc"); - return record; -}()); -fastn_utils.createNestedObject(global, "fastn_stack_github_io_http_headers_test___bearer_token", fastn.formula([global.fastn_stack_github_io_http_headers_test___auth_res.get("token")], function () { - return fastn_stack_github_io_http_headers_test___join({ - a: "Bearer", - b: fastn_utils.clone(global.fastn_stack_github_io_http_headers_test___auth_res.get("token")), - }); -})); -fastn_utils.createNestedObject(global, "fastn_stack_github_io_http_headers_test___user_res", function () { - let record = fastn.recordInstance({ - }); - record.set("id", 15); - record.set("username", "kminchelle"); - record.set("email", "kminchelle@qq.com"); - record.set("firstName", "Jeanne"); - record.set("lastName", "Halvorson"); - return record; -}()); -let fastn_stack_github_io_http_headers_test___display_user = function (parent, inherited, args) -{ - let __fastn_super_package_name__ = __fastn_package_name__; - __fastn_package_name__ = "fastn_stack_github_io_http_headers_test"; - try { - let __args__ = { - }; - inherited = fastn_utils.getInheritedValues(__args__, inherited, args); - __args__ = fastn_utils.getArgs(__args__, args); - let parenti0 = fastn_dom.createKernel(parent, fastn_dom.ElementKind.Column); - parenti0.setProperty(fastn_dom.PropertyKind.Children, fastn.mutableList([function (root, inherited) { - let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Row); - rooti0.setProperty(fastn_dom.PropertyKind.Spacing, fastn_dom.Spacing.Fixed(fastn_dom.Length.Rem(1)), inherited); - rooti0.setProperty(fastn_dom.PropertyKind.Children, fastn.mutableList([function (root, inherited) { - let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Text); - rooti0.setProperty(fastn_dom.PropertyKind.StringValue, "Username:", inherited); - }, - function (root, inherited) { - let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Text); - rooti0.setProperty(fastn_dom.PropertyKind.StringValue, global.fastn_stack_github_io_http_headers_test___user_res.get("username"), inherited); - } - ]), inherited); - }, - function (root, inherited) { - let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Row); - rooti0.setProperty(fastn_dom.PropertyKind.Spacing, fastn_dom.Spacing.Fixed(fastn_dom.Length.Rem(1)), inherited); - rooti0.setProperty(fastn_dom.PropertyKind.Children, fastn.mutableList([function (root, inherited) { - let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Text); - rooti0.setProperty(fastn_dom.PropertyKind.StringValue, "Email:", inherited); - }, - function (root, inherited) { - let rooti0 = fastn_dom.createKernel(root, fastn_dom.ElementKind.Text); - rooti0.setProperty(fastn_dom.PropertyKind.StringValue, global.fastn_stack_github_io_http_headers_test___user_res.get("email"), inherited); - } - ]), inherited); - } - ]), inherited); - return parenti0; - } finally { - __fastn_package_name__ = __fastn_super_package_name__; - } -} -global["fastn_stack_github_io_http_headers_test___display_user"] = fastn_stack_github_io_http_headers_test___display_user; -fastn_dom.codeData.availableThemes["coldark-theme.dark"] = "code-theme-9A3284FD117DFF7CFD432FF860A5E14169FA592BC3DA4F5E8A6975143F5EA07F.css"; -fastn_dom.codeData.availableThemes["coldark-theme.light"] = "code-theme-99CD7B013C96C4632F0AEA39AC265387B814AE85A7D33666A4AE4BEFF59016D0.css"; -fastn_dom.codeData.availableThemes["coy-theme"] = "code-theme-B3AEA322EADEDA61F0E219845A0E9C8E73F6345E49362B46E6F52CEE40471248.css"; -fastn_dom.codeData.availableThemes["dracula-theme"] = "code-theme-0CA636E4954E3FC6184FB8000174F8EAA6C61DB10F6A18D74740E6D2032C1A2E.css"; -fastn_dom.codeData.availableThemes["duotone-theme.dark"] = "code-theme-95B9118AFC8631777EEBBD89B2066C3706A6DF3579B14F41AF05564E41CAA09C.css"; -fastn_dom.codeData.availableThemes["duotone-theme.earth"] = "code-theme-6EB6F03F9F578742CA0CD1189693E43A6135D910989ADD88CA3C0D6117EE24D7.css"; -fastn_dom.codeData.availableThemes["duotone-theme.forest"] = "code-theme-256C21B515FC9E77F95D88689A4086B9D9406B7AAE3A273780FE8B8748C5A7D2.css"; -fastn_dom.codeData.availableThemes["duotone-theme.light"] = "code-theme-0800A18B1822D6AFDAF807CF840379A2DB3483A1F058CA29FBCFB3815CA76148.css"; -fastn_dom.codeData.availableThemes["duotone-theme.sea"] = "code-theme-9A45313F167DBD90654BFD5BB3BC0BDF6AE447485C30B0389ADA7B49C069E46A.css"; -fastn_dom.codeData.availableThemes["duotone-theme.space"] = "code-theme-4DD8479BE14A755645BC09FF433FB70EB4CB28F0CBF3CA98DCB71B244B85B194.css"; -fastn_dom.codeData.availableThemes["fastn-theme.dark"] = "code-theme-F614177D3155EA8E915B35A3445175DC7C96D02FBC621F8AFD0FCCC417ED8A43.css"; -fastn_dom.codeData.availableThemes["fastn-theme.light"] = "code-theme-B8645DE281A38A3068C56919DE1BB0511696A1EE8002C5088748DA0BAC0806E6.css"; -fastn_dom.codeData.availableThemes["fire.light"] = "code-theme-A352AF572179AB980583D41BC41ADDBA36C4C17757A34C1C6AAAF2C253E25CE3.css"; -fastn_dom.codeData.availableThemes["gruvbox-theme.dark"] = "code-theme-B68AA27E05B319F04A9CD747AADBF9B9CD791E040DEC519AE9544B4FF65DDBAC.css"; -fastn_dom.codeData.availableThemes["gruvbox-theme.light"] = "code-theme-06E6F84E43C61CB1653D9F4FACD46B7EBCB3CD8A48EFAEF2E5BE3E9E9212D1E6.css"; -fastn_dom.codeData.availableThemes["laserwave-theme"] = "code-theme-0F444C6433C356376F7E92122F6C521FE40242BEC9D9E050359EE1DF4A9D5E6D.css"; -fastn_dom.codeData.availableThemes["material-theme.dark"] = "code-theme-8CCA3D600F91FA55950DF3132F2ABE4BA14CEEA13CD23E157BF6A137762B8452.css"; -fastn_dom.codeData.availableThemes["material-theme.light"] = "code-theme-8C59190F5018F48CCBB063359072EE9053D04923BBC5D1BA52B574E78D8C536A.css"; -fastn_dom.codeData.availableThemes["nightowl-theme"] = "code-theme-88F91252A8A0EA125B4BA2C7B85E65580DB580F1477931AADCB5118E4E69D1CD.css"; -fastn_dom.codeData.availableThemes["one-theme.dark"] = "code-theme-A24DC8F09D03756A62923E8A883CAE3B938D54E2813F0855312D2554DBE97BAD.css"; -fastn_dom.codeData.availableThemes["one-theme.light"] = "code-theme-60E02531E77333F3F1B636C4FC43E976EA9F41AD75268B2DD825C33C68B573A6.css"; -fastn_dom.codeData.availableThemes["vs-theme.dark"] = "code-theme-DC76F700474E809F7BA2D9914793D04881B17EA4699BA9C568C83D32A18B0173.css"; -fastn_dom.codeData.availableThemes["vs-theme.light"] = "code-theme-7852E516BA094B01897820BB3432BE553FE5B28F00E9CA0EBC9DFFB8312EE8BF.css"; -fastn_dom.codeData.availableThemes["ztouch-theme"] = "code-theme-792C7BB9F4C8DFF3E0CBC354D2084DBF71BC5750C2C1357F0E7D936867AFAB62.css"; - - let main_wrapper = function (parent) { - let parenti0 = fastn_dom.createKernel(parent, fastn_dom.ElementKind.Column); - parenti0.setProperty(fastn_dom.PropertyKind.Width, fastn_dom.Resizing.FillContainer, inherited); - parenti0.setProperty(fastn_dom.PropertyKind.Height, fastn_dom.Resizing.FillContainer, inherited); - main(parenti0); - } - fastnVirtual.doubleBuffer(main_wrapper); - ftd.post_init(); - })(); - - window.onload = function() { - fastn_utils.resetFullHeight(); - fastn_utils.setFullHeight(); - ftd.emit_on_load(); - }; -</script> -</html> diff --git a/fastn-core/tests/22-http-headers/output/manifest.json b/fastn-core/tests/22-http-headers/output/manifest.json deleted file mode 100644 index 5ddd3edb15..0000000000 --- a/fastn-core/tests/22-http-headers/output/manifest.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "files": { - "FASTN.ftd": { - "name": "FASTN.ftd", - "checksum": "743D9D38F836501B012A0CA4E75088B044DFCC64BDEB7D2476FF7A0952AE7AB1", - "size": 76 - }, - "index.ftd": { - "name": "index.ftd", - "checksum": "AAF986E8B3997246D6245240806C24547E0355D9A60258A2C72B3DBFFA54DAAD", - "size": 971 - } - }, - "zip_url": "https://codeload.github.com/fastn-stack/http-headers-test/zip/refs/heads/main", - "checksum": "E078712E2CC94F6F264CA98AEC6509BE579AC5C8BD329A6B9A72FB25435E525E" -} diff --git a/fastn-core/tests/22-http-headers/output/markdown-24E09EFC0C2B9A11DEA9AC71888EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js b/fastn-core/tests/22-http-headers/output/markdown-24E09EFC0C2B9A11DEA9AC71888EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js deleted file mode 100644 index eaa08fabf4..0000000000 --- a/fastn-core/tests/22-http-headers/output/markdown-24E09EFC0C2B9A11DEA9AC71888EB3A1E85864FA7D9C95A3EB5075A0E0F49A5F.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * marked v9.1.4 - a markdown parser - * Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed) - * https://github.com/markedjs/marked - */ -// Content taken from https://cdn.jsdelivr.net/npm/marked/marked.min.js -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).marked={})}(this,(function(e){"use strict";function t(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}function n(t){e.defaults=t}e.defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};const s=/[&<>"']/,r=new RegExp(s.source,"g"),i=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,l=new RegExp(i.source,"g"),o={"&":"&","<":"<",">":">",'"':""","'":"'"},a=e=>o[e];function c(e,t){if(t){if(s.test(e))return e.replace(r,a)}else if(i.test(e))return e.replace(l,a);return e}const h=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;const p=/(^|[^\[])\^/g;function u(e,t){e="string"==typeof e?e:e.source,t=t||"";const n={replace:(t,s)=>(s=(s="object"==typeof s&&"source"in s?s.source:s).replace(p,"$1"),e=e.replace(t,s),n),getRegex:()=>new RegExp(e,t)};return n}function g(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch(e){return null}return e}const k={exec:()=>null};function f(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let s=!1,r=t;for(;--r>=0&&"\\"===n[r];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(/\\\|/g,"|");return n}function d(e,t,n){const s=e.length;if(0===s)return"";let r=0;for(;r<s;){const i=e.charAt(s-r-1);if(i!==t||n){if(i===t||!n)break;r++}else r++}return e.slice(0,s-r)}function x(e,t,n,s){const r=t.href,i=t.title?c(t.title):null,l=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:n,href:r,title:i,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,e}return{type:"image",raw:n,href:r,title:i,text:c(l)}}class b{options;rules;lexer;constructor(t){this.options=t||e.defaults}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:d(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const s=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=d(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=d(t[0].replace(/^ *>[ \t]?/gm,""),"\n"),n=this.lexer.state.top;this.lexer.state.top=!0;const s=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:"blockquote",raw:t[0],tokens:s,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,r={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const i=new RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`);let l="",o="",a=!1;for(;e;){let n=!1;if(!(t=i.exec(e)))break;if(this.rules.block.hr.test(e))break;l=t[0],e=e.substring(l.length);let s=t[2].split("\n",1)[0].replace(/^\t+/,(e=>" ".repeat(3*e.length))),c=e.split("\n",1)[0],h=0;this.options.pedantic?(h=2,o=s.trimStart()):(h=t[2].search(/[^ ]/),h=h>4?1:h,o=s.slice(h),h+=t[1].length);let p=!1;if(!s&&/^ *$/.test(c)&&(l+=c+"\n",e=e.substring(c.length+1),n=!0),!n){const t=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),n=new RegExp(`^ {0,${Math.min(3,h-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),r=new RegExp(`^ {0,${Math.min(3,h-1)}}(?:\`\`\`|~~~)`),i=new RegExp(`^ {0,${Math.min(3,h-1)}}#`);for(;e;){const a=e.split("\n",1)[0];if(c=a,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),r.test(c))break;if(i.test(c))break;if(t.test(c))break;if(n.test(e))break;if(c.search(/[^ ]/)>=h||!c.trim())o+="\n"+c.slice(h);else{if(p)break;if(s.search(/[^ ]/)>=4)break;if(r.test(s))break;if(i.test(s))break;if(n.test(s))break;o+="\n"+c}p||c.trim()||(p=!0),l+=a+"\n",e=e.substring(a.length+1),s=c.slice(h)}}r.loose||(a?r.loose=!0:/\n *\n *$/.test(l)&&(a=!0));let u,g=null;this.options.gfm&&(g=/^\[[ xX]\] /.exec(o),g&&(u="[ ] "!==g[0],o=o.replace(/^\[[ xX]\] +/,""))),r.items.push({type:"list_item",raw:l,task:!!g,checked:u,loose:!1,text:o,tokens:[]}),r.raw+=l}r.items[r.items.length-1].raw=l.trimEnd(),r.items[r.items.length-1].text=o.trimEnd(),r.raw=r.raw.trimEnd();for(let e=0;e<r.items.length;e++)if(this.lexer.state.top=!1,r.items[e].tokens=this.lexer.blockTokens(r.items[e].text,[]),!r.loose){const t=r.items[e].tokens.filter((e=>"space"===e.type)),n=t.length>0&&t.some((e=>/\n.*\n/.test(e.raw)));r.loose=n}if(r.loose)for(let e=0;e<r.items.length;e++)r.items[e].loose=!0;return r}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(t){if(!/[:|]/.test(t[2]))return;const e={type:"table",raw:t[0],header:f(t[1]).map((e=>({text:e,tokens:[]}))),align:t[2].replace(/^\||\| *$/g,"").split("|"),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[]};if(e.header.length===e.align.length){let t,n,s,r,i=e.align.length;for(t=0;t<i;t++){const n=e.align[t];n&&(/^ *-+: *$/.test(n)?e.align[t]="right":/^ *:-+: *$/.test(n)?e.align[t]="center":/^ *:-+ *$/.test(n)?e.align[t]="left":e.align[t]=null)}for(i=e.rows.length,t=0;t<i;t++)e.rows[t]=f(e.rows[t],e.header.length).map((e=>({text:e,tokens:[]})));for(i=e.header.length,n=0;n<i;n++)e.header[n].tokens=this.lexer.inline(e.header[n].text);for(i=e.rows.length,n=0;n<i;n++)for(r=e.rows[n],s=0;s<r.length;s++)r[s].tokens=this.lexer.inline(r[s].text);return e}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:c(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=d(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;let n=0;for(let s=0;s<e.length;s++)if("\\"===e[s])s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),x(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return x(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrong.lDelim.exec(e);if(!s)return;if(s[3]&&n.match(/[\p{L}\p{N}]/u))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const n=[...s[0]].length-1;let r,i,l=n,o=0;const a="*"===s[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+s[0].length-1);null!=(s=a.exec(t));){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(i=[...r].length,s[3]||s[4]){l+=i;continue}if((s[5]||s[6])&&n%3&&!((n+i)%3)){o+=i;continue}if(l-=i,l>0)continue;i=Math.min(i,i+l+o);const t=[...e].slice(0,n+s.index+i+1).join("");if(Math.min(n,i)%2){const e=t.slice(1,-1);return{type:"em",raw:t,text:e,tokens:this.lexer.inlineTokens(e)}}const a=t.slice(2,-2);return{type:"strong",raw:t,text:a,tokens:this.lexer.inlineTokens(a)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return n&&s&&(e=e.substring(1,e.length-1)),e=c(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,n;return"@"===t[2]?(e=c(t[1]),n="mailto:"+e):(e=c(t[1]),n=e),{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if("@"===t[2])e=c(t[0]),n="mailto:"+e;else{let s;do{s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])[0]}while(s!==t[0]);e=c(t[0]),n="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:c(t[0]),{type:"text",raw:t[0],text:e}}}}const m={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:k,lheading:/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\.|[^\[\]\\])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};m.def=u(m.def).replace("label",m._label).replace("title",m._title).getRegex(),m.bullet=/(?:[*+-]|\d{1,9}[.)])/,m.listItemStart=u(/^( *)(bull) */).replace("bull",m.bullet).getRegex(),m.list=u(m.list).replace(/bull/g,m.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+m.def.source+")").getRegex(),m._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",m._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,m.html=u(m.html,"i").replace("comment",m._comment).replace("tag",m._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),m.lheading=u(m.lheading).replace(/bull/g,m.bullet).getRegex(),m.paragraph=u(m._paragraph).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.blockquote=u(m.blockquote).replace("paragraph",m.paragraph).getRegex(),m.normal={...m},m.gfm={...m.normal,table:"^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"},m.gfm.table=u(m.gfm.table).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.gfm.paragraph=u(m._paragraph).replace("hr",m.hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",m.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",m._tag).getRegex(),m.pedantic={...m.normal,html:u("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",m._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:k,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(m.normal._paragraph).replace("hr",m.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",m.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()};const w={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:k,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,rDelimAst:/^[^_*]*?__[^_*]*?\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\*)[punct](\*+)(?=[\s]|$)|[^punct\s](\*+)(?!\*)(?=[punct\s]|$)|(?!\*)[punct\s](\*+)(?=[^punct\s])|[\s](\*+)(?!\*)(?=[punct])|(?!\*)[punct](\*+)(?!\*)(?=[punct])|[^punct\s](\*+)(?=[^punct\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\s]|$)|[^punct\s](_+)(?!_)(?=[punct\s]|$)|(?!_)[punct\s](_+)(?=[^punct\s])|[\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:k,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^((?![*_])[\spunctuation])/,_punctuation:"\\p{P}$+<=>`^|~"};w.punctuation=u(w.punctuation,"u").replace(/punctuation/g,w._punctuation).getRegex(),w.blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,w.anyPunctuation=/\\[punct]/g,w._escapes=/\\([punct])/g,w._comment=u(m._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),w.emStrong.lDelim=u(w.emStrong.lDelim,"u").replace(/punct/g,w._punctuation).getRegex(),w.emStrong.rDelimAst=u(w.emStrong.rDelimAst,"gu").replace(/punct/g,w._punctuation).getRegex(),w.emStrong.rDelimUnd=u(w.emStrong.rDelimUnd,"gu").replace(/punct/g,w._punctuation).getRegex(),w.anyPunctuation=u(w.anyPunctuation,"gu").replace(/punct/g,w._punctuation).getRegex(),w._escapes=u(w._escapes,"gu").replace(/punct/g,w._punctuation).getRegex(),w._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,w._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,w.autolink=u(w.autolink).replace("scheme",w._scheme).replace("email",w._email).getRegex(),w._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,w.tag=u(w.tag).replace("comment",w._comment).replace("attribute",w._attribute).getRegex(),w._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,w._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,w._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,w.link=u(w.link).replace("label",w._label).replace("href",w._href).replace("title",w._title).getRegex(),w.reflink=u(w.reflink).replace("label",w._label).replace("ref",m._label).getRegex(),w.nolink=u(w.nolink).replace("ref",m._label).getRegex(),w.reflinkSearch=u(w.reflinkSearch,"g").replace("reflink",w.reflink).replace("nolink",w.nolink).getRegex(),w.normal={...w},w.pedantic={...w.normal,strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:u(/^!?\[(label)\]\((.*?)\)/).replace("label",w._label).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",w._label).getRegex()},w.gfm={...w.normal,escape:u(w.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},w.gfm.url=u(w.gfm.url,"i").replace("email",w.gfm._extended_email).getRegex(),w.breaks={...w.gfm,br:u(w.br).replace("{2,}","*").getRegex(),text:u(w.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};class _{tokens;options;state;tokenizer;inlineQueue;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||e.defaults,this.options.tokenizer=this.options.tokenizer||new b,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={block:m.normal,inline:w.normal};this.options.pedantic?(n.block=m.pedantic,n.inline=w.pedantic):this.options.gfm&&(n.block=m.gfm,this.options.breaks?n.inline=w.breaks:n.inline=w.gfm),this.tokenizer.rules=n}static get rules(){return{block:m,inline:w}}static lex(e,t){return new _(t).lex(e)}static lexInline(e,t){return new _(t).inlineTokens(e)}lex(e){let t;for(e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){let n,s,r,i;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,((e,t,n)=>t+" ".repeat(n.length)));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(n):(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(s.raw+="\n"+n.raw,s.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(r=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r)))s=t[t.length-1],i&&"paragraph"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),i=r.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,s,r,i,l,o,a=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(a));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(a));)a=a.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.anyPunctuation.exec(a));)a=a.slice(0,i.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(o=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,a,o))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e))){if(r=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((e=>{s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),l=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class y{options;constructor(t){this.options=t||e.defaults}code(e,t,n){const s=(t||"").match(/^\S*/)?.[0];return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="language-'+c(s)+'">'+(n?e:c(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:c(e,!0))+"</code></pre>\n"}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>\n`}hr(){return"<hr>\n"}list(e,t,n){const s=t?"ol":"ul";return"<"+s+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+s+">\n"}listitem(e,t,n){return`<li>${e}</li>\n`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph(e){return`<p>${e}</p>\n`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){const s=g(e);if(null===s)return n;let r='<a href="'+(e=s)+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image(e,t,n){const s=g(e);if(null===s)return n;let r=`<img src="${e=s}" alt="${n}"`;return t&&(r+=` title="${t}"`),r+=">",r}text(e){return e}}class ${strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class z{options;renderer;textRenderer;constructor(t){this.options=t||e.defaults,this.options.renderer=this.options.renderer||new y,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new $}static parse(e,t){return new z(t).parse(e)}static parseInline(e,t){return new z(t).parseInline(e)}parse(e,t=!0){let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=r,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){n+=t||"";continue}}switch(r.type){case"space":continue;case"hr":n+=this.renderer.hr();continue;case"heading":{const e=r;n+=this.renderer.heading(this.parseInline(e.tokens),e.depth,this.parseInline(e.tokens,this.textRenderer).replace(h,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):"")));continue}case"code":{const e=r;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case"table":{const e=r;let t="",s="";for(let t=0;t<e.header.length;t++)s+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(s);let i="";for(let t=0;t<e.rows.length;t++){const n=e.rows[t];s="";for(let t=0;t<n.length;t++)s+=this.renderer.tablecell(this.parseInline(n[t].tokens),{header:!1,align:e.align[t]});i+=this.renderer.tablerow(s)}n+=this.renderer.table(t,i);continue}case"blockquote":{const e=r,t=this.parse(e.tokens);n+=this.renderer.blockquote(t);continue}case"list":{const e=r,t=e.ordered,s=e.start,i=e.loose;let l="";for(let t=0;t<e.items.length;t++){const n=e.items[t],s=n.checked,r=n.task;let o="";if(n.task){const e=this.renderer.checkbox(!!s);i?n.tokens.length>0&&"paragraph"===n.tokens[0].type?(n.tokens[0].text=e+" "+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&"text"===n.tokens[0].tokens[0].type&&(n.tokens[0].tokens[0].text=e+" "+n.tokens[0].tokens[0].text)):n.tokens.unshift({type:"text",text:e+" "}):o+=e+" "}o+=this.parse(n.tokens,i),l+=this.renderer.listitem(o,r,!!s)}n+=this.renderer.list(l,t,s);continue}case"html":{const e=r;n+=this.renderer.html(e.text,e.block);continue}case"paragraph":{const e=r;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case"text":{let i=r,l=i.tokens?this.parseInline(i.tokens):i.text;for(;s+1<e.length&&"text"===e[s+1].type;)i=e[++s],l+="\n"+(i.tokens?this.parseInline(i.tokens):i.text);n+=t?this.renderer.paragraph(l):l;continue}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}parseInline(e,t){t=t||this.renderer;let n="";for(let s=0;s<e.length;s++){const r=e[s];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[r.type]){const e=this.options.extensions.renderers[r.type].call({parser:this},r);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){n+=e||"";continue}}switch(r.type){case"escape":{const e=r;n+=t.text(e.text);break}case"html":{const e=r;n+=t.html(e.text);break}case"link":{const e=r;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case"image":{const e=r;n+=t.image(e.href,e.title,e.text);break}case"strong":{const e=r;n+=t.strong(this.parseInline(e.tokens,t));break}case"em":{const e=r;n+=t.em(this.parseInline(e.tokens,t));break}case"codespan":{const e=r;n+=t.codespan(e.text);break}case"br":n+=t.br();break;case"del":{const e=r;n+=t.del(this.parseInline(e.tokens,t));break}case"text":{const e=r;n+=t.text(e.text);break}default:{const e='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw new Error(e)}}}return n}}class T{options;constructor(t){this.options=t||e.defaults}static passThroughHooks=new Set(["preprocess","postprocess"]);preprocess(e){return e}postprocess(e){return e}}class R{defaults={async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null};options=this.setOptions;parse=this.#e(_.lex,z.parse);parseInline=this.#e(_.lexInline,z.parseInline);Parser=z;parser=z.parse;Renderer=y;TextRenderer=$;Lexer=_;lexer=_.lex;Tokenizer=b;Hooks=T;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(const s of e)switch(n=n.concat(t.call(this,s)),s.type){case"table":{const e=s;for(const s of e.header)n=n.concat(this.walkTokens(s.tokens,t));for(const s of e.rows)for(const e of s)n=n.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=s;n=n.concat(this.walkTokens(e.items,t));break}default:{const e=s;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach((s=>{n=n.concat(this.walkTokens(e[s],t))})):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach((e=>{const n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const n=t.renderers[e.name];t.renderers[e.name]=n?function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=n.apply(this,t)),s}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)})),n.extensions=t),e.renderer){const t=this.defaults.renderer||new y(this.defaults);for(const n in e.renderer){const s=e.renderer[n],r=n,i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n||""}}n.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new b(this.defaults);for(const n in e.tokenizer){const s=e.tokenizer[n],r=n,i=t[r];t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new T;for(const n in e.hooks){const s=e.hooks[n],r=n,i=t[r];T.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(s.call(t,e)).then((e=>i.call(t,e)));const n=s.call(t,e);return i.call(t,n)}:t[r]=(...e)=>{let n=s.apply(t,e);return!1===n&&(n=i.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,s=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(s.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}})),this}setOptions(e){return this.defaults={...this.defaults,...e},this}#e(e,t){return(n,s)=>{const r={...s},i={...this.defaults,...r};!0===this.defaults.async&&!1===r.async&&(i.silent||console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."),i.async=!0);const l=this.#t(!!i.silent,!!i.async);if(null==n)return l(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof n)return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(i.hooks&&(i.hooks.options=i),i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then((t=>e(t,i))).then((e=>i.walkTokens?Promise.all(this.walkTokens(e,i.walkTokens)).then((()=>e)):e)).then((e=>t(e,i))).then((e=>i.hooks?i.hooks.postprocess(e):e)).catch(l);try{i.hooks&&(n=i.hooks.preprocess(n));const s=e(n,i);i.walkTokens&&this.walkTokens(s,i.walkTokens);let r=t(s,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return l(e)}}}#t(e,t){return n=>{if(n.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+c(n.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}}const S=new R;function A(e,t){return S.parse(e,t)}A.options=A.setOptions=function(e){return S.setOptions(e),A.defaults=S.defaults,n(A.defaults),A},A.getDefaults=t,A.defaults=e.defaults,A.use=function(...e){return S.use(...e),A.defaults=S.defaults,n(A.defaults),A},A.walkTokens=function(e,t){return S.walkTokens(e,t)},A.parseInline=S.parseInline,A.Parser=z,A.parser=z.parse,A.Renderer=y,A.TextRenderer=$,A.Lexer=_,A.lexer=_.lex,A.Tokenizer=b,A.Hooks=T,A.parse=A;const I=A.options,E=A.setOptions,Z=A.use,q=A.walkTokens,L=A.parseInline,D=A,P=z.parse,v=_.lex;e.Hooks=T,e.Lexer=_,e.Marked=R,e.Parser=z,e.Renderer=y,e.TextRenderer=$,e.Tokenizer=b,e.getDefaults=t,e.lexer=v,e.marked=A,e.options=I,e.parse=D,e.parseInline=L,e.parser=P,e.setOptions=E,e.use=Z,e.walkTokens=q})); diff --git a/fastn-core/tests/22-http-headers/output/prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css b/fastn-core/tests/22-http-headers/output/prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css deleted file mode 100644 index 991195e60e..0000000000 --- a/fastn-core/tests/22-http-headers/output/prism-73F718B9234C00C5C14AB6A11BF239A103F0B0F93B69CD55CB5C6530501182EB.css +++ /dev/null @@ -1,61 +0,0 @@ -/* -https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-highlight.css - a Prism provide line-highlight CSS -Copyright (c) 2012 Lea Verou (MIT Licensed) -https://github.com/PrismJS/prism/releases/tag/v1.29.0 -https://github.com/PrismJS/prism - -Content taken from https://raw.githubusercontent.com/PrismJS/prism/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-highlight.min.css -*/ - -pre[data-line]{position:relative;padding:1em 0 1em 3em}.line-highlight{position:absolute;left:0;right:0;padding:inherit 0;margin-top:1em;background:hsla(24,20%,50%,.08);background:linear-gradient(to right,hsla(24,20%,50%,.1) 70%,hsla(24,20%,50%,0));pointer-events:none;line-height:inherit;white-space:pre}@media print{.line-highlight{-webkit-print-color-adjust:exact;color-adjust:exact}}.line-highlight:before,.line-highlight[data-end]:after{content:attr(data-start);position:absolute;top:.4em;left:.6em;min-width:1em;padding:0 .5em;background-color:hsla(24,20%,50%,.4);color:#f4f1ef;font:bold 65%/1.5 sans-serif;text-align:center;vertical-align:.3em;border-radius:999px;text-shadow:none;box-shadow:0 1px #fff}.line-highlight[data-end]:after{content:attr(data-end);top:auto;bottom:.4em}.line-numbers .line-highlight:after,.line-numbers .line-highlight:before{content:none}pre[id].linkable-line-numbers span.line-numbers-rows{pointer-events:all}pre[id].linkable-line-numbers span.line-numbers-rows>span:before{cursor:pointer}pre[id].linkable-line-numbers span.line-numbers-rows>span:hover:before{background-color:rgba(128,128,128,.2)} -/* -https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-numbers.css - a Prism provide line-numbers CSS -Copyright (c) 2012 Lea Verou (MIT Licensed) -https://github.com/PrismJS/prism/releases/tag/v1.29.0 -https://github.com/PrismJS/prism - -Content taken from https://raw.githubusercontent.com/PrismJS/prism/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-numbers/prism-line-numbers.min.css -*/ - - -pre[class*="language-"].line-numbers { - position: relative; - padding-left: 3.8em !important; - counter-reset: linenumber; -} - -pre[class*="language-"].line-numbers > code { - position: relative; - white-space: inherit; - padding-left: 0 !important; -} - -.line-numbers .line-numbers-rows { - position: absolute; - pointer-events: none; - top: 0; - font-size: 100%; - left: -3.8em; - width: 3em; /* works for line-numbers below 1000 lines */ - letter-spacing: -1px; - border-right: 1px solid #999; - - -webkit-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; - -} - -.line-numbers-rows > span { - display: block; - counter-increment: linenumber; -} - -.line-numbers-rows > span:before { - content: counter(linenumber); - color: #999; - display: block; - padding-right: 0.8em; - text-align: right; -} diff --git a/fastn-core/tests/22-http-headers/output/prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js b/fastn-core/tests/22-http-headers/output/prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js deleted file mode 100644 index b8fa760f2f..0000000000 --- a/fastn-core/tests/22-http-headers/output/prism-8FE3A42AD547E2DBBC9FE16BA059F8F1870D613AD0C5B0B013D6205B72A62BAF.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library - * Copyright (c) 2012 Lea Verou (MIT Licensed) - * https://github.com/PrismJS/prism - */ -// Content taken from https://cdnjs.cloudflare.com/ajax/libs/prism/1.24.1/prism.min.js -var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(o){var u=/\blang(?:uage)?-([\w-]+)\b/i,t=0,e={},j={manual:o.Prism&&o.Prism.manual,disableWorkerMessageHandler:o.Prism&&o.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof C?new C(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++t}),e.__id},clone:function n(e,a){var r,t;switch(a=a||{},j.util.type(e)){case"Object":if(t=j.util.objId(e),a[t])return a[t];for(var s in r={},a[t]=r,e)e.hasOwnProperty(s)&&(r[s]=n(e[s],a));return r;case"Array":return(t=j.util.objId(e),a[t])?a[t]:(r=[],a[t]=r,e.forEach(function(e,t){r[t]=n(e,a)}),r);default:return e}},getLanguage:function(e){for(;e&&!u.test(e.className);)e=e.parentElement;return e?(e.className.match(u)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(e){var t=(/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(e.stack)||[])[1];if(t){var n,a=document.getElementsByTagName("script");for(n in a)if(a[n].src==t)return a[n]}return null}},isActive:function(e,t,n){for(var a="no-"+t;e;){var r=e.classList;if(r.contains(t))return!0;if(r.contains(a))return!1;e=e.parentElement}return!!n}},languages:{plain:e,plaintext:e,text:e,txt:e,extend:function(e,t){var n,a=j.util.clone(j.languages[e]);for(n in t)a[n]=t[n];return a},insertBefore:function(n,e,t,a){var r,s=(a=a||j.languages)[n],i={};for(r in s)if(s.hasOwnProperty(r)){if(r==e)for(var l in t)t.hasOwnProperty(l)&&(i[l]=t[l]);t.hasOwnProperty(r)||(i[r]=s[r])}var o=a[n];return a[n]=i,j.languages.DFS(j.languages,function(e,t){t===o&&e!=n&&(this[e]=i)}),i},DFS:function e(t,n,a,r){r=r||{};var s,i,l,o=j.util.objId;for(s in t)t.hasOwnProperty(s)&&(n.call(t,s,t[s],a||s),i=t[s],"Object"!==(l=j.util.type(i))||r[o(i)]?"Array"!==l||r[o(i)]||(r[o(i)]=!0,e(i,n,s,r)):(r[o(i)]=!0,e(i,n,null,r)))}},plugins:{},highlightAll:function(e,t){j.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var a={callback:n,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};j.hooks.run("before-highlightall",a),a.elements=Array.prototype.slice.apply(a.container.querySelectorAll(a.selector)),j.hooks.run("before-all-elements-highlight",a);for(var r,s=0;r=a.elements[s++];)j.highlightElement(r,!0===t,a.callback)},highlightElement:function(e,t,n){var a=j.util.getLanguage(e),r=j.languages[a];e.className=e.className.replace(u,"").replace(/\s+/g," ")+" language-"+a;var s=e.parentElement;s&&"pre"===s.nodeName.toLowerCase()&&(s.className=s.className.replace(u,"").replace(/\s+/g," ")+" language-"+a);var i={element:e,language:a,grammar:r,code:e.textContent};function l(e){i.highlightedCode=e,j.hooks.run("before-insert",i),i.element.innerHTML=i.highlightedCode,j.hooks.run("after-highlight",i),j.hooks.run("complete",i),n&&n.call(i.element)}if(j.hooks.run("before-sanity-check",i),(s=i.element.parentElement)&&"pre"===s.nodeName.toLowerCase()&&!s.hasAttribute("tabindex")&&s.setAttribute("tabindex","0"),!i.code)return j.hooks.run("complete",i),void(n&&n.call(i.element));j.hooks.run("before-highlight",i),i.grammar?t&&o.Worker?((t=new Worker(j.filename)).onmessage=function(e){l(e.data)},t.postMessage(JSON.stringify({language:i.language,code:i.code,immediateClose:!0}))):l(j.highlight(i.code,i.grammar,i.language)):l(j.util.encode(i.code))},highlight:function(e,t,n){n={code:e,grammar:t,language:n};return j.hooks.run("before-tokenize",n),n.tokens=j.tokenize(n.code,n.grammar),j.hooks.run("after-tokenize",n),C.stringify(j.util.encode(n.tokens),n.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var a in n)t[a]=n[a];delete t.rest}var r=new s;return z(r,r.head,e),function e(t,n,a,r,s,i){for(var l in a)if(a.hasOwnProperty(l)&&a[l]){var o=a[l];o=Array.isArray(o)?o:[o];for(var u=0;u<o.length;++u){if(i&&i.cause==l+","+u)return;var c,g=o[u],d=g.inside,p=!!g.lookbehind,m=!!g.greedy,h=g.alias;m&&!g.pattern.global&&(c=g.pattern.toString().match(/[imsuy]*$/)[0],g.pattern=RegExp(g.pattern.source,c+"g"));for(var f=g.pattern||g,b=r.next,y=s;b!==n.tail&&!(i&&y>=i.reach);y+=b.value.length,b=b.next){var v=b.value;if(n.length>t.length)return;if(!(v instanceof C)){var F,k=1;if(m){if(!(F=O(f,y,t,p)))break;var x=F.index,w=F.index+F[0].length,P=y;for(P+=b.value.length;P<=x;)b=b.next,P+=b.value.length;if(P-=b.value.length,y=P,b.value instanceof C)continue;for(var A=b;A!==n.tail&&(P<w||"string"==typeof A.value);A=A.next)k++,P+=A.value.length;k--,v=t.slice(y,P),F.index-=y}else if(!(F=O(f,0,v,p)))continue;var x=F.index,$=F[0],S=v.slice(0,x),E=v.slice(x+$.length),_=y+v.length;i&&_>i.reach&&(i.reach=_);v=b.prev;S&&(v=z(n,v,S),y+=S.length),T(n,v,k);$=new C(l,d?j.tokenize($,d):$,h,$);b=z(n,v,$),E&&z(n,b,E),1<k&&(_={cause:l+","+u,reach:_},e(t,n,a,b.prev,y,_),i&&_.reach>i.reach&&(i.reach=_.reach))}}}}}(e,r,t,r.head,0),function(e){var t=[],n=e.head.next;for(;n!==e.tail;)t.push(n.value),n=n.next;return t}(r)},hooks:{all:{},add:function(e,t){var n=j.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=j.hooks.all[e];if(n&&n.length)for(var a,r=0;a=n[r++];)a(t)}},Token:C};function C(e,t,n,a){this.type=e,this.content=t,this.alias=n,this.length=0|(a||"").length}function O(e,t,n,a){e.lastIndex=t;n=e.exec(n);return n&&a&&n[1]&&(a=n[1].length,n.index+=a,n[0]=n[0].slice(a)),n}function s(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function z(e,t,n){var a=t.next,n={value:n,prev:t,next:a};return t.next=n,a.prev=n,e.length++,n}function T(e,t,n){for(var a=t.next,r=0;r<n&&a!==e.tail;r++)a=a.next;(t.next=a).prev=t,e.length-=r}if(o.Prism=j,C.stringify=function t(e,n){if("string"==typeof e)return e;if(Array.isArray(e)){var a="";return e.forEach(function(e){a+=t(e,n)}),a}var r={type:e.type,content:t(e.content,n),tag:"span",classes:["token",e.type],attributes:{},language:n},e=e.alias;e&&(Array.isArray(e)?Array.prototype.push.apply(r.classes,e):r.classes.push(e)),j.hooks.run("wrap",r);var s,i="";for(s in r.attributes)i+=" "+s+'="'+(r.attributes[s]||"").replace(/"/g,""")+'"';return"<"+r.tag+' class="'+r.classes.join(" ")+'"'+i+">"+r.content+"</"+r.tag+">"},!o.document)return o.addEventListener&&(j.disableWorkerMessageHandler||o.addEventListener("message",function(e){var t=JSON.parse(e.data),n=t.language,e=t.code,t=t.immediateClose;o.postMessage(j.highlight(e,j.languages[n],n)),t&&o.close()},!1)),j;var n=j.util.currentScript();function a(){j.manual||j.highlightAll()}return n&&(j.filename=n.src,n.hasAttribute("data-manual")&&(j.manual=!0)),j.manual||("loading"===(e=document.readyState)||"interactive"===e&&n&&n.defer?document.addEventListener("DOMContentLoaded",a):window.requestAnimationFrame?window.requestAnimationFrame(a):window.setTimeout(a,16)),j}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism),Prism.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata:/<!\[CDATA\[[\s\S]*?\]\]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[t]},n.cdata=/^<!\[CDATA\[|\]\]>$/i;n={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:n}};n["language-"+t]={pattern:/[\s\S]+/,inside:Prism.languages[t]};t={};t[e]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return e}),"i"),lookbehind:!0,greedy:!0,inside:n},Prism.languages.insertBefore("markup","cdata",t)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(e,t){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:Prism.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml,function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;e=e.languages.markup;e&&(e.tag.addInlined("style","css"),e.tag.addAttribute("style","css"))}(Prism),Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,function(){var i,l,o,u,a,e;function c(e,t){var n=(n=e.className).replace(a," ")+" language-"+t;e.className=n.replace(/\s+/g," ").trim()}void 0!==Prism&&"undefined"!=typeof document&&(Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector),i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},u="pre[data-src]:not(["+(l="data-src-status")+'="loaded"]):not(['+l+'="'+(o="loading")+'"])',a=/\blang(?:uage)?-([\w-]+)\b/i,Prism.hooks.add("before-highlightall",function(e){e.selector+=", "+u}),Prism.hooks.add("before-sanity-check",function(e){var t,n,a,r,s=e.element;s.matches(u)&&(e.code="",s.setAttribute(l,o),(t=s.appendChild(document.createElement("CODE"))).textContent="Loading…",n=s.getAttribute("data-src"),"none"===(e=e.language)&&(a=(/\.(\w+)$/.exec(n)||[,"none"])[1],e=i[a]||a),c(t,e),c(s,e),(a=Prism.plugins.autoloader)&&a.loadLanguages(e),(r=new XMLHttpRequest).open("GET",n,!0),r.onreadystatechange=function(){4==r.readyState&&(r.status<400&&r.responseText?(s.setAttribute(l,"loaded"),t.textContent=r.responseText,Prism.highlightElement(t)):(s.setAttribute(l,"failed"),400<=r.status?t.textContent="✖ Error "+r.status+" while fetching file: "+r.statusText:t.textContent="✖ Error: File does not exist or is empty"))},r.send(null))}),e=!(Prism.plugins.fileHighlight={highlight:function(e){for(var t,n=(e||document).querySelectorAll(u),a=0;t=n[a++];)Prism.highlightElement(t)}}),Prism.fileHighlight=function(){e||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),e=!0),Prism.plugins.fileHighlight.highlight.apply(this,arguments)})}(); -/* -https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-highlight.js - a Prism provide line-highlight JS -Copyright (c) 2012 Lea Verou (MIT Licensed) -https://github.com/PrismJS/prism/releases/tag/v1.29.0 -https://github.com/PrismJS/prism - -Content taken from https://raw.githubusercontent.com/PrismJS/prism/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-highlight.min.js -*/ - -!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document&&document.querySelector){var e,t="line-numbers",i="linkable-line-numbers",n=/\n(?!$)/g,r=!0;Prism.plugins.lineHighlight={highlightLines:function(o,u,c){var h=(u="string"==typeof u?u:o.getAttribute("data-line")||"").replace(/\s+/g,"").split(",").filter(Boolean),d=+o.getAttribute("data-line-offset")||0,f=(function(){if(void 0===e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding="0",t.style.border="0",t.innerHTML=" <br /> ",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e}()?parseInt:parseFloat)(getComputedStyle(o).lineHeight),p=Prism.util.isActive(o,t),g=o.querySelector("code"),m=p?o:g||o,v=[],y=g.textContent.match(n),b=y?y.length+1:1,A=g&&m!=g?function(e,t){var i=getComputedStyle(e),n=getComputedStyle(t);function r(e){return+e.substr(0,e.length-2)}return t.offsetTop+r(n.borderTopWidth)+r(n.paddingTop)-r(i.paddingTop)}(o,g):0;h.forEach((function(e){var t=e.split("-"),i=+t[0],n=+t[1]||i;if(!((n=Math.min(b+d,n))<i)){var r=o.querySelector('.line-highlight[data-range="'+e+'"]')||document.createElement("div");if(v.push((function(){r.setAttribute("aria-hidden","true"),r.setAttribute("data-range",e),r.className=(c||"")+" line-highlight"})),p&&Prism.plugins.lineNumbers){var s=Prism.plugins.lineNumbers.getLine(o,i),l=Prism.plugins.lineNumbers.getLine(o,n);if(s){var a=s.offsetTop+A+"px";v.push((function(){r.style.top=a}))}if(l){var u=l.offsetTop-s.offsetTop+l.offsetHeight+"px";v.push((function(){r.style.height=u}))}}else v.push((function(){r.setAttribute("data-start",String(i)),n>i&&r.setAttribute("data-end",String(n)),r.style.top=(i-d-1)*f+A+"px",r.textContent=new Array(n-i+2).join(" \n")}));v.push((function(){r.style.width=o.scrollWidth+"px"})),v.push((function(){m.appendChild(r)}))}}));var P=o.id;if(p&&Prism.util.isActive(o,i)&&P){l(o,i)||v.push((function(){o.classList.add(i)}));var E=parseInt(o.getAttribute("data-start")||"1");s(".line-numbers-rows > span",o).forEach((function(e,t){var i=t+E;e.onclick=function(){var e=P+"."+i;r=!1,location.hash=e,setTimeout((function(){r=!0}),1)}}))}return function(){v.forEach(a)}}};var o=0;Prism.hooks.add("before-sanity-check",(function(e){var t=e.element.parentElement;if(u(t)){var i=0;s(".line-highlight",t).forEach((function(e){i+=e.textContent.length,e.parentNode.removeChild(e)})),i&&/^(?: \n)+$/.test(e.code.slice(-i))&&(e.code=e.code.slice(0,-i))}})),Prism.hooks.add("complete",(function e(i){var n=i.element.parentElement;if(u(n)){clearTimeout(o);var r=Prism.plugins.lineNumbers,s=i.plugins&&i.plugins.lineNumbers;l(n,t)&&r&&!s?Prism.hooks.add("line-numbers",e):(Prism.plugins.lineHighlight.highlightLines(n)(),o=setTimeout(c,1))}})),window.addEventListener("hashchange",c),window.addEventListener("resize",(function(){s("pre").filter(u).map((function(e){return Prism.plugins.lineHighlight.highlightLines(e)})).forEach(a)}))}function s(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function l(e,t){return e.classList.contains(t)}function a(e){e()}function u(e){return!!(e&&/pre/i.test(e.nodeName)&&(e.hasAttribute("data-line")||e.id&&Prism.util.isActive(e,i)))}function c(){var e=location.hash.slice(1);s(".temporary.line-highlight").forEach((function(e){e.parentNode.removeChild(e)}));var t=(e.match(/\.([\d,-]+)$/)||[,""])[1];if(t&&!document.getElementById(e)){var i=e.slice(0,e.lastIndexOf(".")),n=document.getElementById(i);n&&(n.hasAttribute("data-line")||n.setAttribute("data-line",""),Prism.plugins.lineHighlight.highlightLines(n,t,"temporary ")(),r&&document.querySelector(".temporary.line-highlight").scrollIntoView())}}}(); -/* -https://github.com/PrismJS/prism/blob/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-highlight/prism-line-numbers.js - a Prism provide line-numbers JS -Copyright (c) 2012 Lea Verou (MIT Licensed) -https://github.com/PrismJS/prism/releases/tag/v1.29.0 -https://github.com/PrismJS/prism - -Content taken from - https://raw.githubusercontent.com/PrismJS/prism/59e5a3471377057de1f401ba38337aca27b80e03/plugins/line-numbers/prism-line-numbers.min.js -*/ - -!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var e="line-numbers",n=/\n(?!$)/g,t=Prism.plugins.lineNumbers={getLine:function(n,t){if("PRE"===n.tagName&&n.classList.contains(e)){var i=n.querySelector(".line-numbers-rows");if(i){var r=parseInt(n.getAttribute("data-start"),10)||1,s=r+(i.children.length-1);t<r&&(t=r),t>s&&(t=s);var l=t-r;return i.children[l]}}},resize:function(e){r([e])},assumeViewportIndependence:!0},i=void 0;window.addEventListener("resize",(function(){t.assumeViewportIndependence&&i===window.innerWidth||(i=window.innerWidth,r(Array.prototype.slice.call(document.querySelectorAll("pre.line-numbers"))))})),Prism.hooks.add("complete",(function(t){if(t.code){var i=t.element,s=i.parentNode;if(s&&/pre/i.test(s.nodeName)&&!i.querySelector(".line-numbers-rows")&&Prism.util.isActive(i,e)){i.classList.remove(e),s.classList.add(e);var l,o=t.code.match(n),a=o?o.length+1:1,u=new Array(a+1).join("<span></span>");(l=document.createElement("span")).setAttribute("aria-hidden","true"),l.className="line-numbers-rows",l.innerHTML=u,s.hasAttribute("data-start")&&(s.style.counterReset="linenumber "+(parseInt(s.getAttribute("data-start"),10)-1)),t.element.appendChild(l),r([s]),Prism.hooks.run("line-numbers",t)}}})),Prism.hooks.add("line-numbers",(function(e){e.plugins=e.plugins||{},e.plugins.lineNumbers=!0}))}function r(e){if(0!=(e=e.filter((function(e){var n,t=(n=e,n?window.getComputedStyle?getComputedStyle(n):n.currentStyle||null:null)["white-space"];return"pre-wrap"===t||"pre-line"===t}))).length){var t=e.map((function(e){var t=e.querySelector("code"),i=e.querySelector(".line-numbers-rows");if(t&&i){var r=e.querySelector(".line-numbers-sizer"),s=t.textContent.split(n);r||((r=document.createElement("span")).className="line-numbers-sizer",t.appendChild(r)),r.innerHTML="0",r.style.display="block";var l=r.getBoundingClientRect().height;return r.innerHTML="",{element:e,lines:s,lineHeights:[],oneLinerHeight:l,sizer:r}}})).filter(Boolean);t.forEach((function(e){var n=e.sizer,t=e.lines,i=e.lineHeights,r=e.oneLinerHeight;i[t.length-1]=void 0,t.forEach((function(e,t){if(e&&e.length>1){var s=n.appendChild(document.createElement("span"));s.style.display="block",s.textContent=e}else i[t]=r}))})),t.forEach((function(e){for(var n=e.sizer,t=e.lineHeights,i=0,r=0;r<t.length;r++)void 0===t[r]&&(t[r]=n.children[i++].getBoundingClientRect().height)})),t.forEach((function(e){var n=e.sizer,t=e.element.querySelector(".line-numbers-rows");n.style.display="none",n.innerHTML="",e.lineHeights.forEach((function(e,n){t.children[n].style.height=e+"px"}))}))}}}(); -/** - * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library - * Copyright (c) 2012 Lea Verou (MIT Licensed) - * https://github.com/PrismJS/prism - * https://github.com/PrismJS/prism/commit/11c54624ee4f0e36ec3607c16d74969c8264a79d - */ -// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-rust.min.js -!function(e){for(var a="/\\*(?:[^*/]|\\*(?!/)|/(?!\\*)|<self>)*\\*/",t=0;t<2;t++)a=a.replace(/<self>/g,(function(){return a}));a=a.replace(/<self>/g,(function(){return"[^\\s\\S]"})),e.languages.rust={comment:[{pattern:RegExp("(^|[^\\\\])"+a),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},e.languages.rust["closure-params"].inside.rest=e.languages.rust,e.languages.rust.attribute.inside.string=e.languages.rust.string,e.languages.rs=e.languages.rust}(Prism); -/** - * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library - * Copyright (c) 2012 Lea Verou (MIT Licensed) - * https://github.com/PrismJS/prism - * https://github.com/PrismJS/prism/commit/e2630d890e9ced30a79cdf9ef272601ceeaedccf - */ -// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-json.min.js -Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json; -/** - * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library - * Copyright (c) 2012 Lea Verou (MIT Licensed) - * https://github.com/PrismJS/prism - * https://github.com/PrismJS/prism/commit/8ecef306a76be571ff14a18e504196f4f406903d - */ -// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-python.min.js -Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python; -/** - * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library - * Copyright (c) 2012 Lea Verou (MIT Licensed) - * https://github.com/PrismJS/prism - * https://github.com/PrismJS/prism/commit/11c54624ee4f0e36ec3607c16d74969c8264a79d - */ -// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-markdown.min.js -!function(n){function e(n){return n=n.replace(/<inner>/g,(function(){return"(?:\\\\.|[^\\\\\n\r]|(?:\n|\r\n?)(?![\r\n]))"})),RegExp("((?:^|[^\\\\])(?:\\\\{2})*)(?:"+n+")")}var t="(?:\\\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\\\|\r\n`])+",a="\\|?__(?:\\|__)+\\|?(?:(?:\n|\r\n?)|(?![^]))".replace(/__/g,(function(){return t})),i="\\|?[ \t]*:?-{3,}:?[ \t]*(?:\\|[ \t]*:?-{3,}:?[ \t]*)+\\|?(?:\n|\r\n?)";n.languages.markdown=n.languages.extend("markup",{}),n.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:n.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+i+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+i+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(t),inside:n.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+i+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(t),alias:"important",inside:n.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:e("\\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\\b|\\*\\*(?:(?!\\*)<inner>|\\*(?:(?!\\*)<inner>)+\\*)+\\*\\*"),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:e("\\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\\b|\\*(?:(?!\\*)<inner>|\\*\\*(?:(?!\\*)<inner>)+\\*\\*)+\\*"),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:e("(~~?)(?:(?!~)<inner>)+\\2"),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:e('!?\\[(?:(?!\\])<inner>)+\\](?:\\([^\\s)]+(?:[\t ]+"(?:\\\\.|[^"\\\\])*")?\\)|[ \t]?\\[(?:(?!\\])<inner>)+\\])'),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(e){["url","bold","italic","strike","code-snippet"].forEach((function(t){e!==t&&(n.languages.markdown[e].inside.content.inside[t]=n.languages.markdown[t])}))})),n.hooks.add("after-tokenize",(function(n){"markdown"!==n.language&&"md"!==n.language||function n(e){if(e&&"string"!=typeof e)for(var t=0,a=e.length;t<a;t++){var i=e[t];if("code"===i.type){var r=i.content[1],o=i.content[3];if(r&&o&&"code-language"===r.type&&"code-block"===o.type&&"string"==typeof r.content){var l=r.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp"),s="language-"+(l=(/[a-z][\w-]*/i.exec(l)||[""])[0].toLowerCase());o.alias?"string"==typeof o.alias?o.alias=[o.alias,s]:o.alias.push(s):o.alias=[s]}}else n(i.content)}}(n.tokens)})),n.hooks.add("wrap",(function(e){if("code-block"===e.type){for(var t="",a=0,i=e.classes.length;a<i;a++){var s=e.classes[a],d=/language-(.+)/.exec(s);if(d){t=d[1];break}}var p=n.languages[t];if(p)e.content=n.highlight(e.content.replace(r,"").replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,(function(n,e){var t;return"#"===(e=e.toLowerCase())[0]?(t="x"===e[1]?parseInt(e.slice(2),16):Number(e.slice(1)),l(t)):o[e]||n})),p,t);else if(t&&"none"!==t&&n.plugins.autoloader){var u="md-"+(new Date).valueOf()+"-"+Math.floor(1e16*Math.random());e.attributes.id=u,n.plugins.autoloader.loadLanguages(t,(function(){var e=document.getElementById(u);e&&(e.innerHTML=n.highlight(e.textContent,n.languages[t],t))}))}}}));var r=RegExp(n.languages.markup.tag.pattern.source,"gi"),o={amp:"&",lt:"<",gt:">",quot:'"'},l=String.fromCodePoint||String.fromCharCode;n.languages.md=n.languages.markdown}(Prism); -/** - * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library - * Copyright (c) 2012 Lea Verou (MIT Licensed) - * https://github.com/PrismJS/prism - * https://github.com/PrismJS/prism/commit/8ecef306a76be571ff14a18e504196f4f406903d - */ -// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-plsql.min.js -Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}; -/** - * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library - * Copyright (c) 2012 Lea Verou (MIT Licensed) - * https://github.com/PrismJS/prism - * https://github.com/PrismJS/prism/commit/8ecef306a76be571ff14a18e504196f4f406903d - */ -// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-bash.min.js -!function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",a={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},n={bash:a,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:n},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:a}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:n},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:n.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:n.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},a.inside=e.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=n.variable[1].inside,i=0;i<s.length;i++)o[s[i]]=e.languages.bash[s[i]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash}(Prism); -/** - * https://github.com/PrismJS/prism/releases/tag/v1.29.0 - a syntax highlighting library - * Copyright (c) 2012 Lea Verou (MIT Licensed) - * https://github.com/PrismJS/prism - * https://github.com/PrismJS/prism/commit/8ecef306a76be571ff14a18e504196f4f406903d - */ -// Content taken from https://raw.githubusercontent.com/PrismJS/prism/master/components/prism-javascript.min.js -Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp("(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])"),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp("((?:^|[^$\\w\\xA0-\\uFFFF.\"'\\])\\s]|\\b(?:return|yield))\\s*)/(?:(?:\\[(?:[^\\]\\\\\r\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.|\\[(?:[^[\\]\\\\\r\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\r\n])+/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|/\\*(?:[^*]|\\*(?!/))*\\*/)*(?:$|[\r\n,.;:})\\]]|//))"),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)","javascript")),Prism.languages.js=Prism.languages.javascript; diff --git a/integration-tests/_tests/14-http-headers.test.ftd b/integration-tests/_tests/14-http-headers.test.ftd new file mode 100644 index 0000000000..dca4f26baf --- /dev/null +++ b/integration-tests/_tests/14-http-headers.test.ftd @@ -0,0 +1,7 @@ +-- import: fastn + +-- fastn.test: Passing request headers to http processor + +-- fastn.get: Authenticating and Fetching User Details (using http processor) +url: /dummy-json-auth/ +http-status: 200 diff --git a/fastn-core/tests/22-http-headers/input/index.ftd b/integration-tests/dummy-json-auth.ftd similarity index 100% rename from fastn-core/tests/22-http-headers/input/index.ftd rename to integration-tests/dummy-json-auth.ftd