diff --git a/CHANGELOG.md b/CHANGELOG.md index fe57f7fc..72bedfae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ ## Unreleased +- Match engineering business vocabulary through bounded synonyms and witnessed + Markdown-to-code links, with typed approximate-match provenance. Retain bounded + document and Python docstring excerpts in resource details for prose search. +- Reuse valid disposable FTS indexes on reopen; validate FTS with a writable + handle before opening the query connection read-only. +- Add optional offline corpus-LSA embeddings to `ask`/`search` and MCP discovery/ + search. Exact lookup is unchanged; semantic corpus limits fail explicitly. + - Resolve Python calls through annotated receivers and unit-of-work member chains, injected constructor fields, and source return contracts. Preserve unknown invocations as bounded source-call inventories and optional inferred receiver diff --git a/COMPATIBILITY.md b/COMPATIBILITY.md index a0243b07..63508c76 100644 --- a/COMPATIBILITY.md +++ b/COMPATIBILITY.md @@ -1,5 +1,24 @@ # Compass compatibility +Concept recall adds optional `conceptMatches` to `compass.query/1` with closed +methods `synonym`, `document_link`, and `semantic_lsa`. Strict consumers must +update to the matching enum/field manifest and fingerprint. Absence means no +concept recall; approximate matching never promotes structural confidence. +CLI `ask`/non-exact `search` and MCP bounded discovery/search enable synonym and +document-link recall by default; `--semantic-search` / `semantic_search: true` +explicitly enable offline corpus-LSA fallback per request. Exact lookup retains +its existing meaning. Semantic corpus limits return typed errors, not no-match. + +Graph/1 resource details gain optional `content`, a source-backed excerpt of at +most 4 KiB for document/rationale resources. Document identity, edge direction, +and reference provenance remain unchanged. Closed resource-details decoders +must admit this additive field. Markdown normalization preserves its bounded +prose, and Python rationale extraction retains docstring excerpts under AST +cache v15. Disposable JSON query-index format v2 adds prose terms; older caches +rebuild automatically. Existing immutable store indexes/graphs must be newly +published to obtain prose postings; history is never rewritten. Native names +and existing reference edges remain queryable in older graphs. + Compass is an independent native product. Its compatibility contract is defined by the shipped `compass` CLI, documented file and protocol formats, native tests, and migration notes. Compass does not execute, import, check out, or test against diff --git a/MIGRATION.md b/MIGRATION.md index bbfcd3fa..b509b12b 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -7,6 +7,15 @@ layout remains visible and clearly owned. ## Graph rebuilds and query resolution +To enable full bounded document/prose recall, rebuild with +`compass extract --force`. Document/rationale resources now carry optional +`details.data.content` (up to 4 KiB), and strict query consumers must admit +optional `conceptMatches` and its closed match-method enum. AST cache v15 and +JSON query-index format v2 invalidate older disposable entries automatically. +Rebuild existing SQLite sidecars from the new graph to get prose postings; +historical realizations retain their original content and indexes. Default +concept recall needs no credentials; corpus-LSA search remains explicit opt-in. + Rebuild Python graphs with `compass extract --code-only --force` to obtain receiver-chain resolution and source-call inventories. AST cache version 14 recomputes older entries automatically. Add `--inference-level max` to retain diff --git a/SECURITY.md b/SECURITY.md index 7e71196d..da93cedc 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -127,3 +127,13 @@ have independent bounds. Membership comes from recorded directed structural relationships; inferred/deferred records, calls and references are excluded. Source failures and budget exhaustion remain explicit. Missing digests never become verified merely because an owner-to-member relationship is present. + +Optional concept semantic search (`--semantic-search` / MCP `semantic_search`) +learns bounded corpus-LSA embeddings from the selected local graph. It uses no +network, credentials, runtime model download, or external vector service. Names +and bounded document/docstring excerpts stay in the graph and engine memory; +this option does not upload source. Graph publication may now retain up to 4 KiB +of source-backed prose per document/rationale resource, so exported artifacts +include those excerpts as well as existing names and provenance. Apply the same +repository disclosure policy to these graph artifacts. Corpus size/deadline +failures remain explicit and do not publish a partially built semantic index. diff --git a/crates/compass-cli/src/code_query_commands.rs b/crates/compass-cli/src/code_query_commands.rs index e87c9db8..602de154 100644 --- a/crates/compass-cli/src/code_query_commands.rs +++ b/crates/compass-cli/src/code_query_commands.rs @@ -266,9 +266,17 @@ fn execute( open_with_engine(&graph, program.as_deref(), &cache, engine) .map_err(|error| error.to_string())? } - .with_deadline(deadline); + .with_deadline(deadline) + .with_semantic_search(args.iter().any(|arg| arg == "--semantic-search")); let limits = limits(args, page_scale)?; let include_heuristic = args.iter().any(|arg| arg == "--include-heuristic"); + if args.iter().any(|arg| arg == "--semantic-search") && !matches!(operation, "ask" | "search") { + return Err("--semantic-search is supported by compass ask and search".to_owned()); + } + if args.iter().any(|arg| arg == "--semantic-search") && args.iter().any(|arg| arg == "--exact") + { + return Err("--semantic-search cannot be combined with --exact".to_owned()); + } let relations = impact_relations(operation, args)?; let (response, question, operands) = match operation { "ask" => { diff --git a/crates/compass-cli/src/help.rs b/crates/compass-cli/src/help.rs index fe935cbc..8408b164 100644 --- a/crates/compass-cli/src/help.rs +++ b/crates/compass-cli/src/help.rs @@ -176,7 +176,7 @@ const PAGES: &[Page] = &[ "ask", "Route a natural-language question to a typed code-graph query", ["compass ask [OPTIONS]"], - "Arguments:\n Natural-language code-graph question\n\nOptions:\n --graph Typed graph [default: compass-out/graph.json]\n --at Use an immutable trusted revision graph\n --program Optional Program IR enrichment\n --cache Query-index cache directory\n --engine Graph storage engine [default: default]\n --max-depth Traversal radius\n --max-nodes Node bound\n --max-edges Edge bound\n --max-paths Path bound\n --max-candidates Candidate bound [default: 64]\n --include-heuristic Include heuristic evidence\n --format Output format [default: text]\n --text-budget Approximate tokens per text page [default: 2000]\n --cursor Continue the same text result (text only)\n --timeout-ms Query deadline in milliseconds [default: 60000; max: 600000]\n --brief Emit compass.query.agent-view.brief/1 (agent-json only)\n\nExamples:\n compass ask \"who calls PaymentService.charge?\"\n compass ask \"what does CheckoutController.create call?\" --format json\n compass ask \"path from CheckoutController.create to PaymentGateway.charge\"\n compass ask \"who calls PaymentService.charge?\" --at HEAD~2 --format json\n\nNotes:\n High-confidence callers, callees, impact, and path questions route to the matching typed operation. Contradictory or low-confidence input falls back to bounded symbol search. --at is mutually exclusive with --graph, --program, --cache, and --engine. The response uses compass.query/1." + "Arguments:\n Natural-language code-graph question\n\nOptions:\n --graph Typed graph [default: compass-out/graph.json]\n --at Use an immutable trusted revision graph\n --program Optional Program IR enrichment\n --cache Query-index cache directory\n --engine Graph storage engine [default: default]\n --max-depth Traversal radius\n --max-nodes Node bound\n --max-edges Edge bound\n --max-paths Path bound\n --max-candidates Candidate bound [default: 64]\n --semantic-search Optional offline corpus-LSA fallback [default: off]\n --include-heuristic Include heuristic evidence\n --format Output format [default: text]\n --text-budget Approximate tokens per text page [default: 2000]\n --cursor Continue the same text result (text only)\n --timeout-ms Query deadline in milliseconds [default: 60000; max: 600000]\n --brief Emit compass.query.agent-view.brief/1 (agent-json only)\n\nExamples:\n compass ask \"who calls PaymentService.charge?\"\n compass ask \"what does CheckoutController.create call?\" --format json\n compass ask \"path from CheckoutController.create to PaymentGateway.charge\"\n compass ask \"who calls PaymentService.charge?\" --at HEAD~2 --format json\n\nNotes:\n High-confidence callers, callees, impact, and path questions route to the matching typed operation. Contradictory or low-confidence input falls back to bounded symbol search. --at is mutually exclusive with --graph, --program, --cache, and --engine. The response uses compass.query/1." ), page!( "call-graph", @@ -320,7 +320,7 @@ const PAGES: &[Page] = &[ "search", "Search typed code symbols by name", ["compass search [OPTIONS]"], - "Arguments:\n Symbol name or qualified name\n\nOptions:\n --exact Exact ID or normalized name only; no lexical fallback\n --file Exact stored source path (requires --exact)\n --line Declaration start line (requires --exact and --file)\n --kind Stored node kind, e.g. function (requires --exact)\n --graph Typed graph [default: compass-out/graph.json]\n --program Optional Program IR enrichment\n --cache Query-index cache directory\n --engine Graph storage engine [default: default]\n --max-candidates Candidate bound [default: 64]\n --format Output format [default: text]\n --text-budget Approximate tokens per text page [default: 2000]\n --cursor Continue the same text result (text only)\n --timeout-ms Query deadline in milliseconds [default: 60000; max: 600000]\n --brief Emit compass.query.agent-view.brief/1 (agent-json only)\n\nExamples:\n compass search PaymentService\n compass search checkout --format json\n compass search PaymentService --text-budget 800\n\nNotes:\n Exact mode retains all matches. Candidate bounds apply before filters; truncation never proves uniqueness or absence. Exact text results do not automatically widen bounds.\n Search uses the versioned compass.query/1 response contract in all formats. Text output is paged: the footer carries a cursor that continues the same deterministic result at the same page budget." + "Arguments:\n Symbol name or qualified name\n\nOptions:\n --exact Exact ID or normalized name only; no lexical fallback\n --file Exact stored source path (requires --exact)\n --line Declaration start line (requires --exact and --file)\n --kind Stored node kind, e.g. function (requires --exact)\n --graph Typed graph [default: compass-out/graph.json]\n --program Optional Program IR enrichment\n --cache Query-index cache directory\n --engine Graph storage engine [default: default]\n --max-candidates Candidate bound [default: 64]\n --semantic-search Optional offline corpus-LSA fallback [default: off]\n --format Output format [default: text]\n --text-budget Approximate tokens per text page [default: 2000]\n --cursor Continue the same text result (text only)\n --timeout-ms Query deadline in milliseconds [default: 60000; max: 600000]\n --brief Emit compass.query.agent-view.brief/1 (agent-json only)\n\nExamples:\n compass search PaymentService\n compass search checkout --format json\n compass search PaymentService --text-budget 800\n\nNotes:\n Exact mode retains all matches. Candidate bounds apply before filters; truncation never proves uniqueness or absence. Exact text results do not automatically widen bounds.\n Search uses the versioned compass.query/1 response contract in all formats. Text output is paged: the footer carries a cursor that continues the same deterministic result at the same page budget." ), page!( "callers", diff --git a/crates/compass-cli/tests/code_query_cli.rs b/crates/compass-cli/tests/code_query_cli.rs index 653a9e0e..6eddc8e3 100644 --- a/crates/compass-cli/tests/code_query_cli.rs +++ b/crates/compass-cli/tests/code_query_cli.rs @@ -2816,3 +2816,54 @@ fn impact_relation_filter_is_typed_and_reports_excluded_contacts() -> Result<(), assert!(bad.stderr.contains("unknown impact relationship")); Ok(()) } + +#[test] +fn concept_search_discloses_synonyms_and_keeps_exact_mode_strict() -> Result<(), Box> { + let dir = tempfile::tempdir()?; + let path = support::write_typed_graph(dir.path())?; + let mut graph = GraphDocument::load(&path)?; + let target = graph + .nodes + .iter_mut() + .find(|node| node.name == "Target") + .ok_or("missing Target")?; + target.name = "AuthzGate".into(); + target.qualified_name = "Fixture.AuthzGate".into(); + let target_id = target.id.clone(); + std::fs::write(&path, serde_json::to_vec(&graph)?)?; + let execute = |command: &str, format: &str, extra: &[&str]| { + let mut args = vec![ + OsString::from(command), + OsString::from("authorization"), + OsString::from("--graph"), + path.as_os_str().to_owned(), + OsString::from("--format"), + OsString::from(format), + ]; + args.extend(extra.iter().map(OsString::from)); + run(Frontend::Compass, args) + }; + let found = execute("search", "json", &[]); + assert_eq!(found.code, 0, "{}", found.stderr); + let response: Value = serde_json::from_str(&found.stdout)?; + assert!(response["conceptMatches"].as_array().is_some_and(|items| { + items + .iter() + .any(|item| item["nodeId"] == target_id && item["method"] == "synonym") + })); + let text = execute("ask", "text", &["--semantic-search"]); + assert_eq!(text.code, 0, "{}", text.stderr); + assert!( + text.stdout.contains("Approximate") && text.stdout.contains("via synonym"), + "{}", + text.stdout + ); + let exact = execute("search", "json", &["--exact"]); + assert_eq!(exact.code, 0, "{}", exact.stderr); + let response: Value = serde_json::from_str(&exact.stdout)?; + assert_eq!(response["nodes"], serde_json::json!([])); + let rejected = execute("search", "json", &["--exact", "--semantic-search"]); + assert_ne!(rejected.code, 0); + assert!(rejected.stderr.contains("cannot be combined with --exact")); + Ok(()) +} diff --git a/crates/compass-files/src/cache.rs b/crates/compass-files/src/cache.rs index 85b18a41..7cf228ba 100644 --- a/crates/compass-files/src/cache.rs +++ b/crates/compass-files/src/cache.rs @@ -13,7 +13,7 @@ use sha2::{Digest, Sha256}; use crate::{FileError, StatHashIndex, file_hash, io_error, write_bytes_atomic, write_json_atomic}; /// Changes whenever cached extraction semantics change, even if the wire encoding does not. -pub const AST_CACHE_VERSION: &str = "14"; +pub const AST_CACHE_VERSION: &str = "15"; /// Portable cache encoding version used in the on-disk namespace. pub const CACHE_ENCODING_VERSION: u32 = 1; const MESSAGEPACK_EXTENSION: &str = "msgpack"; diff --git a/crates/compass-graph/src/snapshot.rs b/crates/compass-graph/src/snapshot.rs index 586f290b..a9a1c160 100644 --- a/crates/compass-graph/src/snapshot.rs +++ b/crates/compass-graph/src/snapshot.rs @@ -3330,7 +3330,7 @@ fn build_term_postings(graph: &GraphDocument) -> BTreeMap> { } fn searchable_node_terms(node: &NodeRecord) -> BTreeSet { - let mut terms = BTreeSet::new(); + let mut terms = compass_model::search::document_search_terms(node); terms.extend(search_terms(&node.name)); terms.extend(search_terms(&node.qualified_name)); terms.extend(compass_model::search::identifier_search_terms(&node.name)); diff --git a/crates/compass-graph/src/v1.rs b/crates/compass-graph/src/v1.rs index d9b60108..1faaf1b0 100644 --- a/crates/compass-graph/src/v1.rs +++ b/crates/compass-graph/src/v1.rs @@ -1833,7 +1833,7 @@ fn normalize_v1_with_mode( /// and derive stable identities. `compass.graph/1` keeps its established wire /// shape: document nodes publish as `Resource(document)` and express Markdown /// structure through source-backed nodes, meaningful names, qualified names, -/// containment, and reference edges. +/// containment, reference edges, and an optional bounded content excerpt. fn downgrade_document_details_for_graph_v1(nodes: &mut [NodeRecord]) { for node in nodes { let details = match node.details.take() { @@ -1866,6 +1866,7 @@ fn downgrade_document_details_for_graph_v1(nodes: &mut [NodeRecord]) { resource_kind: ResourceKind::Document, uri: details.uri, media_type, + content: details.content, })); } } @@ -3697,7 +3698,12 @@ fn insert_raw_evidence(attributes: &mut Map, evidence: &Provenanc fn insert_raw_node_details(attributes: &mut Map, details: &NodeDetails) { match details { - NodeDetails::File(_) | NodeDetails::Resource(_) => {} + NodeDetails::File(_) => {} + NodeDetails::Resource(details) => { + insert_optional_string(attributes, "resource_content", details.content.as_ref()); + insert_optional_string(attributes, "uri", details.uri.as_ref()); + insert_optional_string(attributes, "media_type", details.media_type.as_ref()); + } NodeDetails::Document(details) => insert_raw_document_details(attributes, details), NodeDetails::Symbol(details) => { if let Some(inventory) = &details.call_sites { @@ -5365,6 +5371,7 @@ fn node_details( .map(|slug| format!("#{slug}")) }), media_type: optional_string(attributes, "media_type"), + content: optional_string(attributes, "resource_content"), })) } } diff --git a/crates/compass-graph/tests/markdown_identity.rs b/crates/compass-graph/tests/markdown_identity.rs index d9b7f76f..e063f133 100644 --- a/crates/compass-graph/tests/markdown_identity.rs +++ b/crates/compass-graph/tests/markdown_identity.rs @@ -413,3 +413,41 @@ fn markdown_explicit_link_evidence_survives_absolute_path_aliases() -> Result<() assert!(edge.relationship_site.is_some()); Ok(()) } + +#[test] +fn published_markdown_retains_bounded_prose_and_trusted_round_trip() -> Result<(), Box> { + let dir = tempfile::tempdir()?; + let root = dir.path(); + let path = root.join("README.md"); + fs::write( + &path, + format!( + "# Operations\n\n{} Account suspension is implemented here.\n", + "Context ".repeat(100) + ), + )?; + let raw = Engine::default().extract(&path)?; + let graph = normalize_document_v1( + &build_from_extraction(&raw, true, Some(root)), + root, + "sha256:test", + None, + )?; + let paragraph = graph.nodes.iter().find(|node| matches!(&node.details, Some(NodeDetails::Resource(details)) if details.content.as_ref().is_some_and(|text| text.contains("Account suspension")))).ok_or("prose missing")?; + assert!(!paragraph.name.contains("Account suspension")); + assert!(compass_model::search::document_search_terms(paragraph).contains("suspension")); + let round_trip: compass_model::code_graph::GraphDocument = + serde_json::from_slice(&serde_json::to_vec(&graph)?)?; + assert_eq!(round_trip, graph); + let recomposition = compass_graph::extraction_from_v1(&graph); + let raw = recomposition + .nodes + .iter() + .find(|node| node.id == paragraph.id) + .ok_or("missing recomposition record")?; + assert!( + raw.string("resource_content") + .contains("Account suspension") + ); + Ok(()) +} diff --git a/crates/compass-graph/tests/store_snapshot.rs b/crates/compass-graph/tests/store_snapshot.rs index 347be5c5..2e983d6c 100644 --- a/crates/compass-graph/tests/store_snapshot.rs +++ b/crates/compass-graph/tests/store_snapshot.rs @@ -373,6 +373,7 @@ fn immutable_snapshot_indexes_semantic_markdown_table_nodes() -> Result<(), Box< resource_kind: ResourceKind::Document, uri: Some("#owners".to_owned()), media_type: Some("text/markdown".to_owned()), + content: None, })); let mut row = node("table-row"); @@ -384,6 +385,7 @@ fn immutable_snapshot_indexes_semantic_markdown_table_nodes() -> Result<(), Box< resource_kind: ResourceKind::Document, uri: None, media_type: Some("text/markdown".to_owned()), + content: None, })); document.nodes.extend([table, row]); diff --git a/crates/compass-languages/src/engine.rs b/crates/compass-languages/src/engine.rs index f13ba513..73169e33 100644 --- a/crates/compass-languages/src/engine.rs +++ b/crates/compass-languages/src/engine.rs @@ -1464,6 +1464,10 @@ fn push_rationale( id: id.clone(), attributes: Map::from_iter([ ("label".to_owned(), Value::String(label)), + ( + "resource_content".to_owned(), + Value::String(text.chars().take(1024).collect()), + ), ( "file_type".to_owned(), Value::String("rationale".to_owned()), diff --git a/crates/compass-languages/tests/engine_edge_coverage.rs b/crates/compass-languages/tests/engine_edge_coverage.rs index 206f7a58..ebeef8a2 100644 --- a/crates/compass-languages/tests/engine_edge_coverage.rs +++ b/crates/compass-languages/tests/engine_edge_coverage.rs @@ -1101,6 +1101,17 @@ def top_level(arg: InputType) -> OutputType: .iter() .any(|edge| edge.string("relation") == "rationale_for") ); + assert!(extraction.nodes.iter().any(|node| { + node.string("resource_content") + .contains("function rationale") + })); + assert!( + extraction + .nodes + .iter() + .filter(|node| node.string("file_type") == "rationale") + .all(|node| node.string("resource_content").len() <= 4096) + ); assert!(extraction.raw_calls.is_none()); let evidence = extraction .semantic_evidence diff --git a/crates/compass-mcp/src/code_query.rs b/crates/compass-mcp/src/code_query.rs index 0d8e1741..5ae475d0 100644 --- a/crates/compass-mcp/src/code_query.rs +++ b/crates/compass-mcp/src/code_query.rs @@ -47,6 +47,7 @@ pub(super) fn schema(required: &[&str]) -> Value { pub(super) fn search_schema() -> Value { let mut result = schema(&["query"]); + result["properties"]["semantic_search"] = json!({"type":"boolean","default":false,"description":"Optional offline local-LSA fallback; cannot be combined with exact."}); result["properties"]["exact"] = json!({"type":"boolean","default":false,"description":"Only exact ID or normalized name matches; no lexical fallback."}); result["properties"]["source_file"] = json!({"type":"string","minLength":1,"maxLength":4096,"description":"Exact stored source path; requires exact=true."}); result["properties"]["start_line"] = json!({"type":"integer","minimum":1,"maximum":u32::MAX,"description":"Declaration start line; requires exact=true and source_file."}); @@ -90,6 +91,13 @@ pub(super) fn invoke_with_engine( "relations requires get_impact".to_owned(), )); } + if arguments.contains_key("semantic_search") + && !matches!(name, "query_graph" | "search_symbols") + { + return Err(super::InvocationError::InvalidParams( + "semantic_search requires query_graph or search_symbols".to_owned(), + )); + } let limits = limits(arguments)?; match name { "query_graph" => engine.query_natural(NaturalQueryRequest { @@ -103,6 +111,11 @@ pub(super) fn invoke_with_engine( limits, }; let exact = boolean(arguments, "exact")?; + if exact && boolean(arguments, "semantic_search")? { + return Err(super::InvocationError::InvalidParams( + "semantic_search cannot be combined with exact".to_owned(), + )); + } if !exact && ["source_file", "start_line", "kind"] .iter() @@ -245,6 +258,7 @@ pub(super) fn validate_query_graph_arguments( ) -> Result<(), super::InvocationError> { const ALLOWED: &[&str] = &[ "question", + "semantic_search", "project_path", "mode", "depth", @@ -275,6 +289,11 @@ pub(super) fn validate_query_graph_arguments( let legacy = ["mode", "depth", "token_budget", "context_filter"] .iter() .any(|name| arguments.contains_key(*name)); + if legacy && arguments.contains_key("semantic_search") { + return Err(super::InvocationError::InvalidParams( + "semantic_search requires bounded discovery; omit legacy traversal controls".to_owned(), + )); + } if legacy && has_discovery_arguments(arguments) { return Err(super::InvocationError::InvalidParams( "legacy traversal controls cannot be combined with discovery controls".to_owned(), diff --git a/crates/compass-mcp/src/lib.rs b/crates/compass-mcp/src/lib.rs index b2b93880..d21f3d43 100644 --- a/crates/compass-mcp/src/lib.rs +++ b/crates/compass-mcp/src/lib.rs @@ -1061,9 +1061,17 @@ fn invoke_typed_tool( context: Option<&GraphContext>, ) -> Result { let engine = cached_typed_engine(store, graph_path, context)?; - let engine = engine + let mut engine = engine .lock() .unwrap_or_else(std::sync::PoisonError::into_inner); + let semantic = arguments + .get("semantic_search") + .map_or(Ok(false), |value| { + value.as_bool().ok_or_else(|| { + InvocationError::InvalidParams("semantic_search must be a boolean".to_owned()) + }) + })?; + engine.set_semantic_search(semantic); let response = code_query::invoke_with_engine(name, arguments, &engine)?; let context = typed_agent_query_context(name, arguments, &response, &engine); let view = build_code_query_view(&response, context) @@ -1159,9 +1167,17 @@ fn invoke_discovery_tool( ) -> Result { let started = Instant::now(); let engine = cached_typed_engine(store, graph_path, context)?; - let engine = engine + let mut engine = engine .lock() .unwrap_or_else(std::sync::PoisonError::into_inner); + let semantic = arguments + .get("semantic_search") + .map_or(Ok(false), |value| { + value.as_bool().ok_or_else(|| { + InvocationError::InvalidParams("semantic_search must be a boolean".to_owned()) + }) + })?; + engine.set_semantic_search(semantic); let response = code_query::invoke_discovery_with_engine(arguments, &engine)?; let question = arguments .get("question") @@ -1364,6 +1380,7 @@ fn tool_specs() -> Vec { "relation_contexts":{"type":"array","maxItems":MAX_DISCOVERY_FILTERS,"items":{"type":"string","minLength":1,"maxLength":MAX_DISCOVERY_FILTER_BYTES},"description":"Canonical discovery relationship contexts"}, "scope":{"type":"array","maxItems":MAX_DISCOVERY_FILTERS,"items":{"type":"object","additionalProperties":false,"properties":{"kind":{"type":"string","enum":["community","source","package","node"]},"value":{"type":"string","minLength":1,"maxLength":MAX_DISCOVERY_FILTER_BYTES}},"required":["kind","value"]},"description":"Repeatable OR discovery scopes"}, "traversal":{"type":"string","enum":["bfs","dfs"],"description":"Bounded discovery traversal order; omitted uses bfs"}, + "semantic_search":{"type":"boolean","default":false,"description":"Opt into bounded offline local-LSA embeddings when name/concept lookup has no match."}, "include_heuristic":{"type":"boolean"}, "max_depth":{"type":"integer","minimum":1,"maximum":MAX_DISCOVERY_DEPTH}, "max_seeds":{"type":"integer","minimum":1,"maximum":MAX_DISCOVERY_SEEDS}, diff --git a/crates/compass-mcp/tests/code_query_tools.rs b/crates/compass-mcp/tests/code_query_tools.rs index c868b26a..d90320bc 100644 --- a/crates/compass-mcp/tests/code_query_tools.rs +++ b/crates/compass-mcp/tests/code_query_tools.rs @@ -965,3 +965,53 @@ fn impact_tools_filter_typed_relations_and_audit_omissions() -> Result<(), Box Result<(), Box> +{ + let dir = tempfile::tempdir()?; + let path = write_typed_graph(dir.path())?; + let mut graph = GraphDocument::load(&path)?; + let target = graph + .nodes + .iter_mut() + .find(|node| node.name == "Target") + .ok_or("missing Target")?; + target.name = "AuthzGate".into(); + target.qualified_name = "Fixture.AuthzGate".into(); + fs::write(&path, serde_json::to_vec(&graph)?)?; + let server = CompassMcp::new(path); + let response = invoke( + &server, + "search_symbols", + json!({"query":"authorization", "semantic_search":true}), + )?; + assert!( + response["conceptMatches"] + .as_array() + .is_some_and(|items| items.iter().any(|item| item["method"] == "synonym")) + ); + let discovered = invoke( + &server, + "query_graph", + json!({"question":"How does authorization work?", "semantic_search":true}), + )?; + assert!(!discovered["seeds"].as_array().ok_or("no seeds")?.is_empty()); + let exact = invoke( + &server, + "search_symbols", + json!({"query":"authorization", "exact":true}), + )?; + assert_eq!(exact["nodes"], json!([])); + for args in [ + json!({"query":"authorization","semantic_search":"yes"}), + json!({"query":"authorization","semantic_search":true,"exact":true}), + ] { + let output = server.invoke( + "search_symbols", + args.as_object().cloned().unwrap_or_else(Map::new), + ); + assert!(output.contains("semantic_search"), "{output}"); + } + Ok(()) +} diff --git a/crates/compass-model/src/code_graph.rs b/crates/compass-model/src/code_graph.rs index 52bccb0d..91f04bdd 100644 --- a/crates/compass-model/src/code_graph.rs +++ b/crates/compass-model/src/code_graph.rs @@ -703,6 +703,9 @@ pub struct ResourceNodeDetails { pub uri: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub media_type: Option, + /// Source-backed document or rationale excerpt, bounded to 4 KiB. + #[serde(default, skip_serializing_if = "Option::is_none")] + pub content: Option, } #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] diff --git a/crates/compass-model/src/query_contract.rs b/crates/compass-model/src/query_contract.rs index 530c1d78..c626053f 100644 --- a/crates/compass-model/src/query_contract.rs +++ b/crates/compass-model/src/query_contract.rs @@ -556,6 +556,28 @@ pub struct CodeQueryResponse { pub call_summary: Option, #[serde(default, skip_serializing_if = "Option::is_none")] pub impact_summary: Option, + /// Approximate concept recall; never changes structural edge evidence. + #[serde(default, skip_serializing_if = "Vec::is_empty")] + pub concept_matches: Vec, +} + +#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum ConceptMatchMethod { + Synonym, + DocumentLink, + SemanticLsa, +} + +#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct ConceptMatch { + pub node_id: String, + pub method: ConceptMatchMethod, + pub query: String, + pub matched: String, + /// Published document/section path used to reach code, empty for name recall. + pub via: Vec, } #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] @@ -611,6 +633,7 @@ impl CodeQueryResponse { truncated: false, call_summary: None, impact_summary: None, + concept_matches: Vec::new(), } } @@ -621,6 +644,15 @@ impl CodeQueryResponse { .total_cmp(&left.score) .then_with(|| left.node_id.cmp(&right.node_id)) }); + self.concept_matches.sort_by(|left, right| { + left.node_id + .cmp(&right.node_id) + .then_with(|| left.method.cmp(&right.method)) + .then_with(|| left.query.cmp(&right.query)) + .then_with(|| left.matched.cmp(&right.matched)) + .then_with(|| left.via.cmp(&right.via)) + }); + self.concept_matches.dedup(); self.nodes.sort_by(|left, right| left.id.cmp(&right.id)); self.edges.sort_by(|left, right| left.id.cmp(&right.id)); self.files.sort_by(|left, right| left.path.cmp(&right.path)); diff --git a/crates/compass-model/src/search.rs b/crates/compass-model/src/search.rs index 39c4da46..3268973d 100644 --- a/crates/compass-model/src/search.rs +++ b/crates/compass-model/src/search.rs @@ -50,6 +50,26 @@ pub fn identifier_search_terms(value: &str) -> BTreeSet { terms } +/// Bounded prose terms for document discovery. This is recall evidence, not +/// declaration identity or an alias. Older store indexes require a rebuild. +#[must_use] +pub fn document_search_terms(node: &crate::code_graph::NodeRecord) -> BTreeSet { + let content = match &node.details { + Some(crate::code_graph::NodeDetails::Document(details)) => details.content.as_deref(), + Some(crate::code_graph::NodeDetails::Resource(details)) => details.content.as_deref(), + _ => None, + }; + let text = content + .unwrap_or_default() + .chars() + .take(8192) + .collect::(); + identifier_search_terms(&text) + .into_iter() + .take(512) + .collect() +} + /// Build exact identifier-concept postings for trusted direct callers. /// /// Each concept maps to source-backed callable IDs that directly call a diff --git a/crates/compass-model/src/validation.rs b/crates/compass-model/src/validation.rs index 728571a4..cdf97d4a 100644 --- a/crates/compass-model/src/validation.rs +++ b/crates/compass-model/src/validation.rs @@ -331,6 +331,17 @@ pub fn validate_code_graph_records(document: &CodeGraphDocument) -> CodeGraphVal node.kind.as_str() )); } + if let Some(NodeDetails::Resource(details)) = node.details.as_ref() + && let Some(content) = &details.content + && (content.len() > MAX_DOCUMENT_TEXT_BYTES + || !matches!( + details.resource_kind, + crate::code_graph::ResourceKind::Document + | crate::code_graph::ResourceKind::Rationale + )) + { + errors.push(format!("node {} resource content requires document/rationale kind and at most {MAX_DOCUMENT_TEXT_BYTES} bytes", node.id)); + } if let Some(NodeDetails::Document(details)) = node.details.as_ref() { validate_document_details(&node.id, details, node.source.as_ref(), &files, &mut errors); for reference in &details.references { diff --git a/crates/compass-model/tests/code_graph_validation.rs b/crates/compass-model/tests/code_graph_validation.rs index dceed4b8..ed71826b 100644 --- a/crates/compass-model/tests/code_graph_validation.rs +++ b/crates/compass-model/tests/code_graph_validation.rs @@ -887,3 +887,28 @@ fn symbol_call_inventories_validate_bounds_files_and_ordering() { graph.nodes[1].details = Some(NodeDetails::Symbol(outside)); assert!(validate_code_graph(&graph).is_err()); } + +#[test] +fn resource_prose_is_bounded_and_restricted_to_document_or_rationale() { + use compass_model::code_graph::{NodeDetails, ResourceKind, ResourceNodeDetails}; + let mut graph = document(); + let node = &mut graph.nodes[0]; + node.kind = NodeKind::Resource; + node.details = Some(NodeDetails::Resource(ResourceNodeDetails { + resource_kind: ResourceKind::Document, + uri: None, + media_type: Some("text/markdown".into()), + content: Some("source-backed prose".into()), + })); + graph.links.clear(); + assert!(validate_code_graph(&graph).is_ok()); + if let Some(NodeDetails::Resource(details)) = &mut graph.nodes[0].details { + details.content = Some("x".repeat(4097)); + } + assert!(validate_code_graph(&graph).is_err()); + if let Some(NodeDetails::Resource(details)) = &mut graph.nodes[0].details { + details.content = Some("small".into()); + details.resource_kind = ResourceKind::Image; + } + assert!(validate_code_graph(&graph).is_err()); +} diff --git a/crates/compass-output/assets/viewer/graph.js b/crates/compass-output/assets/viewer/graph.js index 773ff05c..0196defe 100644 --- a/crates/compass-output/assets/viewer/graph.js +++ b/crates/compass-output/assets/viewer/graph.js @@ -1,11 +1,11 @@ -var O_=Rn=>{throw TypeError(Rn)};var N_=(Rn,ti,ni)=>ti.has(Rn)||O_("Cannot "+ni);var Un=(Rn,ti,ni)=>(N_(Rn,ti,"read from private field"),ni?ni.call(Rn):ti.get(Rn)),M_=(Rn,ti,ni)=>ti.has(Rn)?O_("Cannot add the same private member more than once"):ti instanceof WeakSet?ti.add(Rn):ti.set(Rn,ni),Ey=(Rn,ti,ni,pr)=>(N_(Rn,ti,"write to private field"),pr?pr.call(Rn,ni):ti.set(Rn,ni),ni);(function(){"use strict";var un,vi;function Rn(t,e){for(var n=0;ni[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function ti(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ni={exports:{}},pr={};var Ty;function R_(){if(Ty)return pr;Ty=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,o,s){var a=null;if(s!==void 0&&(a=""+s),o.key!==void 0&&(a=""+o.key),"key"in o){s={};for(var l in o)l!=="key"&&(s[l]=o[l])}else s=o;return o=s.ref,{$$typeof:t,type:i,key:a,ref:o!==void 0?o:null,props:s}}return pr.Fragment=e,pr.jsx=n,pr.jsxs=n,pr}var Oy;function k_(){return Oy||(Oy=1,ni.exports=R_()),ni.exports}var d=k_(),Yd={exports:{}},oA={},$d={exports:{}},Wd={};var Ny;function D_(){return Ny||(Ny=1,(function(t){function e(z,U){var Q=z.length;z.push(U);e:for(;0>>1,X=z[le];if(0>>1;leo(H,Q))seo(de,H)?(z[le]=de,z[se]=Q,le=se):(z[le]=H,z[D]=Q,le=D);else if(seo(de,Q))z[le]=de,z[se]=Q,le=se;else break e}}return U}function o(z,U){var Q=z.sortIndex-U.sortIndex;return Q!==0?Q:z.id-U.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var C=[],c=[],u=1,h=null,m=3,v=!1,b=!1,x=!1,y=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function M(z){for(var U=n(c);U!==null;){if(U.callback===null)i(c);else if(U.startTime<=z)i(c),U.sortIndex=U.expirationTime,e(C,U);else break;U=n(c)}}function k(z){if(x=!1,M(z),!b)if(n(C)!==null)b=!0,G||(G=!0,J());else{var U=n(c);U!==null&&ue(k,U.startTime-z)}}var G=!1,L=-1,F=5,re=-1;function pe(){return y?!0:!(t.unstable_now()-rez&&pe());){var le=h.callback;if(typeof le=="function"){h.callback=null,m=h.priorityLevel;var X=le(h.expirationTime<=z);if(z=t.unstable_now(),typeof X=="function"){h.callback=X,M(z),U=!0;break t}h===n(C)&&i(C),M(z)}else i(C);h=n(C)}if(h!==null)U=!0;else{var R=n(c);R!==null&&ue(k,R.startTime-z),U=!1}}break e}finally{h=null,m=Q,v=!1}U=void 0}}finally{U?J():G=!1}}}var J;if(typeof O=="function")J=function(){O(ie)};else if(typeof MessageChannel<"u"){var ve=new MessageChannel,me=ve.port2;ve.port1.onmessage=ie,J=function(){me.postMessage(null)}}else J=function(){S(ie,0)};function ue(z,U){L=S(function(){z(t.unstable_now())},U)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_forceFrameRate=function(z){0>z||125le?(z.sortIndex=Q,e(c,z),n(C)===null&&z===n(c)&&(x?(T(L),L=-1):x=!0,ue(k,Q-le))):(z.sortIndex=X,e(C,z),b||v||(b=!0,G||(G=!0,J()))),z},t.unstable_shouldYield=pe,t.unstable_wrapCallback=function(z){var U=m;return function(){var Q=m;m=U;try{return z.apply(this,arguments)}finally{m=Q}}}})(Wd)),Wd}var My;function __(){return My||(My=1,$d.exports=D_()),$d.exports}var Kd={exports:{}},Xe={};var Ry;function j_(){if(Ry)return Xe;Ry=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),m=Symbol.iterator;function v(R){return R===null||typeof R!="object"?null:(R=m&&R[m]||R["@@iterator"],typeof R=="function"?R:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,y={};function S(R,D,H){this.props=R,this.context=D,this.refs=y,this.updater=H||b}S.prototype.isReactComponent={},S.prototype.setState=function(R,D){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,D,"setState")},S.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function T(){}T.prototype=S.prototype;function O(R,D,H){this.props=R,this.context=D,this.refs=y,this.updater=H||b}var M=O.prototype=new T;M.constructor=O,x(M,S.prototype),M.isPureReactComponent=!0;var k=Array.isArray;function G(){}var L={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function re(R,D,H){var se=H.ref;return{$$typeof:t,type:R,key:D,ref:se!==void 0?se:null,props:H}}function pe(R,D){return re(R.type,D,R.props)}function ie(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function J(R){var D={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(H){return D[H]})}var ve=/\/+/g;function me(R,D){return typeof R=="object"&&R!==null&&R.key!=null?J(""+R.key):D.toString(36)}function ue(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(G,G):(R.status="pending",R.then(function(D){R.status==="pending"&&(R.status="fulfilled",R.value=D)},function(D){R.status==="pending"&&(R.status="rejected",R.reason=D)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function z(R,D,H,se,de){var be=typeof R;(be==="undefined"||be==="boolean")&&(R=null);var Ne=!1;if(R===null)Ne=!0;else switch(be){case"bigint":case"string":case"number":Ne=!0;break;case"object":switch(R.$$typeof){case t:case e:Ne=!0;break;case u:return Ne=R._init,z(Ne(R._payload),D,H,se,de)}}if(Ne)return de=de(R),Ne=se===""?"."+me(R,0):se,k(de)?(H="",Ne!=null&&(H=Ne.replace(ve,"$&/")+"/"),z(de,D,H,"",function(xe){return xe})):de!=null&&(ie(de)&&(de=pe(de,H+(de.key==null||R&&R.key===de.key?"":(""+de.key).replace(ve,"$&/")+"/")+Ne)),D.push(de)),1;Ne=0;var ge=se===""?".":se+":";if(k(R))for(var ae=0;ae"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Qd.exports=z_(),Qd.exports}var zy;function P_(){if(zy)return oA;zy=1;var t=__(),e=Xd(),n=jy();function i(r){var g="https://react.dev/errors/"+r;if(1X||(r.current=le[X],le[X]=null,X--)}function H(r,g){X++,le[X]=r.current,r.current=g}var se=R(null),de=R(null),be=R(null),Ne=R(null);function ge(r,g){switch(H(be,g),H(de,r),H(se,null),g.nodeType){case 9:case 11:r=(r=g.documentElement)&&(r=r.namespaceURI)?QD(r):0;break;default:if(r=g.tagName,g=g.namespaceURI)g=QD(g),r=qD(g,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}D(se),H(se,r)}function ae(){D(se),D(de),D(be)}function xe(r){r.memoizedState!==null&&H(Ne,r);var g=se.current,A=qD(g,r.type);g!==A&&(H(de,r),H(se,A))}function Me(r){de.current===r&&(D(se),D(de)),Ne.current===r&&(D(Ne),IC._currentValue=Q)}var _,ce;function Se(r){if(_===void 0)try{throw Error()}catch(A){var g=A.stack.trim().match(/\n( *(at )?)/);_=g&&g[1]||"",ce=-1{throw TypeError(Rn)};var N_=(Rn,ti,ni)=>ti.has(Rn)||O_("Cannot "+ni);var Un=(Rn,ti,ni)=>(N_(Rn,ti,"read from private field"),ni?ni.call(Rn):ti.get(Rn)),M_=(Rn,ti,ni)=>ti.has(Rn)?O_("Cannot add the same private member more than once"):ti instanceof WeakSet?ti.add(Rn):ti.set(Rn,ni),Ey=(Rn,ti,ni,pr)=>(N_(Rn,ti,"write to private field"),pr?pr.call(Rn,ni):ti.set(Rn,ni),ni);(function(){"use strict";var un,vi;function Rn(t,e){for(var n=0;ni[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function ti(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ni={exports:{}},pr={};var Ty;function R_(){if(Ty)return pr;Ty=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,o,s){var a=null;if(s!==void 0&&(a=""+s),o.key!==void 0&&(a=""+o.key),"key"in o){s={};for(var l in o)l!=="key"&&(s[l]=o[l])}else s=o;return o=s.ref,{$$typeof:t,type:i,key:a,ref:o!==void 0?o:null,props:s}}return pr.Fragment=e,pr.jsx=n,pr.jsxs=n,pr}var Oy;function k_(){return Oy||(Oy=1,ni.exports=R_()),ni.exports}var d=k_(),Yd={exports:{}},oA={},$d={exports:{}},Wd={};var Ny;function D_(){return Ny||(Ny=1,(function(t){function e(z,U){var Q=z.length;z.push(U);e:for(;0>>1,X=z[le];if(0>>1;leo(H,Q))seo(de,H)?(z[le]=de,z[se]=Q,le=se):(z[le]=H,z[D]=Q,le=D);else if(seo(de,Q))z[le]=de,z[se]=Q,le=se;else break e}}return U}function o(z,U){var Q=z.sortIndex-U.sortIndex;return Q!==0?Q:z.id-U.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var C=[],c=[],u=1,h=null,m=3,v=!1,b=!1,x=!1,y=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function M(z){for(var U=n(c);U!==null;){if(U.callback===null)i(c);else if(U.startTime<=z)i(c),U.sortIndex=U.expirationTime,e(C,U);else break;U=n(c)}}function k(z){if(x=!1,M(z),!b)if(n(C)!==null)b=!0,G||(G=!0,J());else{var U=n(c);U!==null&&ue(k,U.startTime-z)}}var G=!1,L=-1,F=5,re=-1;function pe(){return y?!0:!(t.unstable_now()-rez&&pe());){var le=h.callback;if(typeof le=="function"){h.callback=null,m=h.priorityLevel;var X=le(h.expirationTime<=z);if(z=t.unstable_now(),typeof X=="function"){h.callback=X,M(z),U=!0;break t}h===n(C)&&i(C),M(z)}else i(C);h=n(C)}if(h!==null)U=!0;else{var R=n(c);R!==null&&ue(k,R.startTime-z),U=!1}}break e}finally{h=null,m=Q,v=!1}U=void 0}}finally{U?J():G=!1}}}var J;if(typeof O=="function")J=function(){O(ie)};else if(typeof MessageChannel<"u"){var ve=new MessageChannel,me=ve.port2;ve.port1.onmessage=ie,J=function(){me.postMessage(null)}}else J=function(){S(ie,0)};function ue(z,U){L=S(function(){z(t.unstable_now())},U)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(z){z.callback=null},t.unstable_forceFrameRate=function(z){0>z||125le?(z.sortIndex=Q,e(c,z),n(C)===null&&z===n(c)&&(x?(T(L),L=-1):x=!0,ue(k,Q-le))):(z.sortIndex=X,e(C,z),b||v||(b=!0,G||(G=!0,J()))),z},t.unstable_shouldYield=pe,t.unstable_wrapCallback=function(z){var U=m;return function(){var Q=m;m=U;try{return z.apply(this,arguments)}finally{m=Q}}}})(Wd)),Wd}var My;function __(){return My||(My=1,$d.exports=D_()),$d.exports}var Kd={exports:{}},Xe={};var Ry;function j_(){if(Ry)return Xe;Ry=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),m=Symbol.iterator;function v(R){return R===null||typeof R!="object"?null:(R=m&&R[m]||R["@@iterator"],typeof R=="function"?R:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,y={};function S(R,D,H){this.props=R,this.context=D,this.refs=y,this.updater=H||b}S.prototype.isReactComponent={},S.prototype.setState=function(R,D){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,D,"setState")},S.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function T(){}T.prototype=S.prototype;function O(R,D,H){this.props=R,this.context=D,this.refs=y,this.updater=H||b}var M=O.prototype=new T;M.constructor=O,x(M,S.prototype),M.isPureReactComponent=!0;var k=Array.isArray;function G(){}var L={H:null,A:null,T:null,S:null},F=Object.prototype.hasOwnProperty;function re(R,D,H){var se=H.ref;return{$$typeof:t,type:R,key:D,ref:se!==void 0?se:null,props:H}}function pe(R,D){return re(R.type,D,R.props)}function ie(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function J(R){var D={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(H){return D[H]})}var ve=/\/+/g;function me(R,D){return typeof R=="object"&&R!==null&&R.key!=null?J(""+R.key):D.toString(36)}function ue(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(G,G):(R.status="pending",R.then(function(D){R.status==="pending"&&(R.status="fulfilled",R.value=D)},function(D){R.status==="pending"&&(R.status="rejected",R.reason=D)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function z(R,D,H,se,de){var be=typeof R;(be==="undefined"||be==="boolean")&&(R=null);var Me=!1;if(R===null)Me=!0;else switch(be){case"bigint":case"string":case"number":Me=!0;break;case"object":switch(R.$$typeof){case t:case e:Me=!0;break;case u:return Me=R._init,z(Me(R._payload),D,H,se,de)}}if(Me)return de=de(R),Me=se===""?"."+me(R,0):se,k(de)?(H="",Me!=null&&(H=Me.replace(ve,"$&/")+"/"),z(de,D,H,"",function(xe){return xe})):de!=null&&(ie(de)&&(de=pe(de,H+(de.key==null||R&&R.key===de.key?"":(""+de.key).replace(ve,"$&/")+"/")+Me)),D.push(de)),1;Me=0;var ge=se===""?".":se+":";if(k(R))for(var ae=0;ae"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Qd.exports=z_(),Qd.exports}var zy;function P_(){if(zy)return oA;zy=1;var t=__(),e=Xd(),n=jy();function i(r){var g="https://react.dev/errors/"+r;if(1X||(r.current=le[X],le[X]=null,X--)}function H(r,g){X++,le[X]=r.current,r.current=g}var se=R(null),de=R(null),be=R(null),Me=R(null);function ge(r,g){switch(H(be,g),H(de,r),H(se,null),g.nodeType){case 9:case 11:r=(r=g.documentElement)&&(r=r.namespaceURI)?QD(r):0;break;default:if(r=g.tagName,g=g.namespaceURI)g=QD(g),r=qD(g,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}D(se),H(se,r)}function ae(){D(se),D(de),D(be)}function xe(r){r.memoizedState!==null&&H(Me,r);var g=se.current,A=qD(g,r.type);g!==A&&(H(de,r),H(se,A))}function Re(r){de.current===r&&(D(se),D(de)),Me.current===r&&(D(Me),IC._currentValue=Q)}var j,ce;function Se(r){if(j===void 0)try{throw Error()}catch(A){var g=A.stack.trim().match(/\n( *(at )?)/);j=g&&g[1]||"",ce=-1)":-1f||P[I]!==$[f]){var te=` `+P[I].replace(" at new "," at ");return r.displayName&&te.includes("")&&(te=te.replace("",r.displayName)),te}while(1<=I&&0<=f);break}}}finally{_e=!1,Error.prepareStackTrace=A}return(A=r?r.displayName||r.name:"")?Se(A):""}function Et(r,g){switch(r.tag){case 26:case 27:case 5:return Se(r.type);case 16:return Se("Lazy");case 13:return r.child!==g&&g!==null?Se("Suspense Fallback"):Se("Suspense");case 19:return Se("SuspenseList");case 0:case 15:return gt(r.type,!1);case 11:return gt(r.type.render,!1);case 1:return gt(r.type,!0);case 31:return Se("Activity");default:return""}}function ot(r){try{var g="",A=null;do g+=Et(r,A),A=r,r=r.return;while(r);return g}catch(I){return` Error generating stack: `+I.message+` -`+I.stack}}var Ce=Object.prototype.hasOwnProperty,Tt=t.unstable_scheduleCallback,Ve=t.unstable_cancelCallback,sn=t.unstable_shouldYield,Ai=t.unstable_requestPaint,Ot=t.unstable_now,qn=t.unstable_getCurrentPriorityLevel,Jo=t.unstable_ImmediatePriority,gn=t.unstable_UserBlockingPriority,jn=t.unstable_NormalPriority,W=t.unstable_LowPriority,Fe=t.unstable_IdlePriority,Ee=t.log,Ht=t.unstable_setDisableYieldValue,pt=null,Ke=null;function Xt(r){if(typeof Ee=="function"&&Ht(r),Ke&&typeof Ke.setStrictMode=="function")try{Ke.setStrictMode(pt,r)}catch{}}var zn=Math.clz32?Math.clz32:um,oo=Math.log,dm=Math.LN2;function um(r){return r>>>=0,r===0?32:31-(oo(r)/dm|0)|0}var fa=256,pa=262144,Yr=4194304;function To(r){var g=r&42;if(g!==0)return g;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function $r(r,g,A){var I=r.pendingLanes;if(I===0)return 0;var f=0,p=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var N=I&134217727;return N!==0?(I=N&~p,I!==0?f=To(I):(w&=N,w!==0?f=To(w):A||(A=N&~r,A!==0&&(f=To(A))))):(N=I&~p,N!==0?f=To(N):w!==0?f=To(w):A||(A=I&~r,A!==0&&(f=To(A)))),f===0?0:g!==0&&g!==f&&(g&p)===0&&(p=f&-f,A=g&-g,p>=A||p===32&&(A&4194048)!==0)?g:f}function Wr(r,g){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&g)===0}function hm(r,g){switch(r){case 1:case 2:case 4:case 8:case 64:return g+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return g+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function xl(){var r=Yr;return Yr<<=1,(Yr&62914560)===0&&(Yr=4194304),r}function Sl(r){for(var g=[],A=0;31>A;A++)g.push(r);return g}function ro(r,g){r.pendingLanes|=g,g!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Ie(r,g,A,I,f,p){var w=r.pendingLanes;r.pendingLanes=A,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=A,r.entangledLanes&=A,r.errorRecoveryDisabledLanes&=A,r.shellSuspendCounter=0;var N=r.entanglements,P=r.expirationTimes,$=r.hiddenUpdates;for(A=w&~A;0"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var mce=/[\n"\\]/g;function Pi(r){return r.replace(mce,function(g){return"\\"+g.charCodeAt(0).toString(16)+" "})}function vm(r,g,A,I,f,p,w,N){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),g!=null?w==="number"?(g===0&&r.value===""||r.value!=g)&&(r.value=""+zi(g)):r.value!==""+zi(g)&&(r.value=""+zi(g)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),g!=null?ym(r,w,zi(g)):A!=null?ym(r,w,zi(A)):I!=null&&r.removeAttribute("value"),f==null&&p!=null&&(r.defaultChecked=!!p),f!=null&&(r.checked=f&&typeof f!="function"&&typeof f!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?r.name=""+zi(N):r.removeAttribute("name")}function HM(r,g,A,I,f,p,w,N){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(r.type=p),g!=null||A!=null){if(!(p!=="submit"&&p!=="reset"||g!=null)){mm(r);return}A=A!=null?""+zi(A):"",g=g!=null?""+zi(g):A,N||g===r.value||(r.value=g),r.defaultValue=g}I=I??f,I=typeof I!="function"&&typeof I!="symbol"&&!!I,r.checked=N?r.checked:!!I,r.defaultChecked=!!I,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),mm(r)}function ym(r,g,A){g==="number"&&zc(r.ownerDocument)===r||r.defaultValue===""+A||(r.defaultValue=""+A)}function Sa(r,g,A,I){if(r=r.options,g){g={};for(var f=0;f"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Em=!1;if(nr)try{var Ml={};Object.defineProperty(Ml,"passive",{get:function(){Em=!0}}),window.addEventListener("test",Ml,Ml),window.removeEventListener("test",Ml,Ml)}catch{Em=!1}var Qr=null,Tm=null,Lc=null;function qM(){if(Lc)return Lc;var r,g=Tm,A=g.length,I,f="value"in Qr?Qr.value:Qr.textContent,p=f.length;for(r=0;r=Dl),oR=" ",rR=!1;function sR(r,g){switch(r){case"keyup":return $ce.indexOf(g.keyCode)!==-1;case"keydown":return g.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gR(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Na=!1;function Kce(r,g){switch(r){case"compositionend":return gR(g);case"keypress":return g.which!==32?null:(rR=!0,oR);case"textInput":return r=g.data,r===oR&&rR?null:r;default:return null}}function Xce(r,g){if(Na)return r==="compositionend"||!km&&sR(r,g)?(r=qM(),Lc=Tm=Qr=null,Na=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(g.ctrlKey||g.altKey||g.metaKey)||g.ctrlKey&&g.altKey){if(g.char&&1=g)return{node:A,offset:g-r};r=I}e:{for(;A;){if(A.nextSibling){A=A.nextSibling;break e}A=A.parentNode}A=void 0}A=uR(A)}}function fR(r,g){return r&&g?r===g?!0:r&&r.nodeType===3?!1:g&&g.nodeType===3?fR(r,g.parentNode):"contains"in r?r.contains(g):r.compareDocumentPosition?!!(r.compareDocumentPosition(g)&16):!1:!1}function pR(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var g=zc(r.document);g instanceof r.HTMLIFrameElement;){try{var A=typeof g.contentWindow.location.href=="string"}catch{A=!1}if(A)r=g.contentWindow;else break;g=zc(r.document)}return g}function jm(r){var g=r&&r.nodeName&&r.nodeName.toLowerCase();return g&&(g==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||g==="textarea"||r.contentEditable==="true")}var ode=nr&&"documentMode"in document&&11>=document.documentMode,Ma=null,zm=null,Pl=null,Pm=!1;function mR(r,g,A){var I=A.window===A?A.document:A.nodeType===9?A:A.ownerDocument;Pm||Ma==null||Ma!==zc(I)||(I=Ma,"selectionStart"in I&&jm(I)?I={start:I.selectionStart,end:I.selectionEnd}:(I=(I.ownerDocument&&I.ownerDocument.defaultView||window).getSelection(),I={anchorNode:I.anchorNode,anchorOffset:I.anchorOffset,focusNode:I.focusNode,focusOffset:I.focusOffset}),Pl&&zl(Pl,I)||(Pl=I,I=Rd(zm,"onSelect"),0>=w,f-=w,Oo=1<<32-zn(g)+f|A<qe?(At=ze,ze=null):At=ze.sibling;var ut=K(V,ze,Y[qe],oe);if(ut===null){ze===null&&(ze=At);break}r&&ze&&ut.alternate===null&&g(V,ze),B=p(ut,B,qe),dt===null?Ge=ut:dt.sibling=ut,dt=ut,ze=At}if(qe===Y.length)return A(V,ze),lt&&or(V,qe),Ge;if(ze===null){for(;qeqe?(At=ze,ze=null):At=ze.sibling;var ms=K(V,ze,ut.value,oe);if(ms===null){ze===null&&(ze=At);break}r&&ze&&ms.alternate===null&&g(V,ze),B=p(ms,B,qe),dt===null?Ge=ms:dt.sibling=ms,dt=ms,ze=At}if(ut.done)return A(V,ze),lt&&or(V,qe),Ge;if(ze===null){for(;!ut.done;qe++,ut=Y.next())ut=Ae(V,ut.value,oe),ut!==null&&(B=p(ut,B,qe),dt===null?Ge=ut:dt.sibling=ut,dt=ut);return lt&&or(V,qe),Ge}for(ze=I(ze);!ut.done;qe++,ut=Y.next())ut=q(ze,V,qe,ut.value,oe),ut!==null&&(r&&ut.alternate!==null&&ze.delete(ut.key===null?qe:ut.key),B=p(ut,B,qe),dt===null?Ge=ut:dt.sibling=ut,dt=ut);return r&&ze.forEach(function(xue){return g(V,xue)}),lt&&or(V,qe),Ge}function Rt(V,B,Y,oe){if(typeof Y=="object"&&Y!==null&&Y.type===x&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:e:{for(var Ge=Y.key;B!==null;){if(B.key===Ge){if(Ge=Y.type,Ge===x){if(B.tag===7){A(V,B.sibling),oe=f(B,Y.props.children),oe.return=V,V=oe;break e}}else if(B.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===F&&gg(Ge)===B.type){A(V,B.sibling),oe=f(B,Y.props),Vl(oe,Y),oe.return=V,V=oe;break e}A(V,B);break}else g(V,B);B=B.sibling}Y.type===x?(oe=ng(Y.props.children,V.mode,oe,Y.key),oe.return=V,V=oe):(oe=Wc(Y.type,Y.key,Y.props,null,V.mode,oe),Vl(oe,Y),oe.return=V,V=oe)}return w(V);case b:e:{for(Ge=Y.key;B!==null;){if(B.key===Ge)if(B.tag===4&&B.stateNode.containerInfo===Y.containerInfo&&B.stateNode.implementation===Y.implementation){A(V,B.sibling),oe=f(B,Y.children||[]),oe.return=V,V=oe;break e}else{A(V,B);break}else g(V,B);B=B.sibling}oe=Um(Y,V.mode,oe),oe.return=V,V=oe}return w(V);case F:return Y=gg(Y),Rt(V,B,Y,oe)}if(ue(Y))return De(V,B,Y,oe);if(J(Y)){if(Ge=J(Y),typeof Ge!="function")throw Error(i(150));return Y=Ge.call(Y),$e(V,B,Y,oe)}if(typeof Y.then=="function")return Rt(V,B,td(Y),oe);if(Y.$$typeof===O)return Rt(V,B,Qc(V,Y),oe);nd(V,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,B!==null&&B.tag===6?(A(V,B.sibling),oe=f(B,Y),oe.return=V,V=oe):(A(V,B),oe=Vm(Y,V.mode,oe),oe.return=V,V=oe),w(V)):A(V,B)}return function(V,B,Y,oe){try{Fl=0;var Ge=Rt(V,B,Y,oe);return Ga=null,Ge}catch(ze){if(ze===Za||ze===Jc)throw ze;var dt=bi(29,ze,null,V.mode);return dt.lanes=oe,dt.return=V,dt}}}var Ag=FR(!0),VR=FR(!1),ns=!1;function nv(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function iv(r,g){r=r.updateQueue,g.updateQueue===r&&(g.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function is(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function os(r,g,A){var I=r.updateQueue;if(I===null)return null;if(I=I.shared,(mt&2)!==0){var f=I.pending;return f===null?g.next=g:(g.next=f.next,f.next=g),I.pending=g,g=$c(r),ER(r,null,A),g}return Yc(r,I,g,A),$c(r)}function Ul(r,g,A){if(g=g.updateQueue,g!==null&&(g=g.shared,(A&4194048)!==0)){var I=g.lanes;I&=r.pendingLanes,A|=I,g.lanes=A,Be(r,A)}}function ov(r,g){var A=r.updateQueue,I=r.alternate;if(I!==null&&(I=I.updateQueue,A===I)){var f=null,p=null;if(A=A.firstBaseUpdate,A!==null){do{var w={lane:A.lane,tag:A.tag,payload:A.payload,callback:null,next:null};p===null?f=p=w:p=p.next=w,A=A.next}while(A!==null);p===null?f=p=g:p=p.next=g}else f=p=g;A={baseState:I.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:I.shared,callbacks:I.callbacks},r.updateQueue=A;return}r=A.lastBaseUpdate,r===null?A.firstBaseUpdate=g:r.next=g,A.lastBaseUpdate=g}var rv=!1;function Hl(){if(rv){var r=Ba;if(r!==null)throw r}}function Yl(r,g,A,I){rv=!1;var f=r.updateQueue;ns=!1;var p=f.firstBaseUpdate,w=f.lastBaseUpdate,N=f.shared.pending;if(N!==null){f.shared.pending=null;var P=N,$=P.next;P.next=null,w===null?p=$:w.next=$,w=P;var te=r.alternate;te!==null&&(te=te.updateQueue,N=te.lastBaseUpdate,N!==w&&(N===null?te.firstBaseUpdate=$:N.next=$,te.lastBaseUpdate=P))}if(p!==null){var Ae=f.baseState;w=0,te=$=P=null,N=p;do{var K=N.lane&-536870913,q=K!==N.lane;if(q?(at&K)===K:(I&K)===K){K!==0&&K===La&&(rv=!0),te!==null&&(te=te.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var De=r,$e=N;K=g;var Rt=A;switch($e.tag){case 1:if(De=$e.payload,typeof De=="function"){Ae=De.call(Rt,Ae,K);break e}Ae=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=$e.payload,K=typeof De=="function"?De.call(Rt,Ae,K):De,K==null)break e;Ae=h({},Ae,K);break e;case 2:ns=!0}}K=N.callback,K!==null&&(r.flags|=64,q&&(r.flags|=8192),q=f.callbacks,q===null?f.callbacks=[K]:q.push(K))}else q={lane:K,tag:N.tag,payload:N.payload,callback:N.callback,next:null},te===null?($=te=q,P=Ae):te=te.next=q,w|=K;if(N=N.next,N===null){if(N=f.shared.pending,N===null)break;q=N,N=q.next,q.next=null,f.lastBaseUpdate=q,f.shared.pending=null}}while(!0);te===null&&(P=Ae),f.baseState=P,f.firstBaseUpdate=$,f.lastBaseUpdate=te,p===null&&(f.shared.lanes=0),As|=w,r.lanes=w,r.memoizedState=Ae}}function UR(r,g){if(typeof r!="function")throw Error(i(191,r));r.call(g)}function HR(r,g){var A=r.callbacks;if(A!==null)for(r.callbacks=null,r=0;rp?p:8;var w=z.T,N={};z.T=N,xv(r,!1,g,A);try{var P=f(),$=z.S;if($!==null&&$(N,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var te=cde(P,I);Kl(r,g,te,Ti(r))}else Kl(r,g,I,Ti(r))}catch(Ae){Kl(r,g,{then:function(){},status:"rejected",reason:Ae},Ti())}finally{U.p=p,w!==null&&N.types!==null&&(w.types=N.types),z.T=w}}function mde(){}function bv(r,g,A,I){if(r.tag!==5)throw Error(i(476));var f=wk(r).queue;bk(r,f,g,Q,A===null?mde:function(){return xk(r),A(I)})}function wk(r){var g=r.memoizedState;if(g!==null)return g;g={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ar,lastRenderedState:Q},next:null};var A={};return g.next={memoizedState:A,baseState:A,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ar,lastRenderedState:A},next:null},r.memoizedState=g,r=r.alternate,r!==null&&(r.memoizedState=g),g}function xk(r){var g=wk(r);g.next===null&&(g=r.alternate.memoizedState),Kl(r,g.next.queue,{},Ti())}function wv(){return Bn(IC)}function Sk(){return An().memoizedState}function Ek(){return An().memoizedState}function vde(r){for(var g=r.return;g!==null;){switch(g.tag){case 24:case 3:var A=Ti();r=is(A);var I=os(g,r,A);I!==null&&(hi(I,g,A),Ul(I,g,A)),g={cache:qm()},r.payload=g;return}g=g.return}}function yde(r,g,A){var I=Ti();A={lane:I,revertLane:0,gesture:null,action:A,hasEagerState:!1,eagerState:null,next:null},Id(r)?Ok(g,A):(A=Gm(r,g,A,I),A!==null&&(hi(A,r,I),Nk(A,g,I)))}function Tk(r,g,A){var I=Ti();Kl(r,g,A,I)}function Kl(r,g,A,I){var f={lane:I,revertLane:0,gesture:null,action:A,hasEagerState:!1,eagerState:null,next:null};if(Id(r))Ok(g,f);else{var p=r.alternate;if(r.lanes===0&&(p===null||p.lanes===0)&&(p=g.lastRenderedReducer,p!==null))try{var w=g.lastRenderedState,N=p(w,A);if(f.hasEagerState=!0,f.eagerState=N,yi(N,w))return Yc(r,g,f,0),kt===null&&Hc(),!1}catch{}if(A=Gm(r,g,f,I),A!==null)return hi(A,r,I),Nk(A,g,I),!0}return!1}function xv(r,g,A,I){if(I={lane:2,revertLane:ny(),gesture:null,action:I,hasEagerState:!1,eagerState:null,next:null},Id(r)){if(g)throw Error(i(479))}else g=Gm(r,A,I,2),g!==null&&hi(g,r,2)}function Id(r){var g=r.alternate;return r===Qe||g!==null&&g===Qe}function Ok(r,g){Va=rd=!0;var A=r.pending;A===null?g.next=g:(g.next=A.next,A.next=g),r.pending=g}function Nk(r,g,A){if((A&4194048)!==0){var I=g.lanes;I&=r.pendingLanes,A|=I,g.lanes=A,Be(r,A)}}var Xl={readContext:Bn,use:ad,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useLayoutEffect:Qt,useInsertionEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useSyncExternalStore:Qt,useId:Qt,useHostTransitionStatus:Qt,useFormState:Qt,useActionState:Qt,useOptimistic:Qt,useMemoCache:Qt,useCacheRefresh:Qt};Xl.useEffectEvent=Qt;var Mk={readContext:Bn,use:ad,useCallback:function(r,g){return ei().memoizedState=[r,g===void 0?null:g],r},useContext:Bn,useEffect:ck,useImperativeHandle:function(r,g,A){A=A!=null?A.concat([r]):null,ld(4194308,4,fk.bind(null,g,r),A)},useLayoutEffect:function(r,g){return ld(4194308,4,r,g)},useInsertionEffect:function(r,g){ld(4,2,r,g)},useMemo:function(r,g){var A=ei();g=g===void 0?null:g;var I=r();if(lg){Xt(!0);try{r()}finally{Xt(!1)}}return A.memoizedState=[I,g],I},useReducer:function(r,g,A){var I=ei();if(A!==void 0){var f=A(g);if(lg){Xt(!0);try{A(g)}finally{Xt(!1)}}}else f=g;return I.memoizedState=I.baseState=f,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:f},I.queue=r,r=r.dispatch=yde.bind(null,Qe,r),[I.memoizedState,r]},useRef:function(r){var g=ei();return r={current:r},g.memoizedState=r},useState:function(r){r=fv(r);var g=r.queue,A=Tk.bind(null,Qe,g);return g.dispatch=A,[r.memoizedState,A]},useDebugValue:vv,useDeferredValue:function(r,g){var A=ei();return yv(A,r,g)},useTransition:function(){var r=fv(!1);return r=bk.bind(null,Qe,r.queue,!0,!1),ei().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,g,A){var I=Qe,f=ei();if(lt){if(A===void 0)throw Error(i(407));A=A()}else{if(A=g(),kt===null)throw Error(i(349));(at&127)!==0||QR(I,g,A)}f.memoizedState=A;var p={value:A,getSnapshot:g};return f.queue=p,ck(JR.bind(null,I,p,r),[r]),I.flags|=2048,Ha(9,{destroy:void 0},qR.bind(null,I,p,A,g),null),A},useId:function(){var r=ei(),g=kt.identifierPrefix;if(lt){var A=No,I=Oo;A=(I&~(1<<32-zn(I)-1)).toString(32)+A,g="_"+g+"R_"+A,A=sd++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof I.is=="string"?w.createElement("select",{is:I.is}):w.createElement("select"),I.multiple?p.multiple=!0:I.size&&(p.size=I.size);break;default:p=typeof I.is=="string"?w.createElement(f,{is:I.is}):w.createElement(f)}}p[Pn]=g,p[li]=I;e:for(w=g.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===g)break e;for(;w.sibling===null;){if(w.return===null||w.return===g)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}g.stateNode=p;e:switch(Gn(p,f,I),f){case"button":case"input":case"select":case"textarea":I=!!I.autoFocus;break e;case"img":I=!0;break e;default:I=!1}I&&lr(g)}}return Lt(g),Lv(g,g.type,r===null?null:r.memoizedProps,g.pendingProps,A),null;case 6:if(r&&g.stateNode!=null)r.memoizedProps!==I&&lr(g);else{if(typeof I!="string"&&g.stateNode===null)throw Error(i(166));if(r=be.current,za(g)){if(r=g.stateNode,A=g.memoizedProps,I=null,f=Ln,f!==null)switch(f.tag){case 27:case 5:I=f.memoizedProps}r[Pn]=g,r=!!(r.nodeValue===A||I!==null&&I.suppressHydrationWarning===!0||KD(r.nodeValue,A)),r||es(g,!0)}else r=kd(r).createTextNode(I),r[Pn]=g,g.stateNode=r}return Lt(g),null;case 31:if(A=g.memoizedState,r===null||r.memoizedState!==null){if(I=za(g),A!==null){if(r===null){if(!I)throw Error(i(318));if(r=g.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Pn]=g}else ig(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;Lt(g),r=!1}else A=Wm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=A),r=!0;if(!r)return g.flags&256?(xi(g),g):(xi(g),null);if((g.flags&128)!==0)throw Error(i(558))}return Lt(g),null;case 13:if(I=g.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(f=za(g),I!==null&&I.dehydrated!==null){if(r===null){if(!f)throw Error(i(318));if(f=g.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[Pn]=g}else ig(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;Lt(g),f=!1}else f=Wm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=f),f=!0;if(!f)return g.flags&256?(xi(g),g):(xi(g),null)}return xi(g),(g.flags&128)!==0?(g.lanes=A,g):(A=I!==null,r=r!==null&&r.memoizedState!==null,A&&(I=g.child,f=null,I.alternate!==null&&I.alternate.memoizedState!==null&&I.alternate.memoizedState.cachePool!==null&&(f=I.alternate.memoizedState.cachePool.pool),p=null,I.memoizedState!==null&&I.memoizedState.cachePool!==null&&(p=I.memoizedState.cachePool.pool),p!==f&&(I.flags|=2048)),A!==r&&A&&(g.child.flags|=8192),fd(g,g.updateQueue),Lt(g),null);case 4:return ae(),r===null&&sy(g.stateNode.containerInfo),Lt(g),null;case 10:return sr(g.type),Lt(g),null;case 19:if(D(an),I=g.memoizedState,I===null)return Lt(g),null;if(f=(g.flags&128)!==0,p=I.rendering,p===null)if(f)ql(I,!1);else{if(qt!==0||r!==null&&(r.flags&128)!==0)for(r=g.child;r!==null;){if(p=od(r),p!==null){for(g.flags|=128,ql(I,!1),r=p.updateQueue,g.updateQueue=r,fd(g,r),g.subtreeFlags=0,r=A,A=g.child;A!==null;)TR(A,r),A=A.sibling;return H(an,an.current&1|2),lt&&or(g,I.treeForkCount),g.child}r=r.sibling}I.tail!==null&&Ot()>bd&&(g.flags|=128,f=!0,ql(I,!1),g.lanes=4194304)}else{if(!f)if(r=od(p),r!==null){if(g.flags|=128,f=!0,r=r.updateQueue,g.updateQueue=r,fd(g,r),ql(I,!0),I.tail===null&&I.tailMode==="hidden"&&!p.alternate&&!lt)return Lt(g),null}else 2*Ot()-I.renderingStartTime>bd&&A!==536870912&&(g.flags|=128,f=!0,ql(I,!1),g.lanes=4194304);I.isBackwards?(p.sibling=g.child,g.child=p):(r=I.last,r!==null?r.sibling=p:g.child=p,I.last=p)}return I.tail!==null?(r=I.tail,I.rendering=r,I.tail=r.sibling,I.renderingStartTime=Ot(),r.sibling=null,A=an.current,H(an,f?A&1|2:A&1),lt&&or(g,I.treeForkCount),r):(Lt(g),null);case 22:case 23:return xi(g),gv(),I=g.memoizedState!==null,r!==null?r.memoizedState!==null!==I&&(g.flags|=8192):I&&(g.flags|=8192),I?(A&536870912)!==0&&(g.flags&128)===0&&(Lt(g),g.subtreeFlags&6&&(g.flags|=8192)):Lt(g),A=g.updateQueue,A!==null&&fd(g,A.retryQueue),A=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(A=r.memoizedState.cachePool.pool),I=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(I=g.memoizedState.cachePool.pool),I!==A&&(g.flags|=2048),r!==null&&D(sg),null;case 24:return A=null,r!==null&&(A=r.memoizedState.cache),g.memoizedState.cache!==A&&(g.flags|=2048),sr(hn),Lt(g),null;case 25:return null;case 30:return null}throw Error(i(156,g.tag))}function Ede(r,g){switch(Ym(g),g.tag){case 1:return r=g.flags,r&65536?(g.flags=r&-65537|128,g):null;case 3:return sr(hn),ae(),r=g.flags,(r&65536)!==0&&(r&128)===0?(g.flags=r&-65537|128,g):null;case 26:case 27:case 5:return Me(g),null;case 31:if(g.memoizedState!==null){if(xi(g),g.alternate===null)throw Error(i(340));ig()}return r=g.flags,r&65536?(g.flags=r&-65537|128,g):null;case 13:if(xi(g),r=g.memoizedState,r!==null&&r.dehydrated!==null){if(g.alternate===null)throw Error(i(340));ig()}return r=g.flags,r&65536?(g.flags=r&-65537|128,g):null;case 19:return D(an),null;case 4:return ae(),null;case 10:return sr(g.type),null;case 22:case 23:return xi(g),gv(),r!==null&&D(sg),r=g.flags,r&65536?(g.flags=r&-65537|128,g):null;case 24:return sr(hn),null;case 25:return null;default:return null}}function eD(r,g){switch(Ym(g),g.tag){case 3:sr(hn),ae();break;case 26:case 27:case 5:Me(g);break;case 4:ae();break;case 31:g.memoizedState!==null&&xi(g);break;case 13:xi(g);break;case 19:D(an);break;case 10:sr(g.type);break;case 22:case 23:xi(g),gv(),r!==null&&D(sg);break;case 24:sr(hn)}}function Jl(r,g){try{var A=g.updateQueue,I=A!==null?A.lastEffect:null;if(I!==null){var f=I.next;A=f;do{if((A.tag&r)===r){I=void 0;var p=A.create,w=A.inst;I=p(),w.destroy=I}A=A.next}while(A!==f)}}catch(N){xt(g,g.return,N)}}function gs(r,g,A){try{var I=g.updateQueue,f=I!==null?I.lastEffect:null;if(f!==null){var p=f.next;I=p;do{if((I.tag&r)===r){var w=I.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,f=g;var P=A,$=N;try{$()}catch(te){xt(f,P,te)}}}I=I.next}while(I!==p)}}catch(te){xt(g,g.return,te)}}function tD(r){var g=r.updateQueue;if(g!==null){var A=r.stateNode;try{HR(g,A)}catch(I){xt(r,r.return,I)}}}function nD(r,g,A){A.props=Cg(r.type,r.memoizedProps),A.state=r.memoizedState;try{A.componentWillUnmount()}catch(I){xt(r,g,I)}}function eC(r,g){try{var A=r.ref;if(A!==null){switch(r.tag){case 26:case 27:case 5:var I=r.stateNode;break;case 30:I=r.stateNode;break;default:I=r.stateNode}typeof A=="function"?r.refCleanup=A(I):A.current=I}}catch(f){xt(r,g,f)}}function Mo(r,g){var A=r.ref,I=r.refCleanup;if(A!==null)if(typeof I=="function")try{I()}catch(f){xt(r,g,f)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof A=="function")try{A(null)}catch(f){xt(r,g,f)}else A.current=null}function iD(r){var g=r.type,A=r.memoizedProps,I=r.stateNode;try{e:switch(g){case"button":case"input":case"select":case"textarea":A.autoFocus&&I.focus();break e;case"img":A.src?I.src=A.src:A.srcSet&&(I.srcset=A.srcSet)}}catch(f){xt(r,r.return,f)}}function Bv(r,g,A){try{var I=r.stateNode;Wde(I,r.type,A,g),I[li]=g}catch(f){xt(r,r.return,f)}}function oD(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ds(r.type)||r.tag===4}function Zv(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||oD(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ds(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Gv(r,g,A){var I=r.tag;if(I===5||I===6)r=r.stateNode,g?(A.nodeType===9?A.body:A.nodeName==="HTML"?A.ownerDocument.body:A).insertBefore(r,g):(g=A.nodeType===9?A.body:A.nodeName==="HTML"?A.ownerDocument.body:A,g.appendChild(r),A=A._reactRootContainer,A!=null||g.onclick!==null||(g.onclick=tr));else if(I!==4&&(I===27&&ds(r.type)&&(A=r.stateNode,g=null),r=r.child,r!==null))for(Gv(r,g,A),r=r.sibling;r!==null;)Gv(r,g,A),r=r.sibling}function pd(r,g,A){var I=r.tag;if(I===5||I===6)r=r.stateNode,g?A.insertBefore(r,g):A.appendChild(r);else if(I!==4&&(I===27&&ds(r.type)&&(A=r.stateNode),r=r.child,r!==null))for(pd(r,g,A),r=r.sibling;r!==null;)pd(r,g,A),r=r.sibling}function rD(r){var g=r.stateNode,A=r.memoizedProps;try{for(var I=r.type,f=g.attributes;f.length;)g.removeAttributeNode(f[0]);Gn(g,I,A),g[Pn]=r,g[li]=A}catch(p){xt(r,r.return,p)}}var Cr=!1,mn=!1,Fv=!1,sD=typeof WeakSet=="function"?WeakSet:Set,Mn=null;function Tde(r,g){if(r=r.containerInfo,Ay=Bd,r=pR(r),jm(r)){if("selectionStart"in r)var A={start:r.selectionStart,end:r.selectionEnd};else e:{A=(A=r.ownerDocument)&&A.defaultView||window;var I=A.getSelection&&A.getSelection();if(I&&I.rangeCount!==0){A=I.anchorNode;var f=I.anchorOffset,p=I.focusNode;I=I.focusOffset;try{A.nodeType,p.nodeType}catch{A=null;break e}var w=0,N=-1,P=-1,$=0,te=0,Ae=r,K=null;t:for(;;){for(var q;Ae!==A||f!==0&&Ae.nodeType!==3||(N=w+f),Ae!==p||I!==0&&Ae.nodeType!==3||(P=w+I),Ae.nodeType===3&&(w+=Ae.nodeValue.length),(q=Ae.firstChild)!==null;)K=Ae,Ae=q;for(;;){if(Ae===r)break t;if(K===A&&++$===f&&(N=w),K===p&&++te===I&&(P=w),(q=Ae.nextSibling)!==null)break;Ae=K,K=Ae.parentNode}Ae=q}A=N===-1||P===-1?null:{start:N,end:P}}else A=null}A=A||{start:0,end:0}}else A=null;for(ly={focusedElem:r,selectionRange:A},Bd=!1,Mn=g;Mn!==null;)if(g=Mn,r=g.child,(g.subtreeFlags&1028)!==0&&r!==null)r.return=g,Mn=r;else for(;Mn!==null;){switch(g=Mn,p=g.alternate,r=g.flags,g.tag){case 0:if((r&4)!==0&&(r=g.updateQueue,r=r!==null?r.events:null,r!==null))for(A=0;A title"))),Gn(p,I,A),p[Pn]=r,Nn(p),I=p;break e;case"link":var w=I_("link","href",f).get(I+(A.href||""));if(w){for(var N=0;NRt&&(w=Rt,Rt=$e,$e=w);var V=hR(N,$e),B=hR(N,Rt);if(V&&B&&(q.rangeCount!==1||q.anchorNode!==V.node||q.anchorOffset!==V.offset||q.focusNode!==B.node||q.focusOffset!==B.offset)){var Y=Ae.createRange();Y.setStart(V.node,V.offset),q.removeAllRanges(),$e>Rt?(q.addRange(Y),q.extend(B.node,B.offset)):(Y.setEnd(B.node,B.offset),q.addRange(Y))}}}}for(Ae=[],q=N;q=q.parentNode;)q.nodeType===1&&Ae.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;NA?32:A,z.T=null,A=Kv,Kv=null;var p=Cs,w=hr;if(wn=0,Xa=Cs=null,hr=0,(mt&6)!==0)throw Error(i(331));var N=mt;if(mt|=4,fD(p.current),dD(p,p.current,w,A),mt=N,sC(0,!1),Ke&&typeof Ke.onPostCommitFiberRoot=="function")try{Ke.onPostCommitFiberRoot(pt,p)}catch{}return!0}finally{U.p=f,z.T=I,jD(r,g)}}function PD(r,g,A){g=Bi(A,g),g=Ov(r.stateNode,g,2),r=os(r,g,2),r!==null&&(ro(r,2),Ro(r))}function xt(r,g,A){if(r.tag===3)PD(r,r,A);else for(;g!==null;){if(g.tag===3){PD(g,r,A);break}else if(g.tag===1){var I=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof I.componentDidCatch=="function"&&(ls===null||!ls.has(I))){r=Bi(A,r),A=Lk(2),I=os(g,A,2),I!==null&&(Bk(A,I,g,r),ro(I,2),Ro(I));break}}g=g.return}}function Jv(r,g,A){var I=r.pingCache;if(I===null){I=r.pingCache=new Mde;var f=new Set;I.set(g,f)}else f=I.get(g),f===void 0&&(f=new Set,I.set(g,f));f.has(A)||(Hv=!0,f.add(A),r=jde.bind(null,r,g,A),g.then(r,r))}function jde(r,g,A){var I=r.pingCache;I!==null&&I.delete(g),r.pingedLanes|=r.suspendedLanes&A,r.warmLanes&=~A,kt===r&&(at&A)===A&&(qt===4||qt===3&&(at&62914560)===at&&300>Ot()-yd?(mt&2)===0&&Qa(r,0):Yv|=A,Ka===at&&(Ka=0)),Ro(r)}function LD(r,g){g===0&&(g=xl()),r=tg(r,g),r!==null&&(ro(r,g),Ro(r))}function zde(r){var g=r.memoizedState,A=0;g!==null&&(A=g.retryLane),LD(r,A)}function Pde(r,g){var A=0;switch(r.tag){case 31:case 13:var I=r.stateNode,f=r.memoizedState;f!==null&&(A=f.retryLane);break;case 19:I=r.stateNode;break;case 22:I=r.stateNode._retryCache;break;default:throw Error(i(314))}I!==null&&I.delete(g),LD(r,A)}function Lde(r,g){return Tt(r,g)}var Od=null,Ja=null,ey=!1,Nd=!1,ty=!1,cs=0;function Ro(r){r!==Ja&&r.next===null&&(Ja===null?Od=Ja=r:Ja=Ja.next=r),Nd=!0,ey||(ey=!0,Zde())}function sC(r,g){if(!ty&&Nd){ty=!0;do for(var A=!1,I=Od;I!==null;){if(r!==0){var f=I.pendingLanes;if(f===0)var p=0;else{var w=I.suspendedLanes,N=I.pingedLanes;p=(1<<31-zn(42|r)+1)-1,p&=f&~(w&~N),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(A=!0,FD(I,p))}else p=at,p=$r(I,I===kt?p:0,I.cancelPendingCommit!==null||I.timeoutHandle!==-1),(p&3)===0||Wr(I,p)||(A=!0,FD(I,p));I=I.next}while(A);ty=!1}}function Bde(){BD()}function BD(){Nd=ey=!1;var r=0;cs!==0&&Xde()&&(r=cs);for(var g=Ot(),A=null,I=Od;I!==null;){var f=I.next,p=ZD(I,g);p===0?(I.next=null,A===null?Od=f:A.next=f,f===null&&(Ja=A)):(A=I,(r!==0||(p&3)!==0)&&(Nd=!0)),I=f}wn!==0&&wn!==5||sC(r),cs!==0&&(cs=0)}function ZD(r,g){for(var A=r.suspendedLanes,I=r.pingedLanes,f=r.expirationTimes,p=r.pendingLanes&-62914561;0>>=0,r===0?32:31-(oo(r)/dm|0)|0}var fa=256,pa=262144,Yr=4194304;function To(r){var g=r&42;if(g!==0)return g;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function $r(r,g,A){var I=r.pendingLanes;if(I===0)return 0;var f=0,p=r.suspendedLanes,w=r.pingedLanes;r=r.warmLanes;var N=I&134217727;return N!==0?(I=N&~p,I!==0?f=To(I):(w&=N,w!==0?f=To(w):A||(A=N&~r,A!==0&&(f=To(A))))):(N=I&~p,N!==0?f=To(N):w!==0?f=To(w):A||(A=I&~r,A!==0&&(f=To(A)))),f===0?0:g!==0&&g!==f&&(g&p)===0&&(p=f&-f,A=g&-g,p>=A||p===32&&(A&4194048)!==0)?g:f}function Wr(r,g){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&g)===0}function hm(r,g){switch(r){case 1:case 2:case 4:case 8:case 64:return g+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return g+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function xl(){var r=Yr;return Yr<<=1,(Yr&62914560)===0&&(Yr=4194304),r}function Sl(r){for(var g=[],A=0;31>A;A++)g.push(r);return g}function ro(r,g){r.pendingLanes|=g,g!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Ie(r,g,A,I,f,p){var w=r.pendingLanes;r.pendingLanes=A,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=A,r.entangledLanes&=A,r.errorRecoveryDisabledLanes&=A,r.shellSuspendCounter=0;var N=r.entanglements,P=r.expirationTimes,$=r.hiddenUpdates;for(A=w&~A;0"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var mce=/[\n"\\]/g;function Pi(r){return r.replace(mce,function(g){return"\\"+g.charCodeAt(0).toString(16)+" "})}function vm(r,g,A,I,f,p,w,N){r.name="",w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?r.type=w:r.removeAttribute("type"),g!=null?w==="number"?(g===0&&r.value===""||r.value!=g)&&(r.value=""+zi(g)):r.value!==""+zi(g)&&(r.value=""+zi(g)):w!=="submit"&&w!=="reset"||r.removeAttribute("value"),g!=null?ym(r,w,zi(g)):A!=null?ym(r,w,zi(A)):I!=null&&r.removeAttribute("value"),f==null&&p!=null&&(r.defaultChecked=!!p),f!=null&&(r.checked=f&&typeof f!="function"&&typeof f!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?r.name=""+zi(N):r.removeAttribute("name")}function HM(r,g,A,I,f,p,w,N){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(r.type=p),g!=null||A!=null){if(!(p!=="submit"&&p!=="reset"||g!=null)){mm(r);return}A=A!=null?""+zi(A):"",g=g!=null?""+zi(g):A,N||g===r.value||(r.value=g),r.defaultValue=g}I=I??f,I=typeof I!="function"&&typeof I!="symbol"&&!!I,r.checked=N?r.checked:!!I,r.defaultChecked=!!I,w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(r.name=w),mm(r)}function ym(r,g,A){g==="number"&&zc(r.ownerDocument)===r||r.defaultValue===""+A||(r.defaultValue=""+A)}function Sa(r,g,A,I){if(r=r.options,g){g={};for(var f=0;f"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Em=!1;if(nr)try{var Ml={};Object.defineProperty(Ml,"passive",{get:function(){Em=!0}}),window.addEventListener("test",Ml,Ml),window.removeEventListener("test",Ml,Ml)}catch{Em=!1}var Qr=null,Tm=null,Lc=null;function qM(){if(Lc)return Lc;var r,g=Tm,A=g.length,I,f="value"in Qr?Qr.value:Qr.textContent,p=f.length;for(r=0;r=Dl),oR=" ",rR=!1;function sR(r,g){switch(r){case"keyup":return $ce.indexOf(g.keyCode)!==-1;case"keydown":return g.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gR(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Na=!1;function Kce(r,g){switch(r){case"compositionend":return gR(g);case"keypress":return g.which!==32?null:(rR=!0,oR);case"textInput":return r=g.data,r===oR&&rR?null:r;default:return null}}function Xce(r,g){if(Na)return r==="compositionend"||!km&&sR(r,g)?(r=qM(),Lc=Tm=Qr=null,Na=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(g.ctrlKey||g.altKey||g.metaKey)||g.ctrlKey&&g.altKey){if(g.char&&1=g)return{node:A,offset:g-r};r=I}e:{for(;A;){if(A.nextSibling){A=A.nextSibling;break e}A=A.parentNode}A=void 0}A=uR(A)}}function fR(r,g){return r&&g?r===g?!0:r&&r.nodeType===3?!1:g&&g.nodeType===3?fR(r,g.parentNode):"contains"in r?r.contains(g):r.compareDocumentPosition?!!(r.compareDocumentPosition(g)&16):!1:!1}function pR(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var g=zc(r.document);g instanceof r.HTMLIFrameElement;){try{var A=typeof g.contentWindow.location.href=="string"}catch{A=!1}if(A)r=g.contentWindow;else break;g=zc(r.document)}return g}function jm(r){var g=r&&r.nodeName&&r.nodeName.toLowerCase();return g&&(g==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||g==="textarea"||r.contentEditable==="true")}var ode=nr&&"documentMode"in document&&11>=document.documentMode,Ma=null,zm=null,Pl=null,Pm=!1;function mR(r,g,A){var I=A.window===A?A.document:A.nodeType===9?A:A.ownerDocument;Pm||Ma==null||Ma!==zc(I)||(I=Ma,"selectionStart"in I&&jm(I)?I={start:I.selectionStart,end:I.selectionEnd}:(I=(I.ownerDocument&&I.ownerDocument.defaultView||window).getSelection(),I={anchorNode:I.anchorNode,anchorOffset:I.anchorOffset,focusNode:I.focusNode,focusOffset:I.focusOffset}),Pl&&zl(Pl,I)||(Pl=I,I=Rd(zm,"onSelect"),0>=w,f-=w,Oo=1<<32-zn(g)+f|A<qe?(At=ze,ze=null):At=ze.sibling;var ut=K(V,ze,Y[qe],oe);if(ut===null){ze===null&&(ze=At);break}r&&ze&&ut.alternate===null&&g(V,ze),B=p(ut,B,qe),dt===null?Ge=ut:dt.sibling=ut,dt=ut,ze=At}if(qe===Y.length)return A(V,ze),lt&&or(V,qe),Ge;if(ze===null){for(;qeqe?(At=ze,ze=null):At=ze.sibling;var ms=K(V,ze,ut.value,oe);if(ms===null){ze===null&&(ze=At);break}r&&ze&&ms.alternate===null&&g(V,ze),B=p(ms,B,qe),dt===null?Ge=ms:dt.sibling=ms,dt=ms,ze=At}if(ut.done)return A(V,ze),lt&&or(V,qe),Ge;if(ze===null){for(;!ut.done;qe++,ut=Y.next())ut=Ae(V,ut.value,oe),ut!==null&&(B=p(ut,B,qe),dt===null?Ge=ut:dt.sibling=ut,dt=ut);return lt&&or(V,qe),Ge}for(ze=I(ze);!ut.done;qe++,ut=Y.next())ut=q(ze,V,qe,ut.value,oe),ut!==null&&(r&&ut.alternate!==null&&ze.delete(ut.key===null?qe:ut.key),B=p(ut,B,qe),dt===null?Ge=ut:dt.sibling=ut,dt=ut);return r&&ze.forEach(function(xue){return g(V,xue)}),lt&&or(V,qe),Ge}function Rt(V,B,Y,oe){if(typeof Y=="object"&&Y!==null&&Y.type===x&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:e:{for(var Ge=Y.key;B!==null;){if(B.key===Ge){if(Ge=Y.type,Ge===x){if(B.tag===7){A(V,B.sibling),oe=f(B,Y.props.children),oe.return=V,V=oe;break e}}else if(B.elementType===Ge||typeof Ge=="object"&&Ge!==null&&Ge.$$typeof===F&&gg(Ge)===B.type){A(V,B.sibling),oe=f(B,Y.props),Vl(oe,Y),oe.return=V,V=oe;break e}A(V,B);break}else g(V,B);B=B.sibling}Y.type===x?(oe=ng(Y.props.children,V.mode,oe,Y.key),oe.return=V,V=oe):(oe=Wc(Y.type,Y.key,Y.props,null,V.mode,oe),Vl(oe,Y),oe.return=V,V=oe)}return w(V);case b:e:{for(Ge=Y.key;B!==null;){if(B.key===Ge)if(B.tag===4&&B.stateNode.containerInfo===Y.containerInfo&&B.stateNode.implementation===Y.implementation){A(V,B.sibling),oe=f(B,Y.children||[]),oe.return=V,V=oe;break e}else{A(V,B);break}else g(V,B);B=B.sibling}oe=Um(Y,V.mode,oe),oe.return=V,V=oe}return w(V);case F:return Y=gg(Y),Rt(V,B,Y,oe)}if(ue(Y))return De(V,B,Y,oe);if(J(Y)){if(Ge=J(Y),typeof Ge!="function")throw Error(i(150));return Y=Ge.call(Y),$e(V,B,Y,oe)}if(typeof Y.then=="function")return Rt(V,B,td(Y),oe);if(Y.$$typeof===O)return Rt(V,B,Qc(V,Y),oe);nd(V,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,B!==null&&B.tag===6?(A(V,B.sibling),oe=f(B,Y),oe.return=V,V=oe):(A(V,B),oe=Vm(Y,V.mode,oe),oe.return=V,V=oe),w(V)):A(V,B)}return function(V,B,Y,oe){try{Fl=0;var Ge=Rt(V,B,Y,oe);return Ga=null,Ge}catch(ze){if(ze===Za||ze===Jc)throw ze;var dt=bi(29,ze,null,V.mode);return dt.lanes=oe,dt.return=V,dt}}}var Ag=FR(!0),VR=FR(!1),ns=!1;function nv(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function iv(r,g){r=r.updateQueue,g.updateQueue===r&&(g.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function is(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function os(r,g,A){var I=r.updateQueue;if(I===null)return null;if(I=I.shared,(mt&2)!==0){var f=I.pending;return f===null?g.next=g:(g.next=f.next,f.next=g),I.pending=g,g=$c(r),ER(r,null,A),g}return Yc(r,I,g,A),$c(r)}function Ul(r,g,A){if(g=g.updateQueue,g!==null&&(g=g.shared,(A&4194048)!==0)){var I=g.lanes;I&=r.pendingLanes,A|=I,g.lanes=A,Be(r,A)}}function ov(r,g){var A=r.updateQueue,I=r.alternate;if(I!==null&&(I=I.updateQueue,A===I)){var f=null,p=null;if(A=A.firstBaseUpdate,A!==null){do{var w={lane:A.lane,tag:A.tag,payload:A.payload,callback:null,next:null};p===null?f=p=w:p=p.next=w,A=A.next}while(A!==null);p===null?f=p=g:p=p.next=g}else f=p=g;A={baseState:I.baseState,firstBaseUpdate:f,lastBaseUpdate:p,shared:I.shared,callbacks:I.callbacks},r.updateQueue=A;return}r=A.lastBaseUpdate,r===null?A.firstBaseUpdate=g:r.next=g,A.lastBaseUpdate=g}var rv=!1;function Hl(){if(rv){var r=Ba;if(r!==null)throw r}}function Yl(r,g,A,I){rv=!1;var f=r.updateQueue;ns=!1;var p=f.firstBaseUpdate,w=f.lastBaseUpdate,N=f.shared.pending;if(N!==null){f.shared.pending=null;var P=N,$=P.next;P.next=null,w===null?p=$:w.next=$,w=P;var te=r.alternate;te!==null&&(te=te.updateQueue,N=te.lastBaseUpdate,N!==w&&(N===null?te.firstBaseUpdate=$:N.next=$,te.lastBaseUpdate=P))}if(p!==null){var Ae=f.baseState;w=0,te=$=P=null,N=p;do{var K=N.lane&-536870913,q=K!==N.lane;if(q?(at&K)===K:(I&K)===K){K!==0&&K===La&&(rv=!0),te!==null&&(te=te.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var De=r,$e=N;K=g;var Rt=A;switch($e.tag){case 1:if(De=$e.payload,typeof De=="function"){Ae=De.call(Rt,Ae,K);break e}Ae=De;break e;case 3:De.flags=De.flags&-65537|128;case 0:if(De=$e.payload,K=typeof De=="function"?De.call(Rt,Ae,K):De,K==null)break e;Ae=h({},Ae,K);break e;case 2:ns=!0}}K=N.callback,K!==null&&(r.flags|=64,q&&(r.flags|=8192),q=f.callbacks,q===null?f.callbacks=[K]:q.push(K))}else q={lane:K,tag:N.tag,payload:N.payload,callback:N.callback,next:null},te===null?($=te=q,P=Ae):te=te.next=q,w|=K;if(N=N.next,N===null){if(N=f.shared.pending,N===null)break;q=N,N=q.next,q.next=null,f.lastBaseUpdate=q,f.shared.pending=null}}while(!0);te===null&&(P=Ae),f.baseState=P,f.firstBaseUpdate=$,f.lastBaseUpdate=te,p===null&&(f.shared.lanes=0),As|=w,r.lanes=w,r.memoizedState=Ae}}function UR(r,g){if(typeof r!="function")throw Error(i(191,r));r.call(g)}function HR(r,g){var A=r.callbacks;if(A!==null)for(r.callbacks=null,r=0;rp?p:8;var w=z.T,N={};z.T=N,xv(r,!1,g,A);try{var P=f(),$=z.S;if($!==null&&$(N,P),P!==null&&typeof P=="object"&&typeof P.then=="function"){var te=cde(P,I);Kl(r,g,te,Ti(r))}else Kl(r,g,I,Ti(r))}catch(Ae){Kl(r,g,{then:function(){},status:"rejected",reason:Ae},Ti())}finally{U.p=p,w!==null&&N.types!==null&&(w.types=N.types),z.T=w}}function mde(){}function bv(r,g,A,I){if(r.tag!==5)throw Error(i(476));var f=wk(r).queue;bk(r,f,g,Q,A===null?mde:function(){return xk(r),A(I)})}function wk(r){var g=r.memoizedState;if(g!==null)return g;g={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ar,lastRenderedState:Q},next:null};var A={};return g.next={memoizedState:A,baseState:A,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ar,lastRenderedState:A},next:null},r.memoizedState=g,r=r.alternate,r!==null&&(r.memoizedState=g),g}function xk(r){var g=wk(r);g.next===null&&(g=r.alternate.memoizedState),Kl(r,g.next.queue,{},Ti())}function wv(){return Bn(IC)}function Sk(){return An().memoizedState}function Ek(){return An().memoizedState}function vde(r){for(var g=r.return;g!==null;){switch(g.tag){case 24:case 3:var A=Ti();r=is(A);var I=os(g,r,A);I!==null&&(hi(I,g,A),Ul(I,g,A)),g={cache:qm()},r.payload=g;return}g=g.return}}function yde(r,g,A){var I=Ti();A={lane:I,revertLane:0,gesture:null,action:A,hasEagerState:!1,eagerState:null,next:null},Id(r)?Ok(g,A):(A=Gm(r,g,A,I),A!==null&&(hi(A,r,I),Nk(A,g,I)))}function Tk(r,g,A){var I=Ti();Kl(r,g,A,I)}function Kl(r,g,A,I){var f={lane:I,revertLane:0,gesture:null,action:A,hasEagerState:!1,eagerState:null,next:null};if(Id(r))Ok(g,f);else{var p=r.alternate;if(r.lanes===0&&(p===null||p.lanes===0)&&(p=g.lastRenderedReducer,p!==null))try{var w=g.lastRenderedState,N=p(w,A);if(f.hasEagerState=!0,f.eagerState=N,yi(N,w))return Yc(r,g,f,0),kt===null&&Hc(),!1}catch{}if(A=Gm(r,g,f,I),A!==null)return hi(A,r,I),Nk(A,g,I),!0}return!1}function xv(r,g,A,I){if(I={lane:2,revertLane:ny(),gesture:null,action:I,hasEagerState:!1,eagerState:null,next:null},Id(r)){if(g)throw Error(i(479))}else g=Gm(r,A,I,2),g!==null&&hi(g,r,2)}function Id(r){var g=r.alternate;return r===Qe||g!==null&&g===Qe}function Ok(r,g){Va=rd=!0;var A=r.pending;A===null?g.next=g:(g.next=A.next,A.next=g),r.pending=g}function Nk(r,g,A){if((A&4194048)!==0){var I=g.lanes;I&=r.pendingLanes,A|=I,g.lanes=A,Be(r,A)}}var Xl={readContext:Bn,use:ad,useCallback:Qt,useContext:Qt,useEffect:Qt,useImperativeHandle:Qt,useLayoutEffect:Qt,useInsertionEffect:Qt,useMemo:Qt,useReducer:Qt,useRef:Qt,useState:Qt,useDebugValue:Qt,useDeferredValue:Qt,useTransition:Qt,useSyncExternalStore:Qt,useId:Qt,useHostTransitionStatus:Qt,useFormState:Qt,useActionState:Qt,useOptimistic:Qt,useMemoCache:Qt,useCacheRefresh:Qt};Xl.useEffectEvent=Qt;var Mk={readContext:Bn,use:ad,useCallback:function(r,g){return ei().memoizedState=[r,g===void 0?null:g],r},useContext:Bn,useEffect:ck,useImperativeHandle:function(r,g,A){A=A!=null?A.concat([r]):null,ld(4194308,4,fk.bind(null,g,r),A)},useLayoutEffect:function(r,g){return ld(4194308,4,r,g)},useInsertionEffect:function(r,g){ld(4,2,r,g)},useMemo:function(r,g){var A=ei();g=g===void 0?null:g;var I=r();if(lg){Xt(!0);try{r()}finally{Xt(!1)}}return A.memoizedState=[I,g],I},useReducer:function(r,g,A){var I=ei();if(A!==void 0){var f=A(g);if(lg){Xt(!0);try{A(g)}finally{Xt(!1)}}}else f=g;return I.memoizedState=I.baseState=f,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:f},I.queue=r,r=r.dispatch=yde.bind(null,Qe,r),[I.memoizedState,r]},useRef:function(r){var g=ei();return r={current:r},g.memoizedState=r},useState:function(r){r=fv(r);var g=r.queue,A=Tk.bind(null,Qe,g);return g.dispatch=A,[r.memoizedState,A]},useDebugValue:vv,useDeferredValue:function(r,g){var A=ei();return yv(A,r,g)},useTransition:function(){var r=fv(!1);return r=bk.bind(null,Qe,r.queue,!0,!1),ei().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,g,A){var I=Qe,f=ei();if(lt){if(A===void 0)throw Error(i(407));A=A()}else{if(A=g(),kt===null)throw Error(i(349));(at&127)!==0||QR(I,g,A)}f.memoizedState=A;var p={value:A,getSnapshot:g};return f.queue=p,ck(JR.bind(null,I,p,r),[r]),I.flags|=2048,Ha(9,{destroy:void 0},qR.bind(null,I,p,A,g),null),A},useId:function(){var r=ei(),g=kt.identifierPrefix;if(lt){var A=No,I=Oo;A=(I&~(1<<32-zn(I)-1)).toString(32)+A,g="_"+g+"R_"+A,A=sd++,0<\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof I.is=="string"?w.createElement("select",{is:I.is}):w.createElement("select"),I.multiple?p.multiple=!0:I.size&&(p.size=I.size);break;default:p=typeof I.is=="string"?w.createElement(f,{is:I.is}):w.createElement(f)}}p[Pn]=g,p[li]=I;e:for(w=g.child;w!==null;){if(w.tag===5||w.tag===6)p.appendChild(w.stateNode);else if(w.tag!==4&&w.tag!==27&&w.child!==null){w.child.return=w,w=w.child;continue}if(w===g)break e;for(;w.sibling===null;){if(w.return===null||w.return===g)break e;w=w.return}w.sibling.return=w.return,w=w.sibling}g.stateNode=p;e:switch(Gn(p,f,I),f){case"button":case"input":case"select":case"textarea":I=!!I.autoFocus;break e;case"img":I=!0;break e;default:I=!1}I&&lr(g)}}return Lt(g),Lv(g,g.type,r===null?null:r.memoizedProps,g.pendingProps,A),null;case 6:if(r&&g.stateNode!=null)r.memoizedProps!==I&&lr(g);else{if(typeof I!="string"&&g.stateNode===null)throw Error(i(166));if(r=be.current,za(g)){if(r=g.stateNode,A=g.memoizedProps,I=null,f=Ln,f!==null)switch(f.tag){case 27:case 5:I=f.memoizedProps}r[Pn]=g,r=!!(r.nodeValue===A||I!==null&&I.suppressHydrationWarning===!0||KD(r.nodeValue,A)),r||es(g,!0)}else r=kd(r).createTextNode(I),r[Pn]=g,g.stateNode=r}return Lt(g),null;case 31:if(A=g.memoizedState,r===null||r.memoizedState!==null){if(I=za(g),A!==null){if(r===null){if(!I)throw Error(i(318));if(r=g.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Pn]=g}else ig(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;Lt(g),r=!1}else A=Wm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=A),r=!0;if(!r)return g.flags&256?(xi(g),g):(xi(g),null);if((g.flags&128)!==0)throw Error(i(558))}return Lt(g),null;case 13:if(I=g.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(f=za(g),I!==null&&I.dehydrated!==null){if(r===null){if(!f)throw Error(i(318));if(f=g.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[Pn]=g}else ig(),(g.flags&128)===0&&(g.memoizedState=null),g.flags|=4;Lt(g),f=!1}else f=Wm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=f),f=!0;if(!f)return g.flags&256?(xi(g),g):(xi(g),null)}return xi(g),(g.flags&128)!==0?(g.lanes=A,g):(A=I!==null,r=r!==null&&r.memoizedState!==null,A&&(I=g.child,f=null,I.alternate!==null&&I.alternate.memoizedState!==null&&I.alternate.memoizedState.cachePool!==null&&(f=I.alternate.memoizedState.cachePool.pool),p=null,I.memoizedState!==null&&I.memoizedState.cachePool!==null&&(p=I.memoizedState.cachePool.pool),p!==f&&(I.flags|=2048)),A!==r&&A&&(g.child.flags|=8192),fd(g,g.updateQueue),Lt(g),null);case 4:return ae(),r===null&&sy(g.stateNode.containerInfo),Lt(g),null;case 10:return sr(g.type),Lt(g),null;case 19:if(D(an),I=g.memoizedState,I===null)return Lt(g),null;if(f=(g.flags&128)!==0,p=I.rendering,p===null)if(f)ql(I,!1);else{if(qt!==0||r!==null&&(r.flags&128)!==0)for(r=g.child;r!==null;){if(p=od(r),p!==null){for(g.flags|=128,ql(I,!1),r=p.updateQueue,g.updateQueue=r,fd(g,r),g.subtreeFlags=0,r=A,A=g.child;A!==null;)TR(A,r),A=A.sibling;return H(an,an.current&1|2),lt&&or(g,I.treeForkCount),g.child}r=r.sibling}I.tail!==null&&Ot()>bd&&(g.flags|=128,f=!0,ql(I,!1),g.lanes=4194304)}else{if(!f)if(r=od(p),r!==null){if(g.flags|=128,f=!0,r=r.updateQueue,g.updateQueue=r,fd(g,r),ql(I,!0),I.tail===null&&I.tailMode==="hidden"&&!p.alternate&&!lt)return Lt(g),null}else 2*Ot()-I.renderingStartTime>bd&&A!==536870912&&(g.flags|=128,f=!0,ql(I,!1),g.lanes=4194304);I.isBackwards?(p.sibling=g.child,g.child=p):(r=I.last,r!==null?r.sibling=p:g.child=p,I.last=p)}return I.tail!==null?(r=I.tail,I.rendering=r,I.tail=r.sibling,I.renderingStartTime=Ot(),r.sibling=null,A=an.current,H(an,f?A&1|2:A&1),lt&&or(g,I.treeForkCount),r):(Lt(g),null);case 22:case 23:return xi(g),gv(),I=g.memoizedState!==null,r!==null?r.memoizedState!==null!==I&&(g.flags|=8192):I&&(g.flags|=8192),I?(A&536870912)!==0&&(g.flags&128)===0&&(Lt(g),g.subtreeFlags&6&&(g.flags|=8192)):Lt(g),A=g.updateQueue,A!==null&&fd(g,A.retryQueue),A=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(A=r.memoizedState.cachePool.pool),I=null,g.memoizedState!==null&&g.memoizedState.cachePool!==null&&(I=g.memoizedState.cachePool.pool),I!==A&&(g.flags|=2048),r!==null&&D(sg),null;case 24:return A=null,r!==null&&(A=r.memoizedState.cache),g.memoizedState.cache!==A&&(g.flags|=2048),sr(hn),Lt(g),null;case 25:return null;case 30:return null}throw Error(i(156,g.tag))}function Ede(r,g){switch(Ym(g),g.tag){case 1:return r=g.flags,r&65536?(g.flags=r&-65537|128,g):null;case 3:return sr(hn),ae(),r=g.flags,(r&65536)!==0&&(r&128)===0?(g.flags=r&-65537|128,g):null;case 26:case 27:case 5:return Re(g),null;case 31:if(g.memoizedState!==null){if(xi(g),g.alternate===null)throw Error(i(340));ig()}return r=g.flags,r&65536?(g.flags=r&-65537|128,g):null;case 13:if(xi(g),r=g.memoizedState,r!==null&&r.dehydrated!==null){if(g.alternate===null)throw Error(i(340));ig()}return r=g.flags,r&65536?(g.flags=r&-65537|128,g):null;case 19:return D(an),null;case 4:return ae(),null;case 10:return sr(g.type),null;case 22:case 23:return xi(g),gv(),r!==null&&D(sg),r=g.flags,r&65536?(g.flags=r&-65537|128,g):null;case 24:return sr(hn),null;case 25:return null;default:return null}}function eD(r,g){switch(Ym(g),g.tag){case 3:sr(hn),ae();break;case 26:case 27:case 5:Re(g);break;case 4:ae();break;case 31:g.memoizedState!==null&&xi(g);break;case 13:xi(g);break;case 19:D(an);break;case 10:sr(g.type);break;case 22:case 23:xi(g),gv(),r!==null&&D(sg);break;case 24:sr(hn)}}function Jl(r,g){try{var A=g.updateQueue,I=A!==null?A.lastEffect:null;if(I!==null){var f=I.next;A=f;do{if((A.tag&r)===r){I=void 0;var p=A.create,w=A.inst;I=p(),w.destroy=I}A=A.next}while(A!==f)}}catch(N){xt(g,g.return,N)}}function gs(r,g,A){try{var I=g.updateQueue,f=I!==null?I.lastEffect:null;if(f!==null){var p=f.next;I=p;do{if((I.tag&r)===r){var w=I.inst,N=w.destroy;if(N!==void 0){w.destroy=void 0,f=g;var P=A,$=N;try{$()}catch(te){xt(f,P,te)}}}I=I.next}while(I!==p)}}catch(te){xt(g,g.return,te)}}function tD(r){var g=r.updateQueue;if(g!==null){var A=r.stateNode;try{HR(g,A)}catch(I){xt(r,r.return,I)}}}function nD(r,g,A){A.props=Cg(r.type,r.memoizedProps),A.state=r.memoizedState;try{A.componentWillUnmount()}catch(I){xt(r,g,I)}}function eC(r,g){try{var A=r.ref;if(A!==null){switch(r.tag){case 26:case 27:case 5:var I=r.stateNode;break;case 30:I=r.stateNode;break;default:I=r.stateNode}typeof A=="function"?r.refCleanup=A(I):A.current=I}}catch(f){xt(r,g,f)}}function Mo(r,g){var A=r.ref,I=r.refCleanup;if(A!==null)if(typeof I=="function")try{I()}catch(f){xt(r,g,f)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof A=="function")try{A(null)}catch(f){xt(r,g,f)}else A.current=null}function iD(r){var g=r.type,A=r.memoizedProps,I=r.stateNode;try{e:switch(g){case"button":case"input":case"select":case"textarea":A.autoFocus&&I.focus();break e;case"img":A.src?I.src=A.src:A.srcSet&&(I.srcset=A.srcSet)}}catch(f){xt(r,r.return,f)}}function Bv(r,g,A){try{var I=r.stateNode;Wde(I,r.type,A,g),I[li]=g}catch(f){xt(r,r.return,f)}}function oD(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&ds(r.type)||r.tag===4}function Zv(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||oD(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&ds(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Gv(r,g,A){var I=r.tag;if(I===5||I===6)r=r.stateNode,g?(A.nodeType===9?A.body:A.nodeName==="HTML"?A.ownerDocument.body:A).insertBefore(r,g):(g=A.nodeType===9?A.body:A.nodeName==="HTML"?A.ownerDocument.body:A,g.appendChild(r),A=A._reactRootContainer,A!=null||g.onclick!==null||(g.onclick=tr));else if(I!==4&&(I===27&&ds(r.type)&&(A=r.stateNode,g=null),r=r.child,r!==null))for(Gv(r,g,A),r=r.sibling;r!==null;)Gv(r,g,A),r=r.sibling}function pd(r,g,A){var I=r.tag;if(I===5||I===6)r=r.stateNode,g?A.insertBefore(r,g):A.appendChild(r);else if(I!==4&&(I===27&&ds(r.type)&&(A=r.stateNode),r=r.child,r!==null))for(pd(r,g,A),r=r.sibling;r!==null;)pd(r,g,A),r=r.sibling}function rD(r){var g=r.stateNode,A=r.memoizedProps;try{for(var I=r.type,f=g.attributes;f.length;)g.removeAttributeNode(f[0]);Gn(g,I,A),g[Pn]=r,g[li]=A}catch(p){xt(r,r.return,p)}}var Cr=!1,mn=!1,Fv=!1,sD=typeof WeakSet=="function"?WeakSet:Set,Mn=null;function Tde(r,g){if(r=r.containerInfo,Ay=Bd,r=pR(r),jm(r)){if("selectionStart"in r)var A={start:r.selectionStart,end:r.selectionEnd};else e:{A=(A=r.ownerDocument)&&A.defaultView||window;var I=A.getSelection&&A.getSelection();if(I&&I.rangeCount!==0){A=I.anchorNode;var f=I.anchorOffset,p=I.focusNode;I=I.focusOffset;try{A.nodeType,p.nodeType}catch{A=null;break e}var w=0,N=-1,P=-1,$=0,te=0,Ae=r,K=null;t:for(;;){for(var q;Ae!==A||f!==0&&Ae.nodeType!==3||(N=w+f),Ae!==p||I!==0&&Ae.nodeType!==3||(P=w+I),Ae.nodeType===3&&(w+=Ae.nodeValue.length),(q=Ae.firstChild)!==null;)K=Ae,Ae=q;for(;;){if(Ae===r)break t;if(K===A&&++$===f&&(N=w),K===p&&++te===I&&(P=w),(q=Ae.nextSibling)!==null)break;Ae=K,K=Ae.parentNode}Ae=q}A=N===-1||P===-1?null:{start:N,end:P}}else A=null}A=A||{start:0,end:0}}else A=null;for(ly={focusedElem:r,selectionRange:A},Bd=!1,Mn=g;Mn!==null;)if(g=Mn,r=g.child,(g.subtreeFlags&1028)!==0&&r!==null)r.return=g,Mn=r;else for(;Mn!==null;){switch(g=Mn,p=g.alternate,r=g.flags,g.tag){case 0:if((r&4)!==0&&(r=g.updateQueue,r=r!==null?r.events:null,r!==null))for(A=0;A title"))),Gn(p,I,A),p[Pn]=r,Nn(p),I=p;break e;case"link":var w=I_("link","href",f).get(I+(A.href||""));if(w){for(var N=0;NRt&&(w=Rt,Rt=$e,$e=w);var V=hR(N,$e),B=hR(N,Rt);if(V&&B&&(q.rangeCount!==1||q.anchorNode!==V.node||q.anchorOffset!==V.offset||q.focusNode!==B.node||q.focusOffset!==B.offset)){var Y=Ae.createRange();Y.setStart(V.node,V.offset),q.removeAllRanges(),$e>Rt?(q.addRange(Y),q.extend(B.node,B.offset)):(Y.setEnd(B.node,B.offset),q.addRange(Y))}}}}for(Ae=[],q=N;q=q.parentNode;)q.nodeType===1&&Ae.push({element:q,left:q.scrollLeft,top:q.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;NA?32:A,z.T=null,A=Kv,Kv=null;var p=Cs,w=hr;if(wn=0,Xa=Cs=null,hr=0,(mt&6)!==0)throw Error(i(331));var N=mt;if(mt|=4,fD(p.current),dD(p,p.current,w,A),mt=N,sC(0,!1),Ke&&typeof Ke.onPostCommitFiberRoot=="function")try{Ke.onPostCommitFiberRoot(pt,p)}catch{}return!0}finally{U.p=f,z.T=I,jD(r,g)}}function PD(r,g,A){g=Bi(A,g),g=Ov(r.stateNode,g,2),r=os(r,g,2),r!==null&&(ro(r,2),Ro(r))}function xt(r,g,A){if(r.tag===3)PD(r,r,A);else for(;g!==null;){if(g.tag===3){PD(g,r,A);break}else if(g.tag===1){var I=g.stateNode;if(typeof g.type.getDerivedStateFromError=="function"||typeof I.componentDidCatch=="function"&&(ls===null||!ls.has(I))){r=Bi(A,r),A=Lk(2),I=os(g,A,2),I!==null&&(Bk(A,I,g,r),ro(I,2),Ro(I));break}}g=g.return}}function Jv(r,g,A){var I=r.pingCache;if(I===null){I=r.pingCache=new Mde;var f=new Set;I.set(g,f)}else f=I.get(g),f===void 0&&(f=new Set,I.set(g,f));f.has(A)||(Hv=!0,f.add(A),r=jde.bind(null,r,g,A),g.then(r,r))}function jde(r,g,A){var I=r.pingCache;I!==null&&I.delete(g),r.pingedLanes|=r.suspendedLanes&A,r.warmLanes&=~A,kt===r&&(at&A)===A&&(qt===4||qt===3&&(at&62914560)===at&&300>Ot()-yd?(mt&2)===0&&Qa(r,0):Yv|=A,Ka===at&&(Ka=0)),Ro(r)}function LD(r,g){g===0&&(g=xl()),r=tg(r,g),r!==null&&(ro(r,g),Ro(r))}function zde(r){var g=r.memoizedState,A=0;g!==null&&(A=g.retryLane),LD(r,A)}function Pde(r,g){var A=0;switch(r.tag){case 31:case 13:var I=r.stateNode,f=r.memoizedState;f!==null&&(A=f.retryLane);break;case 19:I=r.stateNode;break;case 22:I=r.stateNode._retryCache;break;default:throw Error(i(314))}I!==null&&I.delete(g),LD(r,A)}function Lde(r,g){return Tt(r,g)}var Od=null,Ja=null,ey=!1,Nd=!1,ty=!1,cs=0;function Ro(r){r!==Ja&&r.next===null&&(Ja===null?Od=Ja=r:Ja=Ja.next=r),Nd=!0,ey||(ey=!0,Zde())}function sC(r,g){if(!ty&&Nd){ty=!0;do for(var A=!1,I=Od;I!==null;){if(r!==0){var f=I.pendingLanes;if(f===0)var p=0;else{var w=I.suspendedLanes,N=I.pingedLanes;p=(1<<31-zn(42|r)+1)-1,p&=f&~(w&~N),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(A=!0,FD(I,p))}else p=at,p=$r(I,I===kt?p:0,I.cancelPendingCommit!==null||I.timeoutHandle!==-1),(p&3)===0||Wr(I,p)||(A=!0,FD(I,p));I=I.next}while(A);ty=!1}}function Bde(){BD()}function BD(){Nd=ey=!1;var r=0;cs!==0&&Xde()&&(r=cs);for(var g=Ot(),A=null,I=Od;I!==null;){var f=I.next,p=ZD(I,g);p===0?(I.next=null,A===null?Od=f:A.next=f,f===null&&(Ja=A)):(A=I,(r!==0||(p&3)!==0)&&(Nd=!0)),I=f}wn!==0&&wn!==5||sC(r),cs!==0&&(cs=0)}function ZD(r,g){for(var A=r.suspendedLanes,I=r.pingedLanes,f=r.expirationTimes,p=r.pendingLanes&-62914561;0N)break;var te=P.transferSize,Ae=P.initiatorType;te&&XD(Ae)&&(P=P.responseEnd,w+=te*(P"u"?null:document;function a_(r,g,A){var I=eA;if(I&&typeof g=="string"&&g){var f=Pi(g);f='link[rel="'+r+'"][href="'+f+'"]',typeof A=="string"&&(f+='[crossorigin="'+A+'"]'),g_.has(f)||(g_.add(f),r={rel:r,crossOrigin:A,href:g},I.querySelector(f)===null&&(g=I.createElement("link"),Gn(g,"link",r),Nn(g),I.head.appendChild(g)))}}function rue(r){fr.D(r),a_("dns-prefetch",r,null)}function sue(r,g){fr.C(r,g),a_("preconnect",r,g)}function gue(r,g,A){fr.L(r,g,A);var I=eA;if(I&&r&&g){var f='link[rel="preload"][as="'+Pi(g)+'"]';g==="image"&&A&&A.imageSrcSet?(f+='[imagesrcset="'+Pi(A.imageSrcSet)+'"]',typeof A.imageSizes=="string"&&(f+='[imagesizes="'+Pi(A.imageSizes)+'"]')):f+='[href="'+Pi(r)+'"]';var p=f;switch(g){case"style":p=tA(r);break;case"script":p=nA(r)}Hi.has(p)||(r=h({rel:"preload",href:g==="image"&&A&&A.imageSrcSet?void 0:r,as:g},A),Hi.set(p,r),I.querySelector(f)!==null||g==="style"&&I.querySelector(lC(p))||g==="script"&&I.querySelector(CC(p))||(g=I.createElement("link"),Gn(g,"link",r),Nn(g),I.head.appendChild(g)))}}function aue(r,g){fr.m(r,g);var A=eA;if(A&&r){var I=g&&typeof g.as=="string"?g.as:"script",f='link[rel="modulepreload"][as="'+Pi(I)+'"][href="'+Pi(r)+'"]',p=f;switch(I){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=nA(r)}if(!Hi.has(p)&&(r=h({rel:"modulepreload",href:r},g),Hi.set(p,r),A.querySelector(f)===null)){switch(I){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(A.querySelector(CC(p)))return}I=A.createElement("link"),Gn(I,"link",r),Nn(I),A.head.appendChild(I)}}}function Aue(r,g,A){fr.S(r,g,A);var I=eA;if(I&&r){var f=wa(I).hoistableStyles,p=tA(r);g=g||"default";var w=f.get(p);if(!w){var N={loading:0,preload:null};if(w=I.querySelector(lC(p)))N.loading=5;else{r=h({rel:"stylesheet",href:r,"data-precedence":g},A),(A=Hi.get(p))&&fy(r,A);var P=w=I.createElement("link");Nn(P),Gn(P,"link",r),P._p=new Promise(function($,te){P.onload=$,P.onerror=te}),P.addEventListener("load",function(){N.loading|=1}),P.addEventListener("error",function(){N.loading|=2}),N.loading|=4,_d(w,g,I)}w={type:"stylesheet",instance:w,count:1,state:N},f.set(p,w)}}}function lue(r,g){fr.X(r,g);var A=eA;if(A&&r){var I=wa(A).hoistableScripts,f=nA(r),p=I.get(f);p||(p=A.querySelector(CC(f)),p||(r=h({src:r,async:!0},g),(g=Hi.get(f))&&py(r,g),p=A.createElement("script"),Nn(p),Gn(p,"link",r),A.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},I.set(f,p))}}function Cue(r,g){fr.M(r,g);var A=eA;if(A&&r){var I=wa(A).hoistableScripts,f=nA(r),p=I.get(f);p||(p=A.querySelector(CC(f)),p||(r=h({src:r,async:!0,type:"module"},g),(g=Hi.get(f))&&py(r,g),p=A.createElement("script"),Nn(p),Gn(p,"link",r),A.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},I.set(f,p))}}function A_(r,g,A,I){var f=(f=be.current)?Dd(f):null;if(!f)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof A.precedence=="string"&&typeof A.href=="string"?(g=tA(A.href),A=wa(f).hoistableStyles,I=A.get(g),I||(I={type:"style",instance:null,count:0,state:null},A.set(g,I)),I):{type:"void",instance:null,count:0,state:null};case"link":if(A.rel==="stylesheet"&&typeof A.href=="string"&&typeof A.precedence=="string"){r=tA(A.href);var p=wa(f).hoistableStyles,w=p.get(r);if(w||(f=f.ownerDocument||f,w={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(r,w),(p=f.querySelector(lC(r)))&&!p._p&&(w.instance=p,w.state.loading=5),Hi.has(r)||(A={rel:"preload",as:"style",href:A.href,crossOrigin:A.crossOrigin,integrity:A.integrity,media:A.media,hrefLang:A.hrefLang,referrerPolicy:A.referrerPolicy},Hi.set(r,A),p||Iue(f,r,A,w.state))),g&&I===null)throw Error(i(528,""));return w}if(g&&I!==null)throw Error(i(529,""));return null;case"script":return g=A.async,A=A.src,typeof A=="string"&&g&&typeof g!="function"&&typeof g!="symbol"?(g=nA(A),A=wa(f).hoistableScripts,I=A.get(g),I||(I={type:"script",instance:null,count:0,state:null},A.set(g,I)),I):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function tA(r){return'href="'+Pi(r)+'"'}function lC(r){return'link[rel="stylesheet"]['+r+"]"}function l_(r){return h({},r,{"data-precedence":r.precedence,precedence:null})}function Iue(r,g,A,I){r.querySelector('link[rel="preload"][as="style"]['+g+"]")?I.loading=1:(g=r.createElement("link"),I.preload=g,g.addEventListener("load",function(){return I.loading|=1}),g.addEventListener("error",function(){return I.loading|=2}),Gn(g,"link",A),Nn(g),r.head.appendChild(g))}function nA(r){return'[src="'+Pi(r)+'"]'}function CC(r){return"script[async]"+r}function C_(r,g,A){if(g.count++,g.instance===null)switch(g.type){case"style":var I=r.querySelector('style[data-href~="'+Pi(A.href)+'"]');if(I)return g.instance=I,Nn(I),I;var f=h({},A,{"data-href":A.href,"data-precedence":A.precedence,href:null,precedence:null});return I=(r.ownerDocument||r).createElement("style"),Nn(I),Gn(I,"style",f),_d(I,A.precedence,r),g.instance=I;case"stylesheet":f=tA(A.href);var p=r.querySelector(lC(f));if(p)return g.state.loading|=4,g.instance=p,Nn(p),p;I=l_(A),(f=Hi.get(f))&&fy(I,f),p=(r.ownerDocument||r).createElement("link"),Nn(p);var w=p;return w._p=new Promise(function(N,P){w.onload=N,w.onerror=P}),Gn(p,"link",I),g.state.loading|=4,_d(p,A.precedence,r),g.instance=p;case"script":return p=nA(A.src),(f=r.querySelector(CC(p)))?(g.instance=f,Nn(f),f):(I=A,(f=Hi.get(p))&&(I=h({},A),py(I,f)),r=r.ownerDocument||r,f=r.createElement("script"),Nn(f),Gn(f,"link",I),r.head.appendChild(f),g.instance=f);case"void":return null;default:throw Error(i(443,g.type))}else g.type==="stylesheet"&&(g.state.loading&4)===0&&(I=g.instance,g.state.loading|=4,_d(I,A.precedence,r));return g.instance}function _d(r,g,A){for(var I=A.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=I.length?I[I.length-1]:null,p=f,w=0;w title"):null)}function cue(r,g,A){if(A===1||g.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof g.precedence!="string"||typeof g.href!="string"||g.href==="")break;return!0;case"link":if(typeof g.rel!="string"||typeof g.href!="string"||g.href===""||g.onLoad||g.onError)break;return g.rel==="stylesheet"?(r=g.disabled,typeof g.precedence=="string"&&r==null):!0;case"script":if(g.async&&typeof g.async!="function"&&typeof g.async!="symbol"&&!g.onLoad&&!g.onError&&g.src&&typeof g.src=="string")return!0}return!1}function d_(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function due(r,g,A,I){if(A.type==="stylesheet"&&(typeof I.media!="string"||matchMedia(I.media).matches!==!1)&&(A.state.loading&4)===0){if(A.instance===null){var f=tA(I.href),p=g.querySelector(lC(f));if(p){g=p._p,g!==null&&typeof g=="object"&&typeof g.then=="function"&&(r.count++,r=zd.bind(r),g.then(r,r)),A.state.loading|=4,A.instance=p,Nn(p);return}p=g.ownerDocument||g,I=l_(I),(f=Hi.get(f))&&fy(I,f),p=p.createElement("link"),Nn(p);var w=p;w._p=new Promise(function(N,P){w.onload=N,w.onerror=P}),Gn(p,"link",I),A.instance=p}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(A,g),(g=A.state.preload)&&(A.state.loading&3)===0&&(r.count++,A=zd.bind(r),g.addEventListener("load",A),g.addEventListener("error",A))}}var my=0;function uue(r,g){return r.stylesheets&&r.count===0&&Ld(r,r.stylesheets),0my?50:800)+g);return r.unsuspend=A,function(){r.unsuspend=null,clearTimeout(I),clearTimeout(f)}}:null}function zd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Ld(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Pd=null;function Ld(r,g){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Pd=new Map,g.forEach(hue,r),Pd=null,zd.call(r))}function hue(r,g){if(!(g.state.loading&4)){var A=Pd.get(r);if(A)var I=A.get(null);else{A=new Map,Pd.set(r,A);for(var f=r.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Yd.exports=P_(),Yd.exports}var B_=L_(),Ly;function ne(t,e,n){function i(l,C){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:C,constr:a,traits:new Set},enumerable:!1}),l._zod.traits.has(t))return;l._zod.traits.add(t),e(l,C);const c=a.prototype,u=Object.keys(c);for(let h=0;hn?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(t)}),Object.defineProperty(a,"name",{value:t}),a}class dg extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class By extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(Ly=globalThis).__zod_globalConfig??(Ly.__zod_globalConfig={});const qd=globalThis.__zod_globalConfig;function ko(t){return qd}function Zy(t){const e=Object.values(t).filter(i=>typeof i=="number");return Object.entries(t).filter(([i,o])=>e.indexOf(+i)===-1).map(([i,o])=>o)}function Jd(t,e){return typeof e=="bigint"?e.toString():e}function hC(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function eu(t){return t==null}function tu(t){const e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function Z_(t,e){const n=t/e,i=Math.round(n),o=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i){};function rA(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const F_=hC(()=>{if(qd.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function ug(t){if(rA(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const n=e.prototype;return!(rA(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Uy(t){return ug(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const V_=new Set(["string","number","symbol"]);function hg(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vr(t,e,n){const i=new t._zod.constr(e??t._zod.def);return(!e||n?.parent)&&(i._zod.parent=t),i}function Pe(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function U_(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const H_={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Y_(t,e){const n=t._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const s=mr(t._zod.def,{get shape(){const a={};for(const l in e){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);e[l]&&(a[l]=n.shape[l])}return vs(this,"shape",a),a},checks:[]});return vr(t,s)}function $_(t,e){const n=t._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=mr(t._zod.def,{get shape(){const a={...t._zod.def.shape};for(const l in e){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);e[l]&&delete a[l]}return vs(this,"shape",a),a},checks:[]});return vr(t,s)}function W_(t,e){if(!ug(e))throw new Error("Invalid input to extend: expected a plain object");const n=t._zod.def.checks;if(n&&n.length>0){const s=t._zod.def.shape;for(const a in e)if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=mr(t._zod.def,{get shape(){const s={...t._zod.def.shape,...e};return vs(this,"shape",s),s}});return vr(t,o)}function K_(t,e){if(!ug(e))throw new Error("Invalid input to safeExtend: expected a plain object");const n=mr(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e};return vs(this,"shape",i),i}});return vr(t,n)}function X_(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=mr(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e._zod.def.shape};return vs(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return vr(t,n)}function Q_(t,e,n){const o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=mr(e._zod.def,{get shape(){const l=e._zod.def.shape,C={...l};if(n)for(const c in n){if(!(c in l))throw new Error(`Unrecognized key: "${c}"`);n[c]&&(C[c]=t?new t({type:"optional",innerType:l[c]}):l[c])}else for(const c in l)C[c]=t?new t({type:"optional",innerType:l[c]}):l[c];return vs(this,"shape",C),C},checks:[]});return vr(e,a)}function q_(t,e,n){const i=mr(e._zod.def,{get shape(){const o=e._zod.def.shape,s={...o};if(n)for(const a in n){if(!(a in s))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(s[a]=new t({type:"nonoptional",innerType:o[a]}))}else for(const a in o)s[a]=new t({type:"nonoptional",innerType:o[a]});return vs(this,"shape",s),s}});return vr(e,i)}function fg(t,e=0){if(t.aborted===!0)return!0;for(let n=e;n{var i;return(i=n).path??(i.path=[]),n.path.unshift(t),n})}function fC(t){return typeof t=="string"?t:t?.message}function Do(t,e,n){const i=t.message?t.message:fC(t.inst?._zod.def?.error?.(t))??fC(e?.error?.(t))??fC(n.customError?.(t))??fC(n.localeError?.(t))??"Invalid input",{inst:o,continue:s,input:a,...l}=t;return l.path??(l.path=[]),l.message=i,e?.reportInput&&(l.input=a),l}function nu(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function sA(...t){const[e,n,i]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:i}:{...e}}const Hy=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Jd,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Yy=ne("$ZodError",Hy),$y=ne("$ZodError",Hy,{Parent:Error});function ej(t,e=n=>n.message){const n={},i=[];for(const o of t.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):i.push(e(o));return{formErrors:i,fieldErrors:n}}function tj(t,e=n=>n.message){const n={_errors:[]},i=(o,s=[])=>{for(const a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(l=>i({issues:l},[...s,...a.path]));else if(a.code==="invalid_key")i({issues:a.issues},[...s,...a.path]);else if(a.code==="invalid_element")i({issues:a.issues},[...s,...a.path]);else{const l=[...s,...a.path];if(l.length===0)n._errors.push(e(a));else{let C=n,c=0;for(;c(e,n,i,o)=>{const s=i?{...i,async:!1}:{async:!1},a=e._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new dg;if(a.issues.length){const l=new(o?.Err??t)(a.issues.map(C=>Do(C,s,ko())));throw Vy(l,o?.callee),l}return a.value},ou=t=>async(e,n,i,o)=>{const s=i?{...i,async:!0}:{async:!0};let a=e._zod.run({value:n,issues:[]},s);if(a instanceof Promise&&(a=await a),a.issues.length){const l=new(o?.Err??t)(a.issues.map(C=>Do(C,s,ko())));throw Vy(l,o?.callee),l}return a.value},pC=t=>(e,n,i)=>{const o=i?{...i,async:!1}:{async:!1},s=e._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new dg;return s.issues.length?{success:!1,error:new(t??Yy)(s.issues.map(a=>Do(a,o,ko())))}:{success:!0,data:s.value}},nj=pC($y),mC=t=>async(e,n,i)=>{const o=i?{...i,async:!0}:{async:!0};let s=e._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(a=>Do(a,o,ko())))}:{success:!0,data:s.value}},ij=mC($y),oj=t=>(e,n,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return iu(t)(e,n,o)},rj=t=>(e,n,i)=>iu(t)(e,n,i),sj=t=>async(e,n,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return ou(t)(e,n,o)},gj=t=>async(e,n,i)=>ou(t)(e,n,i),aj=t=>(e,n,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return pC(t)(e,n,o)},Aj=t=>(e,n,i)=>pC(t)(e,n,i),lj=t=>async(e,n,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return mC(t)(e,n,o)},Cj=t=>async(e,n,i)=>mC(t)(e,n,i),Ij=/^[cC][0-9a-z]{6,}$/,cj=/^[0-9a-z]+$/,dj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uj=/^[0-9a-vA-V]{20}$/,hj=/^[A-Za-z0-9]{27}$/,fj=/^[a-zA-Z0-9_-]{21}$/,pj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,mj=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Wy=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,vj=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,yj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function bj(){return new RegExp(yj,"u")}const wj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,xj=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Sj=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ej=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Tj=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ky=/^[A-Za-z0-9_-]*$/,Oj=/^https?$/,Nj=/^\+[1-9]\d{6,14}$/,Xy="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Mj=new RegExp(`^${Xy}$`);function Qy(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Rj(t){return new RegExp(`^${Qy(t)}$`)}function kj(t){const e=Qy({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${e}(?:${n.join("|")})`;return new RegExp(`^${Xy}T(?:${i})$`)}const Dj=t=>{const e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},_j=/^-?\d+$/,qy=/^-?\d+(?:\.\d+)?$/,jj=/^(?:true|false)$/i,zj=/^[^A-Z]*$/,Pj=/^[^a-z]*$/,ii=ne("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),Jy={number:"number",bigint:"bigint",object:"date"},eb=ne("$ZodCheckLessThan",(t,e)=>{ii.init(t,e);const n=Jy[typeof e.value];t._zod.onattach.push(i=>{const o=i._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value{(e.inclusive?i.value<=e.value:i.value{ii.init(t,e);const n=Jy[typeof e.value];t._zod.onattach.push(i=>{const o=i._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=i=>{(e.inclusive?i.value>=e.value:i.value>e.value)||i.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:i.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Lj=ne("$ZodCheckMultipleOf",(t,e)=>{ii.init(t,e),t._zod.onattach.push(n=>{var i;(i=n._zod.bag).multipleOf??(i.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):Z_(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),Bj=ne("$ZodCheckNumberFormat",(t,e)=>{ii.init(t,e),e.format=e.format||"float64";const n=e.format?.includes("int"),i=n?"int":"number",[o,s]=H_[e.format];t._zod.onattach.push(a=>{const l=a._zod.bag;l.format=e.format,l.minimum=o,l.maximum=s,n&&(l.pattern=_j)}),t._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:i,format:e.format,code:"invalid_type",continue:!1,input:l,inst:t});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!e.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:i,inclusive:!0,continue:!e.abort});return}}ls&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}}),Zj=ne("$ZodCheckMaxLength",(t,e)=>{var n;ii.init(t,e),(n=t._zod.def).when??(n.when=i=>{const o=i.value;return!eu(o)&&o.length!==void 0}),t._zod.onattach.push(i=>{const o=i._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum{const o=i.value;if(o.length<=e.maximum)return;const a=nu(o);i.issues.push({origin:a,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Gj=ne("$ZodCheckMinLength",(t,e)=>{var n;ii.init(t,e),(n=t._zod.def).when??(n.when=i=>{const o=i.value;return!eu(o)&&o.length!==void 0}),t._zod.onattach.push(i=>{const o=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(i._zod.bag.minimum=e.minimum)}),t._zod.check=i=>{const o=i.value;if(o.length>=e.minimum)return;const a=nu(o);i.issues.push({origin:a,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Fj=ne("$ZodCheckLengthEquals",(t,e)=>{var n;ii.init(t,e),(n=t._zod.def).when??(n.when=i=>{const o=i.value;return!eu(o)&&o.length!==void 0}),t._zod.onattach.push(i=>{const o=i._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=i=>{const o=i.value,s=o.length;if(s===e.length)return;const a=nu(o),l=s>e.length;i.issues.push({origin:a,...l?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:i.value,inst:t,continue:!e.abort})}}),vC=ne("$ZodCheckStringFormat",(t,e)=>{var n,i;ii.init(t,e),t._zod.onattach.push(o=>{const s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(i=t._zod).check??(i.check=()=>{})}),Vj=ne("$ZodCheckRegex",(t,e)=>{vC.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Uj=ne("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=zj),vC.init(t,e)}),Hj=ne("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Pj),vC.init(t,e)}),Yj=ne("$ZodCheckIncludes",(t,e)=>{ii.init(t,e);const n=hg(e.includes),i=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=i,t._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(i)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),$j=ne("$ZodCheckStartsWith",(t,e)=>{ii.init(t,e);const n=new RegExp(`^${hg(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.startsWith(e.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:i.value,inst:t,continue:!e.abort})}}),Wj=ne("$ZodCheckEndsWith",(t,e)=>{ii.init(t,e);const n=new RegExp(`.*${hg(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.endsWith(e.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:i.value,inst:t,continue:!e.abort})}}),Kj=ne("$ZodCheckOverwrite",(t,e)=>{ii.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});class Xj{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const i=e.split(` `).filter(a=>a),o=Math.min(...i.map(a=>a.length-a.trimStart().length)),s=i.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of s)this.content.push(a)}compile(){const e=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...n,o.join(` `))}}const Qj={major:4,minor:4,patch:3},Gt=ne("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Qj;const i=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&i.unshift(t);for(const o of i)for(const s of o._zod.onattach)s(t);if(i.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{const o=(a,l,C)=>{let c=fg(a),u;for(const h of l){if(h._zod.def.when){if(J_(a)||!h._zod.def.when(a))continue}else if(c)continue;const m=a.issues.length,v=h._zod.check(a);if(v instanceof Promise&&C?.async===!1)throw new dg;if(u||v instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await v,a.issues.length!==m&&(c||(c=fg(a,m)))});else{if(a.issues.length===m)continue;c||(c=fg(a,m))}}return u?u.then(()=>a):a},s=(a,l,C)=>{if(fg(a))return a.aborted=!0,a;const c=o(l,i,C);if(c instanceof Promise){if(C.async===!1)throw new dg;return c.then(u=>t._zod.parse(u,C))}return t._zod.parse(c,C)};t._zod.run=(a,l)=>{if(l.skipChecks)return t._zod.parse(a,l);if(l.direction==="backward"){const c=t._zod.parse({value:a.value,issues:[]},{...l,skipChecks:!0});return c instanceof Promise?c.then(u=>s(u,a,l)):s(c,a,l)}const C=t._zod.parse(a,l);if(C instanceof Promise){if(l.async===!1)throw new dg;return C.then(c=>o(c,i,l))}return o(C,i,l)}}yt(t,"~standard",()=>({validate:o=>{try{const s=nj(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return ij(t,o).then(a=>a.success?{value:a.data}:{issues:a.error?.issues})}},vendor:"zod",version:1}))}),ru=ne("$ZodString",(t,e)=>{Gt.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Dj(t._zod.bag),t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),Bt=ne("$ZodStringFormat",(t,e)=>{vC.init(t,e),ru.init(t,e)}),qj=ne("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=mj),Bt.init(t,e)}),Jj=ne("$ZodUUID",(t,e)=>{if(e.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(i===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=Wy(i))}else e.pattern??(e.pattern=Wy());Bt.init(t,e)}),ez=ne("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=vj),Bt.init(t,e)}),tz=ne("$ZodURL",(t,e)=>{Bt.init(t,e),t._zod.check=n=>{try{const i=n.value.trim();if(!e.normalize&&e.protocol?.source===Oj.source&&!/^https?:\/\//i.test(i)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!e.abort});return}const o=new URL(i);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=o.href:n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),nz=ne("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=bj()),Bt.init(t,e)}),iz=ne("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=fj),Bt.init(t,e)}),oz=ne("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Ij),Bt.init(t,e)}),rz=ne("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=cj),Bt.init(t,e)}),sz=ne("$ZodULID",(t,e)=>{e.pattern??(e.pattern=dj),Bt.init(t,e)}),gz=ne("$ZodXID",(t,e)=>{e.pattern??(e.pattern=uj),Bt.init(t,e)}),az=ne("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=hj),Bt.init(t,e)}),Az=ne("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=kj(e)),Bt.init(t,e)}),lz=ne("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Mj),Bt.init(t,e)}),Cz=ne("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Rj(e)),Bt.init(t,e)}),Iz=ne("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=pj),Bt.init(t,e)}),cz=ne("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=wj),Bt.init(t,e),t._zod.bag.format="ipv4"}),dz=ne("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=xj),Bt.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}}),uz=ne("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Sj),Bt.init(t,e)}),hz=ne("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Ej),Bt.init(t,e),t._zod.check=n=>{const i=n.value.split("/");try{if(i.length!==2)throw new Error;const[o,s]=i;if(!s)throw new Error;const a=Number(s);if(`${a}`!==s)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function nb(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const fz=ne("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Tj),Bt.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{nb(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function pz(t){if(!Ky.test(t))return!1;const e=t.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return nb(n)}const mz=ne("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ky),Bt.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{pz(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),vz=ne("$ZodE164",(t,e)=>{e.pattern??(e.pattern=Nj),Bt.init(t,e)});function yz(t,e=null){try{const n=t.split(".");if(n.length!==3)return!1;const[i]=n;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}const bz=ne("$ZodJWT",(t,e)=>{Bt.init(t,e),t._zod.check=n=>{yz(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}}),ib=ne("$ZodNumber",(t,e)=>{Gt.init(t,e),t._zod.pattern=t._zod.bag.pattern??qy,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...s?{received:s}:{}}),n}}),wz=ne("$ZodNumberFormat",(t,e)=>{Bj.init(t,e),ib.init(t,e)}),xz=ne("$ZodBoolean",(t,e)=>{Gt.init(t,e),t._zod.pattern=jj,t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),n}}),Sz=ne("$ZodUnknown",(t,e)=>{Gt.init(t,e),t._zod.parse=n=>n}),Ez=ne("$ZodNever",(t,e)=>{Gt.init(t,e),t._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function ob(t,e,n){t.issues.length&&e.issues.push(...pg(n,t.issues)),e.value[n]=t.value}const Tz=ne("$ZodArray",(t,e)=>{Gt.init(t,e),t._zod.parse=(n,i)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),n;n.value=Array(o.length);const s=[];for(let a=0;aob(c,n,a))):ob(C,n,a)}return s.length?Promise.all(s).then(()=>n):n}});function yC(t,e,n,i,o,s){const a=n in i;if(t.issues.length){if(o&&s&&!a)return;e.issues.push(...pg(n,t.issues))}if(!a&&!o){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}t.value===void 0?a&&(e.value[n]=void 0):e.value[n]=t.value}function rb(t){const e=Object.keys(t.shape);for(const i of e)if(!t.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const n=U_(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function sb(t,e,n,i,o,s){const a=[],l=o.keySet,C=o.catchall._zod,c=C.def.type,u=C.optin==="optional",h=C.optout==="optional";for(const m in e){if(m==="__proto__"||l.has(m))continue;if(c==="never"){a.push(m);continue}const v=C.run({value:e[m],issues:[]},i);v instanceof Promise?t.push(v.then(b=>yC(b,n,m,e,u,h))):yC(v,n,m,e,u,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:e,inst:s}),t.length?Promise.all(t).then(()=>n):n}const Oz=ne("$ZodObject",(t,e)=>{if(Gt.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){const l=e.shape;Object.defineProperty(e,"shape",{get:()=>{const C={...l};return Object.defineProperty(e,"shape",{value:C}),C}})}const i=hC(()=>rb(e));yt(t._zod,"propValues",()=>{const l=e.shape,C={};for(const c in l){const u=l[c]._zod;if(u.values){C[c]??(C[c]=new Set);for(const h of u.values)C[c].add(h)}}return C});const o=rA,s=e.catchall;let a;t._zod.parse=(l,C)=>{a??(a=i.value);const c=l.value;if(!o(c))return l.issues.push({expected:"object",code:"invalid_type",input:c,inst:t}),l;l.value={};const u=[],h=a.shape;for(const m of a.keys){const v=h[m],b=v._zod.optin==="optional",x=v._zod.optout==="optional",y=v._zod.run({value:c[m],issues:[]},C);y instanceof Promise?u.push(y.then(S=>yC(S,l,m,c,b,x))):yC(y,l,m,c,b,x)}return s?sb(u,c,l,C,i.value,t):u.length?Promise.all(u).then(()=>l):l}}),Nz=ne("$ZodObjectJIT",(t,e)=>{Oz.init(t,e);const n=t._zod.parse,i=hC(()=>rb(e)),o=m=>{const v=new Xj(["shape","payload","ctx"]),b=i.value,x=O=>{const M=Fy(O);return`shape[${M}]._zod.run({ value: input[${M}], issues: [] }, ctx)`};v.write("const input = payload.value;");const y=Object.create(null);let S=0;for(const O of b.keys)y[O]=`key_${S++}`;v.write("const newResult = {};");for(const O of b.keys){const M=y[O],k=Fy(O),G=m[O],L=G?._zod?.optin==="optional",F=G?._zod?.optout==="optional";v.write(`const ${M} = ${x(O)};`),L&&F?v.write(` @@ -69,7 +69,7 @@ Error generating stack: `+I.message+` `)}v.write("payload.value = newResult;"),v.write("return payload;");const T=v.compile();return(O,M)=>T(m,O,M)};let s;const a=rA,l=!qd.jitless,c=l&&F_.value,u=e.catchall;let h;t._zod.parse=(m,v)=>{h??(h=i.value);const b=m.value;return a(b)?l&&c&&v?.async===!1&&v.jitless!==!0?(s||(s=o(e.shape)),m=s(m,v),u?sb([],b,m,v,h,t):m):n(m,v):(m.issues.push({expected:"object",code:"invalid_type",input:b,inst:t}),m)}});function gb(t,e,n,i){for(const s of t)if(s.issues.length===0)return e.value=s.value,e;const o=t.filter(s=>!fg(s));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(s=>s.issues.map(a=>Do(a,i,ko())))}),e)}const ab=ne("$ZodUnion",(t,e)=>{Gt.init(t,e),yt(t._zod,"optin",()=>e.options.some(i=>i._zod.optin==="optional")?"optional":void 0),yt(t._zod,"optout",()=>e.options.some(i=>i._zod.optout==="optional")?"optional":void 0),yt(t._zod,"values",()=>{if(e.options.every(i=>i._zod.values))return new Set(e.options.flatMap(i=>Array.from(i._zod.values)))}),yt(t._zod,"pattern",()=>{if(e.options.every(i=>i._zod.pattern)){const i=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${i.map(o=>tu(o.source)).join("|")})$`)}});const n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(i,o)=>{if(n)return n(i,o);let s=!1;const a=[];for(const l of e.options){const C=l._zod.run({value:i.value,issues:[]},o);if(C instanceof Promise)a.push(C),s=!0;else{if(C.issues.length===0)return C;a.push(C)}}return s?Promise.all(a).then(l=>gb(l,i,t,o)):gb(a,i,t,o)}}),Mz=ne("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,ab.init(t,e);const n=t._zod.parse;yt(t._zod,"propValues",()=>{const o={};for(const s of e.options){const a=s._zod.propValues;if(!a||Object.keys(a).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(const[l,C]of Object.entries(a)){o[l]||(o[l]=new Set);for(const c of C)o[l].add(c)}}return o});const i=hC(()=>{const o=e.options,s=new Map;for(const a of o){const l=a._zod.propValues?.[e.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(a)}"`);for(const C of l){if(s.has(C))throw new Error(`Duplicate discriminator value "${String(C)}"`);s.set(C,a)}}return s});t._zod.parse=(o,s)=>{const a=o.value;if(!rA(a))return o.issues.push({code:"invalid_type",expected:"object",input:a,inst:t}),o;const l=i.value.get(a?.[e.discriminator]);return l?l._zod.run(o,s):e.unionFallback||s.direction==="backward"?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(i.value.keys()),input:a,path:[e.discriminator],inst:t}),o)}}),Rz=ne("$ZodIntersection",(t,e)=>{Gt.init(t,e),t._zod.parse=(n,i)=>{const o=n.value,s=e.left._zod.run({value:o,issues:[]},i),a=e.right._zod.run({value:o,issues:[]},i);return s instanceof Promise||a instanceof Promise?Promise.all([s,a]).then(([C,c])=>Ab(n,C,c)):Ab(n,s,a)}});function su(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(ug(t)&&ug(e)){const n=Object.keys(e),i=Object.keys(t).filter(s=>n.indexOf(s)!==-1),o={...t,...e};for(const s of i){const a=su(t[s],e[s]);if(!a.valid)return{valid:!1,mergeErrorPath:[s,...a.mergeErrorPath]};o[s]=a.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;il.l&&l.r).map(([l])=>l);if(s.length&&o&&t.issues.push({...o,keys:s}),fg(t))return t;const a=su(e.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return t.value=a.data,t}const kz=ne("$ZodRecord",(t,e)=>{Gt.init(t,e),t._zod.parse=(n,i)=>{const o=n.value;if(!ug(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),n;const s=[],a=e.keyType._zod.values;if(a){n.value={};const l=new Set;for(const c of a)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){l.add(typeof c=="number"?c.toString():c);const u=e.keyType._zod.run({value:c,issues:[]},i);if(u instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(u.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map(v=>Do(v,i,ko())),input:c,path:[c],inst:t});continue}const h=u.value,m=e.valueType._zod.run({value:o[c],issues:[]},i);m instanceof Promise?s.push(m.then(v=>{v.issues.length&&n.issues.push(...pg(c,v.issues)),n.value[h]=v.value})):(m.issues.length&&n.issues.push(...pg(c,m.issues)),n.value[h]=m.value)}let C;for(const c in o)l.has(c)||(C=C??[],C.push(c));C&&C.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:C})}else{n.value={};for(const l of Reflect.ownKeys(o)){if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,l))continue;let C=e.keyType._zod.run({value:l,issues:[]},i);if(C instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&qy.test(l)&&C.issues.length){const h=e.keyType._zod.run({value:Number(l),issues:[]},i);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(C=h)}if(C.issues.length){e.mode==="loose"?n.value[l]=o[l]:n.issues.push({code:"invalid_key",origin:"record",issues:C.issues.map(h=>Do(h,i,ko())),input:l,path:[l],inst:t});continue}const u=e.valueType._zod.run({value:o[l],issues:[]},i);u instanceof Promise?s.push(u.then(h=>{h.issues.length&&n.issues.push(...pg(l,h.issues)),n.value[C.value]=h.value})):(u.issues.length&&n.issues.push(...pg(l,u.issues)),n.value[C.value]=u.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Dz=ne("$ZodEnum",(t,e)=>{Gt.init(t,e);const n=Zy(e.entries),i=new Set(n);t._zod.values=i,t._zod.pattern=new RegExp(`^(${n.filter(o=>V_.has(typeof o)).map(o=>typeof o=="string"?hg(o):o.toString()).join("|")})$`),t._zod.parse=(o,s)=>{const a=o.value;return i.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:t}),o}}),_z=ne("$ZodLiteral",(t,e)=>{if(Gt.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(i=>typeof i=="string"?hg(i):i?hg(i.toString()):String(i)).join("|")})$`),t._zod.parse=(i,o)=>{const s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),i}}),jz=ne("$ZodTransform",(t,e)=>{Gt.init(t,e),t._zod.optin="optional",t._zod.parse=(n,i)=>{if(i.direction==="backward")throw new By(t.constructor.name);const o=e.transform(n.value,n);if(i.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n.fallback=!0,n));if(o instanceof Promise)throw new dg;return n.value=o,n.fallback=!0,n}});function lb(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const Cb=ne("$ZodOptional",(t,e)=>{Gt.init(t,e),t._zod.optin="optional",t._zod.optout="optional",yt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),yt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${tu(n.source)})?$`):void 0}),t._zod.parse=(n,i)=>{if(e.innerType._zod.optin==="optional"){const o=n.value,s=e.innerType._zod.run(n,i);return s instanceof Promise?s.then(a=>lb(a,o)):lb(s,o)}return n.value===void 0?n:e.innerType._zod.run(n,i)}}),zz=ne("$ZodExactOptional",(t,e)=>{Cb.init(t,e),yt(t._zod,"values",()=>e.innerType._zod.values),yt(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,i)=>e.innerType._zod.run(n,i)}),Pz=ne("$ZodNullable",(t,e)=>{Gt.init(t,e),yt(t._zod,"optin",()=>e.innerType._zod.optin),yt(t._zod,"optout",()=>e.innerType._zod.optout),yt(t._zod,"pattern",()=>{const n=e.innerType._zod.pattern;return n?new RegExp(`^(${tu(n.source)}|null)$`):void 0}),yt(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,i)=>n.value===null?n:e.innerType._zod.run(n,i)}),Lz=ne("$ZodDefault",(t,e)=>{Gt.init(t,e),t._zod.optin="optional",yt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,i)=>{if(i.direction==="backward")return e.innerType._zod.run(n,i);if(n.value===void 0)return n.value=e.defaultValue,n;const o=e.innerType._zod.run(n,i);return o instanceof Promise?o.then(s=>Ib(s,e)):Ib(o,e)}});function Ib(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const Bz=ne("$ZodPrefault",(t,e)=>{Gt.init(t,e),t._zod.optin="optional",yt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,i))}),Zz=ne("$ZodNonOptional",(t,e)=>{Gt.init(t,e),yt(t._zod,"values",()=>{const n=e.innerType._zod.values;return n?new Set([...n].filter(i=>i!==void 0)):void 0}),t._zod.parse=(n,i)=>{const o=e.innerType._zod.run(n,i);return o instanceof Promise?o.then(s=>cb(s,t)):cb(o,t)}});function cb(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const Gz=ne("$ZodCatch",(t,e)=>{Gt.init(t,e),t._zod.optin="optional",yt(t._zod,"optout",()=>e.innerType._zod.optout),yt(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,i)=>{if(i.direction==="backward")return e.innerType._zod.run(n,i);const o=e.innerType._zod.run(n,i);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(a=>Do(a,i,ko()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=e.catchValue({...n,error:{issues:o.issues.map(s=>Do(s,i,ko()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Fz=ne("$ZodPipe",(t,e)=>{Gt.init(t,e),yt(t._zod,"values",()=>e.in._zod.values),yt(t._zod,"optin",()=>e.in._zod.optin),yt(t._zod,"optout",()=>e.out._zod.optout),yt(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,i)=>{if(i.direction==="backward"){const s=e.out._zod.run(n,i);return s instanceof Promise?s.then(a=>bC(a,e.in,i)):bC(s,e.in,i)}const o=e.in._zod.run(n,i);return o instanceof Promise?o.then(s=>bC(s,e.out,i)):bC(o,e.out,i)}});function bC(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},n)}const Vz=ne("$ZodReadonly",(t,e)=>{Gt.init(t,e),yt(t._zod,"propValues",()=>e.innerType._zod.propValues),yt(t._zod,"values",()=>e.innerType._zod.values),yt(t._zod,"optin",()=>e.innerType?._zod?.optin),yt(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(n,i)=>{if(i.direction==="backward")return e.innerType._zod.run(n,i);const o=e.innerType._zod.run(n,i);return o instanceof Promise?o.then(db):db(o)}});function db(t){return t.value=Object.freeze(t.value),t}const Uz=ne("$ZodCustom",(t,e)=>{ii.init(t,e),Gt.init(t,e),t._zod.parse=(n,i)=>n,t._zod.check=n=>{const i=n.value,o=e.fn(i);if(o instanceof Promise)return o.then(s=>ub(s,n,i,t));ub(o,n,i,t)}});function ub(t,e,n,i){if(!t){const o={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(o.params=i._zod.def.params),e.issues.push(sA(o))}}var hb;class Hz{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){const i=n[0];return this._map.set(e,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){const n=e._zod.parent;if(n){const i={...this.get(n)??{}};delete i.id;const o={...i,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Yz(){return new Hz}(hb=globalThis).__zod_globalRegistry??(hb.__zod_globalRegistry=Yz());const gA=globalThis.__zod_globalRegistry;function $z(t,e){return new t({type:"string",...Pe(e)})}function Wz(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...Pe(e)})}function fb(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...Pe(e)})}function Kz(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...Pe(e)})}function Xz(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Pe(e)})}function Qz(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Pe(e)})}function qz(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Pe(e)})}function Jz(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...Pe(e)})}function e3(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...Pe(e)})}function t3(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...Pe(e)})}function n3(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...Pe(e)})}function i3(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...Pe(e)})}function o3(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...Pe(e)})}function r3(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...Pe(e)})}function s3(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...Pe(e)})}function g3(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...Pe(e)})}function a3(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...Pe(e)})}function A3(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Pe(e)})}function l3(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Pe(e)})}function C3(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...Pe(e)})}function I3(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...Pe(e)})}function c3(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...Pe(e)})}function d3(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...Pe(e)})}function u3(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Pe(e)})}function h3(t,e){return new t({type:"string",format:"date",check:"string_format",...Pe(e)})}function f3(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...Pe(e)})}function p3(t,e){return new t({type:"string",format:"duration",check:"string_format",...Pe(e)})}function m3(t,e){return new t({type:"number",checks:[],...Pe(e)})}function v3(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...Pe(e)})}function y3(t,e){return new t({type:"boolean",...Pe(e)})}function b3(t){return new t({type:"unknown"})}function w3(t,e){return new t({type:"never",...Pe(e)})}function pb(t,e){return new eb({check:"less_than",...Pe(e),value:t,inclusive:!1})}function gu(t,e){return new eb({check:"less_than",...Pe(e),value:t,inclusive:!0})}function mb(t,e){return new tb({check:"greater_than",...Pe(e),value:t,inclusive:!1})}function au(t,e){return new tb({check:"greater_than",...Pe(e),value:t,inclusive:!0})}function vb(t,e){return new Lj({check:"multiple_of",...Pe(e),value:t})}function yb(t,e){return new Zj({check:"max_length",...Pe(e),maximum:t})}function wC(t,e){return new Gj({check:"min_length",...Pe(e),minimum:t})}function bb(t,e){return new Fj({check:"length_equals",...Pe(e),length:t})}function x3(t,e){return new Vj({check:"string_format",format:"regex",...Pe(e),pattern:t})}function S3(t){return new Uj({check:"string_format",format:"lowercase",...Pe(t)})}function E3(t){return new Hj({check:"string_format",format:"uppercase",...Pe(t)})}function T3(t,e){return new Yj({check:"string_format",format:"includes",...Pe(e),includes:t})}function O3(t,e){return new $j({check:"string_format",format:"starts_with",...Pe(e),prefix:t})}function N3(t,e){return new Wj({check:"string_format",format:"ends_with",...Pe(e),suffix:t})}function mg(t){return new Kj({check:"overwrite",tx:t})}function M3(t){return mg(e=>e.normalize(t))}function R3(){return mg(t=>t.trim())}function k3(){return mg(t=>t.toLowerCase())}function D3(){return mg(t=>t.toUpperCase())}function _3(){return mg(t=>G_(t))}function j3(t,e,n){return new t({type:"array",element:e,...Pe(n)})}function z3(t,e,n){return new t({type:"custom",check:"custom",fn:e,...Pe(n)})}function P3(t,e){const n=L3(i=>(i.addIssue=o=>{if(typeof o=="string")i.issues.push(sA(o,i.value,n._zod.def));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=i.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),i.issues.push(sA(s))}},t(i.value,i)),e);return n}function L3(t,e){const n=new ii({check:"custom",...Pe(e)});return n._zod.check=t,n}function wb(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??gA,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function ln(t,e,n={path:[],schemaPath:[]}){var i;const o=t._zod.def,s=e.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,a);const l=t._zod.toJSONSchema?.();if(l)a.schema=l;else{const u={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,a.schema,u);else{const m=a.schema,v=e.processors[o.type];if(!v)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);v(t,e,m,u)}const h=t._zod.parent;h&&(a.ref||(a.ref=h),ln(h,e,u),e.seen.get(h).isParent=!0)}const C=e.metadataRegistry.get(t);return C&&Object.assign(a.schema,C),e.io==="input"&&Hn(t)&&(delete a.schema.examples,delete a.schema.default),e.io==="input"&&"_prefault"in a.schema&&((i=a.schema).default??(i.default=a.schema._prefault)),delete a.schema._prefault,e.seen.get(t).schema}function xb(t,e){const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const a of t.seen.entries()){const l=t.metadataRegistry.get(a[0])?.id;if(l){const C=i.get(l);if(C&&C!==a[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(l,a[0])}}const o=a=>{const l=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const h=t.external.registry.get(a[0])?.id,m=t.external.uri??(b=>b);if(h)return{ref:m(h)};const v=a[1].defId??a[1].schema.id??`schema${t.counter++}`;return a[1].defId=v,{defId:v,ref:`${m("__shared")}#/${l}/${v}`}}if(a[1]===n)return{ref:"#"};const c=`#/${l}/`,u=a[1].schema.id??`__schema${t.counter++}`;return{defId:u,ref:c+u}},s=a=>{if(a[1].schema.$ref)return;const l=a[1],{ref:C,defId:c}=o(a);l.def={...l.schema},c&&(l.defId=c);const u=l.schema;for(const h in u)delete u[h];u.$ref=C};if(t.cycles==="throw")for(const a of t.seen.entries()){const l=a[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/ -Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of t.seen.entries()){const l=a[1];if(e===a[0]){s(a);continue}if(t.external){const c=t.external.registry.get(a[0])?.id;if(e!==a[0]&&c){s(a);continue}}if(t.metadataRegistry.get(a[0])?.id){s(a);continue}if(l.cycle){s(a);continue}if(l.count>1&&t.reused==="ref"){s(a);continue}}}function Sb(t,e){const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=l=>{const C=t.seen.get(l);if(C.ref===null)return;const c=C.def??C.schema,u={...c},h=C.ref;if(C.ref=null,h){i(h);const v=t.seen.get(h),b=v.schema;if(b.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(b)):Object.assign(c,b),Object.assign(c,u),l._zod.parent===h)for(const y in c)y==="$ref"||y==="allOf"||y in u||delete c[y];if(b.$ref&&v.def)for(const y in c)y==="$ref"||y==="allOf"||y in v.def&&JSON.stringify(c[y])===JSON.stringify(v.def[y])&&delete c[y]}const m=l._zod.parent;if(m&&m!==h){i(m);const v=t.seen.get(m);if(v?.schema.$ref&&(c.$ref=v.schema.$ref,v.def))for(const b in c)b==="$ref"||b==="allOf"||b in v.def&&JSON.stringify(c[b])===JSON.stringify(v.def[b])&&delete c[b]}t.override({zodSchema:l,jsonSchema:c,path:C.path??[]})};for(const l of[...t.seen.entries()].reverse())i(l[0]);const o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const l=t.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(l)}Object.assign(o,n.def??n.schema);const s=t.metadataRegistry.get(e)?.id;s!==void 0&&o.id===s&&delete o.id;const a=t.external?.defs??{};for(const l of t.seen.entries()){const C=l[1];C.def&&C.defId&&(C.def.id===C.defId&&delete C.def.id,a[C.defId]=C.def)}t.external||Object.keys(a).length>0&&(t.target==="draft-2020-12"?o.$defs=a:o.definitions=a);try{const l=JSON.parse(JSON.stringify(o));return Object.defineProperty(l,"~standard",{value:{...e["~standard"],jsonSchema:{input:xC(e,"input",t.processors),output:xC(e,"output",t.processors)}},enumerable:!1,writable:!1}),l}catch{throw new Error("Error converting schema to JSON.")}}function Hn(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const i=t._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Hn(i.element,n);if(i.type==="set")return Hn(i.valueType,n);if(i.type==="lazy")return Hn(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return Hn(i.innerType,n);if(i.type==="intersection")return Hn(i.left,n)||Hn(i.right,n);if(i.type==="record"||i.type==="map")return Hn(i.keyType,n)||Hn(i.valueType,n);if(i.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Hn(i.in,n)||Hn(i.out,n);if(i.type==="object"){for(const o in i.shape)if(Hn(i.shape[o],n))return!0;return!1}if(i.type==="union"){for(const o of i.options)if(Hn(o,n))return!0;return!1}if(i.type==="tuple"){for(const o of i.items)if(Hn(o,n))return!0;return!!(i.rest&&Hn(i.rest,n))}return!1}const B3=(t,e={})=>n=>{const i=wb({...n,processors:e});return ln(t,i),xb(i,t),Sb(i,t)},xC=(t,e,n={})=>i=>{const{libraryOptions:o,target:s}=i??{},a=wb({...o??{},target:s,io:e,processors:n});return ln(t,a),xb(a,t),Sb(a,t)},Z3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},G3=(t,e,n,i)=>{const o=n;o.type="string";const{minimum:s,maximum:a,format:l,patterns:C,contentEncoding:c}=t._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),l&&(o.format=Z3[l]??l,o.format===""&&delete o.format,l==="time"&&delete o.format),c&&(o.contentEncoding=c),C&&C.size>0){const u=[...C];u.length===1?o.pattern=u[0].source:u.length>1&&(o.allOf=[...u.map(h=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},F3=(t,e,n,i)=>{const o=n,{minimum:s,maximum:a,format:l,multipleOf:C,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;typeof l=="string"&&l.includes("int")?o.type="integer":o.type="number";const h=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(a??Number.POSITIVE_INFINITY),v=e.target==="draft-04"||e.target==="openapi-3.0";h?v?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof s=="number"&&(o.minimum=s),m?v?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof a=="number"&&(o.maximum=a),typeof C=="number"&&(o.multipleOf=C)},V3=(t,e,n,i)=>{n.type="boolean"},U3=(t,e,n,i)=>{n.not={}},H3=(t,e,n,i)=>{},Y3=(t,e,n,i)=>{const o=t._zod.def,s=Zy(o.entries);s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),n.enum=s},$3=(t,e,n,i)=>{const o=t._zod.def,s=[];for(const a of o.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];n.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[a]:n.const=a}else s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),s.every(a=>typeof a=="boolean")&&(n.type="boolean"),s.every(a=>a===null)&&(n.type="null"),n.enum=s},W3=(t,e,n,i)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},K3=(t,e,n,i)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},X3=(t,e,n,i)=>{const o=n,s=t._zod.def,{minimum:a,maximum:l}=t._zod.bag;typeof a=="number"&&(o.minItems=a),typeof l=="number"&&(o.maxItems=l),o.type="array",o.items=ln(s.element,e,{...i,path:[...i.path,"items"]})},Q3=(t,e,n,i)=>{const o=n,s=t._zod.def;o.type="object",o.properties={};const a=s.shape;for(const c in a)o.properties[c]=ln(a[c],e,{...i,path:[...i.path,"properties",c]});const l=new Set(Object.keys(a)),C=new Set([...l].filter(c=>{const u=s.shape[c]._zod;return e.io==="input"?u.optin===void 0:u.optout===void 0}));C.size>0&&(o.required=Array.from(C)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=ln(s.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},q3=(t,e,n,i)=>{const o=t._zod.def,s=o.inclusive===!1,a=o.options.map((l,C)=>ln(l,e,{...i,path:[...i.path,s?"oneOf":"anyOf",C]}));s?n.oneOf=a:n.anyOf=a},J3=(t,e,n,i)=>{const o=t._zod.def,s=ln(o.left,e,{...i,path:[...i.path,"allOf",0]}),a=ln(o.right,e,{...i,path:[...i.path,"allOf",1]}),l=c=>"allOf"in c&&Object.keys(c).length===1,C=[...l(s)?s.allOf:[s],...l(a)?a.allOf:[a]];n.allOf=C},e5=(t,e,n,i)=>{const o=n,s=t._zod.def;o.type="object";const a=s.keyType,C=a._zod.bag?.patterns;if(s.mode==="loose"&&C&&C.size>0){const u=ln(s.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});o.patternProperties={};for(const h of C)o.patternProperties[h.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=ln(s.keyType,e,{...i,path:[...i.path,"propertyNames"]})),o.additionalProperties=ln(s.valueType,e,{...i,path:[...i.path,"additionalProperties"]});const c=a._zod.values;if(c){const u=[...c].filter(h=>typeof h=="string"||typeof h=="number");u.length>0&&(o.required=u)}},t5=(t,e,n,i)=>{const o=t._zod.def,s=ln(o.innerType,e,i),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},n5=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType},i5=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},o5=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},r5=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},s5=(t,e,n,i)=>{const o=t._zod.def,s=o.in._zod.traits.has("$ZodTransform"),a=e.io==="input"?s?o.out:o.in:o.out;ln(a,e,i);const l=e.seen.get(t);l.ref=a},g5=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType,n.readOnly=!0},Eb=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType},a5=ne("ZodISODateTime",(t,e)=>{Az.init(t,e),Vt.init(t,e)});function A5(t){return u3(a5,t)}const l5=ne("ZodISODate",(t,e)=>{lz.init(t,e),Vt.init(t,e)});function C5(t){return h3(l5,t)}const I5=ne("ZodISOTime",(t,e)=>{Cz.init(t,e),Vt.init(t,e)});function c5(t){return f3(I5,t)}const d5=ne("ZodISODuration",(t,e)=>{Iz.init(t,e),Vt.init(t,e)});function u5(t){return p3(d5,t)}const Oi=ne("ZodError",(t,e)=>{Yy.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>tj(t,n)},flatten:{value:n=>ej(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,Jd,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,Jd,2)}},isEmpty:{get(){return t.issues.length===0}}})},{Parent:Error}),h5=iu(Oi),f5=ou(Oi),p5=pC(Oi),m5=mC(Oi),v5=oj(Oi),y5=rj(Oi),b5=sj(Oi),w5=gj(Oi),x5=aj(Oi),S5=Aj(Oi),E5=lj(Oi),T5=Cj(Oi),Tb=new WeakMap;function aA(t,e,n){const i=Object.getPrototypeOf(t);let o=Tb.get(i);if(o||(o=new Set,Tb.set(i,o)),!o.has(e)){o.add(e);for(const s in n){const a=n[s];Object.defineProperty(i,s,{configurable:!0,enumerable:!1,get(){const l=a.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:l}),l},set(l){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:l})}})}}}const Ft=ne("ZodType",(t,e)=>(Gt.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:xC(t,"input"),output:xC(t,"output")}}),t.toJSONSchema=B3(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,i)=>h5(t,n,i,{callee:t.parse}),t.safeParse=(n,i)=>p5(t,n,i),t.parseAsync=async(n,i)=>f5(t,n,i,{callee:t.parseAsync}),t.safeParseAsync=async(n,i)=>m5(t,n,i),t.spa=t.safeParseAsync,t.encode=(n,i)=>v5(t,n,i),t.decode=(n,i)=>y5(t,n,i),t.encodeAsync=async(n,i)=>b5(t,n,i),t.decodeAsync=async(n,i)=>w5(t,n,i),t.safeEncode=(n,i)=>x5(t,n,i),t.safeDecode=(n,i)=>S5(t,n,i),t.safeEncodeAsync=async(n,i)=>E5(t,n,i),t.safeDecodeAsync=async(n,i)=>T5(t,n,i),aA(t,"ZodType",{check(...n){const i=this.def;return this.clone(mr(i,{checks:[...i.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return vr(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(fP(n,i))},superRefine(n,i){return this.check(pP(n,i))},overwrite(n){return this.check(mg(n))},optional(){return Lb(this)},exactOptional(){return oP(this)},nullable(){return Bb(this)},nullish(){return Lb(Bb(this))},nonoptional(n){return lP(this,n)},array(){return Re(this)},or(n){return jb([this,n])},and(n){return J5(this,n)},transform(n){return Gb(this,nP(n))},default(n){return gP(this,n)},prefault(n){return AP(this,n)},catch(n){return IP(this,n)},pipe(n){return Gb(this,n)},readonly(){return uP(this)},describe(n){const i=this.clone();return gA.add(i,{description:n}),i},meta(...n){if(n.length===0)return gA.get(this);const i=this.clone();return gA.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(t,"description",{get(){return gA.get(t)?.description},configurable:!0}),t)),Ob=ne("_ZodString",(t,e)=>{ru.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(i,o,s)=>G3(t,i,o);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,aA(t,"_ZodString",{regex(...i){return this.check(x3(...i))},includes(...i){return this.check(T3(...i))},startsWith(...i){return this.check(O3(...i))},endsWith(...i){return this.check(N3(...i))},min(...i){return this.check(wC(...i))},max(...i){return this.check(yb(...i))},length(...i){return this.check(bb(...i))},nonempty(...i){return this.check(wC(1,...i))},lowercase(i){return this.check(S3(i))},uppercase(i){return this.check(E3(i))},trim(){return this.check(R3())},normalize(...i){return this.check(M3(...i))},toLowerCase(){return this.check(k3())},toUpperCase(){return this.check(D3())},slugify(){return this.check(_3())}})}),O5=ne("ZodString",(t,e)=>{ru.init(t,e),Ob.init(t,e),t.email=n=>t.check(Wz(N5,n)),t.url=n=>t.check(Jz(M5,n)),t.jwt=n=>t.check(d3(H5,n)),t.emoji=n=>t.check(e3(R5,n)),t.guid=n=>t.check(fb(Nb,n)),t.uuid=n=>t.check(Kz(SC,n)),t.uuidv4=n=>t.check(Xz(SC,n)),t.uuidv6=n=>t.check(Qz(SC,n)),t.uuidv7=n=>t.check(qz(SC,n)),t.nanoid=n=>t.check(t3(k5,n)),t.guid=n=>t.check(fb(Nb,n)),t.cuid=n=>t.check(n3(D5,n)),t.cuid2=n=>t.check(i3(_5,n)),t.ulid=n=>t.check(o3(j5,n)),t.base64=n=>t.check(C3(F5,n)),t.base64url=n=>t.check(I3(V5,n)),t.xid=n=>t.check(r3(z5,n)),t.ksuid=n=>t.check(s3(P5,n)),t.ipv4=n=>t.check(g3(L5,n)),t.ipv6=n=>t.check(a3(B5,n)),t.cidrv4=n=>t.check(A3(Z5,n)),t.cidrv6=n=>t.check(l3(G5,n)),t.e164=n=>t.check(c3(U5,n)),t.datetime=n=>t.check(A5(n)),t.date=n=>t.check(C5(n)),t.time=n=>t.check(c5(n)),t.duration=n=>t.check(u5(n))});function j(t){return $z(O5,t)}const Vt=ne("ZodStringFormat",(t,e)=>{Bt.init(t,e),Ob.init(t,e)}),N5=ne("ZodEmail",(t,e)=>{ez.init(t,e),Vt.init(t,e)}),Nb=ne("ZodGUID",(t,e)=>{qj.init(t,e),Vt.init(t,e)}),SC=ne("ZodUUID",(t,e)=>{Jj.init(t,e),Vt.init(t,e)}),M5=ne("ZodURL",(t,e)=>{tz.init(t,e),Vt.init(t,e)}),R5=ne("ZodEmoji",(t,e)=>{nz.init(t,e),Vt.init(t,e)}),k5=ne("ZodNanoID",(t,e)=>{iz.init(t,e),Vt.init(t,e)}),D5=ne("ZodCUID",(t,e)=>{oz.init(t,e),Vt.init(t,e)}),_5=ne("ZodCUID2",(t,e)=>{rz.init(t,e),Vt.init(t,e)}),j5=ne("ZodULID",(t,e)=>{sz.init(t,e),Vt.init(t,e)}),z5=ne("ZodXID",(t,e)=>{gz.init(t,e),Vt.init(t,e)}),P5=ne("ZodKSUID",(t,e)=>{az.init(t,e),Vt.init(t,e)}),L5=ne("ZodIPv4",(t,e)=>{cz.init(t,e),Vt.init(t,e)}),B5=ne("ZodIPv6",(t,e)=>{dz.init(t,e),Vt.init(t,e)}),Z5=ne("ZodCIDRv4",(t,e)=>{uz.init(t,e),Vt.init(t,e)}),G5=ne("ZodCIDRv6",(t,e)=>{hz.init(t,e),Vt.init(t,e)}),F5=ne("ZodBase64",(t,e)=>{fz.init(t,e),Vt.init(t,e)}),V5=ne("ZodBase64URL",(t,e)=>{mz.init(t,e),Vt.init(t,e)}),U5=ne("ZodE164",(t,e)=>{vz.init(t,e),Vt.init(t,e)}),H5=ne("ZodJWT",(t,e)=>{bz.init(t,e),Vt.init(t,e)}),Mb=ne("ZodNumber",(t,e)=>{ib.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(i,o,s)=>F3(t,i,o),aA(t,"ZodNumber",{gt(i,o){return this.check(mb(i,o))},gte(i,o){return this.check(au(i,o))},min(i,o){return this.check(au(i,o))},lt(i,o){return this.check(pb(i,o))},lte(i,o){return this.check(gu(i,o))},max(i,o){return this.check(gu(i,o))},int(i){return this.check(Rb(i))},safe(i){return this.check(Rb(i))},positive(i){return this.check(mb(0,i))},nonnegative(i){return this.check(au(0,i))},negative(i){return this.check(pb(0,i))},nonpositive(i){return this.check(gu(0,i))},multipleOf(i,o){return this.check(vb(i,o))},step(i,o){return this.check(vb(i,o))},finite(){return this}});const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function Z(t){return m3(Mb,t)}const Y5=ne("ZodNumberFormat",(t,e)=>{wz.init(t,e),Mb.init(t,e)});function Rb(t){return v3(Y5,t)}const $5=ne("ZodBoolean",(t,e)=>{xz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>V3(t,n,i)});function Yt(t){return y3($5,t)}const W5=ne("ZodUnknown",(t,e)=>{Sz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>H3()});function _o(){return b3(W5)}const K5=ne("ZodNever",(t,e)=>{Ez.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>U3(t,n,i)});function kb(t){return w3(K5,t)}const X5=ne("ZodArray",(t,e)=>{Tz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>X3(t,n,i,o),t.element=e.element,aA(t,"ZodArray",{min(n,i){return this.check(wC(n,i))},nonempty(n){return this.check(wC(1,n))},max(n,i){return this.check(yb(n,i))},length(n,i){return this.check(bb(n,i))},unwrap(){return this.element}})});function Re(t,e){return j3(X5,t,e)}const Db=ne("ZodObject",(t,e)=>{Nz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>Q3(t,n,i,o),yt(t,"shape",()=>e.shape),aA(t,"ZodObject",{keyof(){return Ue(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:_o()})},loose(){return this.clone({...this._zod.def,catchall:_o()})},strict(){return this.clone({...this._zod.def,catchall:kb()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return W_(this,n)},safeExtend(n){return K_(this,n)},merge(n){return X_(this,n)},pick(n){return Y_(this,n)},omit(n){return $_(this,n)},partial(...n){return Q_(Pb,this,n[0])},required(...n){return q_(Zb,this,n[0])}})});function Je(t,e){const n={type:"object",shape:t??{},...Pe(e)};return new Db(n)}function ye(t,e){return new Db({type:"object",shape:t,catchall:kb(),...Pe(e)})}const _b=ne("ZodUnion",(t,e)=>{ab.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>q3(t,n,i,o),t.options=e.options});function jb(t,e){return new _b({type:"union",options:t,...Pe(e)})}const Q5=ne("ZodDiscriminatedUnion",(t,e)=>{_b.init(t,e),Mz.init(t,e)});function AA(t,e,n){return new Q5({type:"union",options:e,discriminator:t,...Pe(n)})}const q5=ne("ZodIntersection",(t,e)=>{Rz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>J3(t,n,i,o)});function J5(t,e){return new q5({type:"intersection",left:t,right:e})}const zb=ne("ZodRecord",(t,e)=>{kz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>e5(t,n,i,o),t.keyType=e.keyType,t.valueType=e.valueType});function lA(t,e,n){return!e||!e._zod?new zb({type:"record",keyType:j(),valueType:t,...Pe(e)}):new zb({type:"record",keyType:t,valueType:e,...Pe(n)})}const Au=ne("ZodEnum",(t,e)=>{Dz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(i,o,s)=>Y3(t,i,o),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(i,o)=>{const s={};for(const a of i)if(n.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Au({...e,checks:[],...Pe(o),entries:s})},t.exclude=(i,o)=>{const s={...e.entries};for(const a of i)if(n.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new Au({...e,checks:[],...Pe(o),entries:s})}});function Ue(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new Au({type:"enum",entries:n,...Pe(e)})}const eP=ne("ZodLiteral",(t,e)=>{_z.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>$3(t,n,i),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function nt(t,e){return new eP({type:"literal",values:Array.isArray(t)?t:[t],...Pe(e)})}const tP=ne("ZodTransform",(t,e)=>{jz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>K3(t,n),t._zod.parse=(n,i)=>{if(i.direction==="backward")throw new By(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(sA(s,n.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=t),n.issues.push(sA(a))}};const o=e.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function nP(t){return new tP({type:"transform",transform:t})}const Pb=ne("ZodOptional",(t,e)=>{Cb.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>Eb(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function Lb(t){return new Pb({type:"optional",innerType:t})}const iP=ne("ZodExactOptional",(t,e)=>{zz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>Eb(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function oP(t){return new iP({type:"optional",innerType:t})}const rP=ne("ZodNullable",(t,e)=>{Pz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>t5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function Bb(t){return new rP({type:"nullable",innerType:t})}const sP=ne("ZodDefault",(t,e)=>{Lz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>i5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function gP(t,e){return new sP({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Uy(e)}})}const aP=ne("ZodPrefault",(t,e)=>{Bz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>o5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function AP(t,e){return new aP({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Uy(e)}})}const Zb=ne("ZodNonOptional",(t,e)=>{Zz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>n5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function lP(t,e){return new Zb({type:"nonoptional",innerType:t,...Pe(e)})}const CP=ne("ZodCatch",(t,e)=>{Gz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>r5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function IP(t,e){return new CP({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const cP=ne("ZodPipe",(t,e)=>{Fz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>s5(t,n,i,o),t.in=e.in,t.out=e.out});function Gb(t,e){return new cP({type:"pipe",in:t,out:e})}const dP=ne("ZodReadonly",(t,e)=>{Vz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>g5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function uP(t){return new dP({type:"readonly",innerType:t})}const hP=ne("ZodCustom",(t,e)=>{Uz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>W3(t,n)});function fP(t,e={}){return z3(hP,t,e)}function pP(t,e){return P3(t,e)}const mP="compass.query/1",vP=["file","module","package","namespace","class","struct","interface","trait","protocol","enum","enum_member","type_alias","function","method","constructor","property","field","variable","constant","parameter","import","export","macro","annotation","route","component","event","message","topic","queue","job","resource","schema","query","migration","config_key","database","database_schema","database_table","database_view","database_column","database_index","database_constraint","database_procedure","database_trigger"],yP=["contains","calls","imports","exports","extends","implements","references","type_of","returns","instantiates","overrides","decorates","routes_to","reads","writes","aliases","registers","handles","publishes","subscribes","produces","consumes","schedules","triggers","tests","depends_on","documents","maps_to","renders"],bP=["controller","route_handler","middleware","service","resolver","consumer","producer","subscriber","repository","model","test","fixture","generated","ui_component","hook","client_boundary","client_component","server_component","server_function","data_loader"],wP=["search","callers","callees","impact","explore","node_trail"],xP=["middleware","dependency","security","layout","template","loading","default","error_boundary","not_found","boundary","loader","action","handler","data_loader","route_component"],lu=j().min(1).refine(t=>t.includes("\\")||t.startsWith("/")||/^[A-Za-z]:/.test(t)?!1:t.split("/").every(e=>e!==""&&e!=="."&&e!==".."),"source path must be a safe repository-relative path"),vg=ye({file:lu,startByte:Z().int().nonnegative(),endByte:Z().int().nonnegative(),startLine:Z().int().positive(),startColumn:Z().int().nonnegative(),endLine:Z().int().positive(),endColumn:Z().int().nonnegative()}).refine(t=>t.endByte>=t.startByte&&(t.endLine>t.startLine||t.endLine===t.startLine&&t.endColumn>=t.startColumn),"source anchor must be ordered"),SP=Ue(vP),EP=Ue(yP),TP=Ue(bP),OP=Ue(wP),NP=Ue(["structural_graph","program_ir"]),MP=Ue(["ast","config","convention","artifact","heuristic"]),Cu=Ue(["exact","inferred","ambiguous"]),EC=Ue(["exact","ambiguous","unresolved"]),Fb=ye({nodeId:j().min(1),reason:j().min(1),confidence:Cu,score:Z().finite().nullable().optional(),anchor:vg.nullable().optional()}),TC=ye({layer:NP,origin:MP,extractor:j().min(1),confidence:Cu,anchor:vg.nullable(),rule:j().min(1).nullable(),wiringSite:vg.nullable(),resolution:EC,candidates:Re(Fb).max(20).default([])}),RP=ye({type:nt("file"),data:ye({contentDigest:j().min(1),byteSize:Z().int().nonnegative(),generated:Yt()})}),kP=ye({type:nt("symbol"),data:ye({signature:j().nullable().optional(),modifiers:Re(j()).default([]),overloadDiscriminator:j().nullable().optional(),declaringType:j().nullable().optional(),signatureDigest:j().nullable().optional(),implementationDigest:j().nullable().optional(),sourceDigest:j().nullable().optional()})}),DP=ye({type:nt("import_export"),data:ye({specifier:j(),importedName:j().nullable().optional(),localName:j().nullable().optional(),typeOnly:Yt()})}),Vb=Ue(xP),_P=ye({stage:Vb,position:Z().int().nonnegative(),reference:j().min(1),resolution:EC,sourceAnchor:vg.nullable(),target:j().nullable().optional(),candidates:Re(Fb).max(20).default([])}),jP=ye({type:nt("route"),data:ye({operation:j(),path:j(),originalPath:j().nullable().optional(),declaringScope:j(),resolution:EC,middlewareCount:Z().int().nonnegative(),stages:Re(_P).max(256).default([])})}),zP=ye({type:nt("component"),data:ye({componentType:j()})}),PP=ye({type:nt("resource"),data:ye({resourceKind:Ue(["document","paper","image","concept","rationale"]),uri:j().nullable().optional(),mediaType:j().nullable().optional()})}),LP=ye({type:nt("messaging"),data:ye({transport:j(),subject:j(),declaringScope:j()})}),BP=ye({type:nt("job"),data:ye({schedule:j().nullable().optional(),queue:j().nullable().optional()})}),ZP=ye({type:nt("schema"),data:ye({dialect:j().nullable().optional(),logicalDatabase:j().nullable().optional(),namespace:j().nullable().optional()})}),GP=ye({type:nt("query"),data:ye({dialect:j().nullable().optional(),operation:j().nullable().optional(),textDigest:j().nullable().optional()})}),FP=ye({type:nt("config"),data:ye({format:j(),keyPath:j()})}),VP=ye({type:nt("database"),data:ye({logicalDatabase:j(),databaseSchema:j().nullable().optional()})}),UP=AA("type",[RP,kP,DP,jP,zP,PP,LP,BP,ZP,GP,FP,VP]),HP=ye({type:nt("call"),data:ye({dispatch:Ue(["static","virtual","dynamic"]),receiverType:j().nullable().optional(),argumentCount:Z().int().nonnegative().nullable().optional()})}),YP=ye({type:nt("route"),data:ye({stage:Vb,position:Z().int().nonnegative().nullable().optional(),operation:j().nullable().optional()})}),$P=ye({type:nt("messaging"),data:ye({transport:j(),subject:j()})}),WP=ye({type:nt("schedule"),data:ye({expression:j().nullable().optional()})}),KP=ye({type:nt("mapping"),data:ye({mappingKind:j()})}),XP=ye({type:nt("render"),data:ye({renderKind:Ue(["jsx","create_element","root","lazy","dynamic"]),boundary:j().nullable().optional()})}),Ub=AA("type",[HP,YP,$P,WP,KP,XP]),QP=ye({maxDepth:Z().int().positive(),maxNodes:Z().int().positive(),maxEdges:Z().int().positive(),maxPaths:Z().int().positive(),maxCandidates:Z().int().positive(),maxSourceBytes:Z().int().positive(),maxResponseBytes:Z().int().positive()}),qP=ye({nodeId:j().min(1),score:Z().finite(),matchedFields:Re(j())}),JP=ye({id:j().min(1),kind:SP,roles:Re(TP),name:j().min(1),qualifiedName:j().min(1),language:j().nullable(),framework:j().nullable(),source:vg.nullable(),details:UP.nullable(),evidence:Re(TC)}),eL=ye({id:j().min(1),source:j().min(1),target:j().min(1),kind:EP,relationshipSite:vg.nullable(),details:Ub.nullable(),evidence:Re(TC)}),tL=ye({path:lu,contentDigest:j().min(1),source:j().nullable(),truncated:Yt()}),nL=ye({id:j().min(1),nodeIds:Re(j().min(1)),edgeIds:Re(j().min(1)),weakestResolution:EC,weakestConfidence:Cu}),iL=ye({code:Ue(["no_match","ambiguous_match","relationship_inconsistency","direction_mismatch","unresolved_handler","incomplete_coverage","stale_source_digest","bounded_truncation","program_orphan","program_conflict","program_unavailable"]),message:j().min(1),nodeId:j().nullable(),path:lu.nullable()}),oL=ye({schema:nt(mP),operation:OP,results:Re(qP),nodes:Re(JP),edges:Re(eL),files:Re(tL),paths:Re(nL),diagnostics:Re(iL),limits:QP,truncated:Yt()}),rL="compass.viewer.graph/1",OC=Je({file:j(),startLine:Z().int().positive().optional(),endLine:Z().int().positive().optional(),startByte:Z().int().nonnegative().optional(),endByte:Z().int().nonnegative().optional()}).passthrough(),sL=Je({field:j().min(1),before:_o().optional(),after:_o().optional()}),Hb=Je({before:lA(j(),_o()).optional(),after:lA(j(),_o()).optional(),fields:Re(sL)}),Yb=Je({challenge:j().startsWith("challenge:"),targetId:j().min(1),effect:Ue(["flag","mask"]),masked:Yt(),certificateDigest:j().regex(/^[0-9a-f]{64}$/),summary:j()}).strict(),gL=Je({total:Z().int().nonnegative(),examples:Re(Je({kind:Ue(["assertion","challenge"]),id:j().min(1),reasonCode:j().min(1),explanation:j(),sequence:Z().int().nonnegative()}).strict()),omittedExamples:Z().int().nonnegative()}).strict(),$b=lA(j(),_o()),aL=AA("kind",[Je({kind:nt("native")}).passthrough(),Je({kind:nt("ocr"),profile:$b,confidence_bps:Z().int().min(0).max(1e4)}).passthrough()]),Wb=Je({kind:j().min(1)}).passthrough(),AL=Je({candidate_id:j().min(1),x:Z().int().nonnegative(),y:Z().int().nonnegative(),width:Z().int().positive(),height:Z().int().positive()}).passthrough(),lL=Je({schema:nt("compass.document.preview/1"),kind:Ue(["page","slide","sheet"]),locator:Wb,label:j().min(1),width:Z().int().positive(),height:Z().int().positive(),svg:j().min(1).max(512*1024),regions:Re(AL).max(256).default([]),digest:j().regex(/^sha256:[0-9a-f]{64}$/)}).passthrough(),CL=Je({role:Ue(["root","block"]).optional(),kind:j().optional(),format:j().optional(),text:j().optional(),ordinal:Z().int().nonnegative().optional(),complete:Yt().optional(),visualCoverage:Ue(["not_requested","complete","partial","failed"]).optional(),ocrMode:Ue(["off","auto","always"]).optional(),origin:aL.optional(),locator:Wb.optional(),ocrProfile:$b.optional(),previews:Re(lL).max(256).optional()}).passthrough(),IL=Je({id:j().min(1),label:j(),kind:j().optional(),community:Z().int(),communityName:j().optional(),degree:Z().int().nonnegative().optional(),language:j().optional(),signature:j().optional(),size:Z().positive().optional(),memberCount:Z().int().nonnegative().optional(),detailAvailable:Yt().optional(),learningStatus:j().optional(),learningStale:Yt().optional(),depth:Z().int().nonnegative().optional(),root:Yt().optional(),agentAssertion:j().startsWith("assertion:").optional(),agentSummary:j().optional(),groundingStatus:nt("GROUNDED").optional(),challenged:Yt().optional(),challenge:Yb.optional(),change:Ue(["added","removed","changed","unchanged"]).optional(),evidence:Hb.optional(),codeEvidence:Re(TC).optional(),source:OC.optional(),color:Je({background:j(),border:j()}).passthrough().optional(),document:CL.optional()}).passthrough(),cL=Je({id:j().min(1),source:j().min(1),target:j().min(1),relation:j(),weight:Z().int().positive().optional(),change:Ue(["added","removed","changed","unchanged"]).optional(),evidence:Hb.optional(),codeEvidence:Re(TC).optional(),details:Ub.nullable().optional(),relationshipSite:OC.optional(),confidence:Ue(["extracted","inferred","ambiguous","aggregated"]).optional(),agentAssertion:j().startsWith("assertion:").optional(),agentSummary:j().optional(),groundingStatus:nt("GROUNDED").optional(),challenged:Yt().optional(),challenge:Yb.optional()}).passthrough(),dL=Je({id:Z().int(),label:j(),color:j(),hidden:Yt().default(!1)}).passthrough(),jo=Je({schema:nt(rL),title:j(),stats:Je({nodes:Z().int().nonnegative(),edges:Z().int().nonnegative(),communities:Z().int().nonnegative(),aggregated:Yt()}).passthrough(),nodes:Re(IL),edges:Re(cL),communities:Re(dL),hyperedges:Re(_o()).default([]),effectiveGraph:Je({effectiveIdentity:j().regex(/^[0-9a-f]{64}$/),baseGeneration:Je({generationId:j().min(1),graphDigest:j().regex(/^[0-9a-f]{64}$/)}).strict(),overlayRevision:j().regex(/^[0-9a-f]{64}$/),compositionProfile:Ue(["augment","curated"]),retractions:gL,omissions:Je({total:Z().int().nonnegative(),direct:Z().int().nonnegative(),cascaded:Z().int().nonnegative(),examples:Re(_o()),omittedExamples:Z().int().nonnegative()}).strict()}).strict().optional()}).passthrough(),uL=Ue(["resolved","inferred","ambiguous","unresolved"]),Kb=Je({source_file:j(),start_byte:Z().int().nonnegative(),end_byte:Z().int().nonnegative()}),hL=Je({id:j(),symbol:j().nullable(),name:j(),file:j().nullable(),anchor:Kb.nullable().optional(),startLine:Z().int().positive().nullable().optional(),endLine:Z().int().positive().nullable().optional(),startByte:Z().int().nonnegative().nullable().optional(),endByte:Z().int().nonnegative().nullable().optional(),graphNodeId:j().nullable(),unresolved:Yt(),evidenceLayer:Ue(["structural_graph","program_ir","combined"]).optional()}),fL=jb([Je({anchor:Kb,evidence:Re(j())}),Je({sourceFile:j().nullable(),line:Z().int().positive().nullable(),startByte:Z().int().nonnegative().nullable(),endByte:Z().int().nonnegative().nullable(),evidence:Re(j())})]),pL=Je({id:j(),source:j(),target:j(),callee:j(),resolution:uL,confidence:j().nullable().optional(),callSites:Re(fL),evidenceLayer:Ue(["structural_graph","program_ir","combined"]).optional()}),mL=Je({schema:Ue(["compass.program.call_graph/1","compass.call_graph/1"]),rootSymbol:j(),direction:Ue(["callers","callees","both"]),depth:Z().int().positive(),nodes:Re(hL),edges:Re(pL),truncated:Yt(),continuations:Re(Je({symbol:j(),direction:Ue(["callers","callees","both"]),nextDepth:Z().int().positive()})),coverage:Je({resolved:Z().int().nonnegative(),inferred:Z().int().nonnegative(),ambiguous:Z().int().nonnegative(),unresolved:Z().int().nonnegative(),evidenceLayer:Ue(["structural_graph","program_ir","combined"]).optional(),partial:Yt().optional(),limitations:Re(j()).optional(),warning:j()})}),vL="compass.viewer.architecture/1",yL=Ue(["production","all_code"]),Xb=Ue(["execution","dependency","type","structure","contextual","unknown"]),Qb=Ue(["architecture","execution","dependency","type","structure","all"]),bL=Ue(["owner","subsystem"]),wL=Ue(["overview","detail"]),xL=Ue(["overlay","persisted","owner","path","declaration","hub","provider","fallback"]),SL=Ue(["good","degraded","insufficient"]),EL=Ue(["info","warning","error"]),TL=Ue(["production","test","generated","vendor","documentation","unknown"]),qb=ye({production:Z().int().nonnegative(),test:Z().int().nonnegative(),generated:Z().int().nonnegative(),vendor:Z().int().nonnegative(),documentation:Z().int().nonnegative(),unknown:Z().int().nonnegative()}),Jb=ye({execution:Z().int().nonnegative(),dependency:Z().int().nonnegative(),type:Z().int().nonnegative(),structure:Z().int().nonnegative(),contextual:Z().int().nonnegative(),unknown:Z().int().nonnegative()}),OL=ye({extracted:Z().int().nonnegative(),inferred:Z().int().nonnegative(),ambiguous:Z().int().nonnegative()}),NL=ye({id:j().min(1),label:j(),kind:j(),sourceFile:j().nullable(),sourceScope:TL,scopeReason:j().min(1),community:Z().int().nonnegative().nullable()}),ML=ye({id:j().min(1),source:j().min(1),target:j().min(1),relation:j(),relationClass:Xb,confidence:Ue(["extracted","inferred","ambiguous"])}),RL=ye({value:j().min(1),provenance:xL,membershipSignature:j().min(1),quality:Z().int().min(0).max(100),evidence:Re(j())}),kL=ye({id:j().min(1),parentId:j().nullable(),kind:bL,rank:Z().int().positive(),name:RL,ownerKey:j().min(1),communityIds:Re(Z().int().nonnegative()),nodeCount:Z().int().nonnegative(),relationshipCount:Z().int().nonnegative(),neighborCount:Z().int().nonnegative(),cohesion:Z().finite(),sourceScopes:qb,pinned:Yt()}),DL=ye({nodeIndex:Z().int().nonnegative(),groupIndex:Z().int().nonnegative()}),_L=ye({id:j().min(1),level:wL,ownerId:j().nullable(),sourceGroup:j().min(1),targetGroup:j().min(1),relationshipCount:Z().int().nonnegative(),relationClasses:Jb,evidence:OL}),jL=ye({admitted:Z().int().nonnegative(),internal:Z().int().nonnegative(),crossGroup:Z().int().nonnegative(),unassigned:Z().int().nonnegative(),relationClasses:Jb}),e0=ye({totalGroups:Z().int().nonnegative(),shownGroups:Z().int().nonnegative(),omittedGroups:Z().int().nonnegative(),representedNodes:Z().int().nonnegative(),omittedNodes:Z().int().nonnegative(),representedRelationships:Z().int().nonnegative(),omittedRelationships:Z().int().nonnegative(),witnessGroupIds:Re(j()),maxOverviewGroups:Z().int().positive(),maxOverviewRoutes:Z().int().positive()}),zL=ye({code:j().min(1),severity:EL,message:j(),observed:Z().nullable(),threshold:Z().nullable(),witnesses:Re(j()),recommendedAction:j()}),t0=ye({status:SL,metrics:ye({sourceScopes:qb,unknownSourceFraction:Z().min(0).max(1),generatedVendorLeakage:Z().int().nonnegative(),representedNodeFraction:Z().min(0).max(1),representedRelationshipFraction:Z().min(0).max(1),duplicateNames:Z().int().nonnegative(),fallbackNames:Z().int().nonnegative(),largestGroupFraction:Z().min(0).max(1),unknownRelations:Z().int().nonnegative(),unassignedNodes:Z().int().nonnegative(),unassignedRelationships:Z().int().nonnegative()}),diagnostics:Re(zL)}),PL=ye({scope:yL,defaultLens:Qb,groups:Re(kL),memberships:Re(DL),routes:Re(_L),overviewGroupIds:Re(j()),overviewRouteIds:Re(j()),coverage:jL,omissions:e0,quality:t0}),LL=ye({maxNodes:Z().int().positive(),maxRelationships:Z().int().positive(),maxGroups:Z().int().positive(),maxRoutes:Z().int().positive(),maxOverviewGroups:Z().int().positive(),maxOverviewRoutes:Z().int().positive(),maxNameCandidates:Z().int().positive(),maxNameEvidence:Z().int().positive(),maxDiagnostics:Z().int().positive(),maxOmissionWitnesses:Z().int().positive()}),BL=ye({schema:nt(vL),title:j(),nodes:Re(NL),relationships:Re(ML),projections:Re(PL).min(1),statistics:ye({nodes:Z().int().nonnegative(),relationships:Z().int().nonnegative(),communities:Z().int().nonnegative(),extracted:Z().int().nonnegative(),inferred:Z().int().nonnegative(),ambiguous:Z().int().nonnegative()}),provenance:ye({projectName:j(),builtAtCommit:j().nullable(),generatedAt:j().nullable()}),limits:LL}).superRefine((t,e)=>{const n=new Set(t.nodes.map(i=>i.id));n.size!==t.nodes.length&&e.addIssue({code:"custom",path:["nodes"],message:"node IDs must be unique"});for(const[i,o]of t.relationships.entries())(!n.has(o.source)||!n.has(o.target))&&e.addIssue({code:"custom",path:["relationships",i],message:"relationship endpoints must identify included nodes"});for(const[i,o]of t.projections.entries()){const s=new Set(o.groups.map(a=>a.id));for(const[a,l]of o.memberships.entries())(l.nodeIndex>=t.nodes.length||l.groupIndex>=o.groups.length)&&e.addIssue({code:"custom",path:["projections",i,"memberships",a],message:"membership indexes must identify an included node and group"});for(const[a,l]of o.routes.entries())(!s.has(l.sourceGroup)||!s.has(l.targetGroup))&&e.addIssue({code:"custom",path:["projections",i,"routes",a],message:"route endpoints must identify included groups"})}}),ZL=Ue(["production","all"]),GL=Ue(["all","extracted","inferred","ambiguous"]),FL=Ue(["production","test","generated","vendor","documentation","unknown"]),VL=Ue(["extracted","inferred","ambiguous"]),UL=Je({production:Z().int().nonnegative(),test:Z().int().nonnegative(),generated:Z().int().nonnegative(),vendor:Z().int().nonnegative(),documentation:Z().int().nonnegative(),unknown:Z().int().nonnegative()}),HL=Je({id:j(),name:j(),nodeCount:Z().int().nonnegative(),totalNodeCount:Z().int().nonnegative(),internalRelationshipCount:Z().int().nonnegative(),incomingRelationships:Z().int().nonnegative(),outgoingRelationships:Z().int().nonnegative(),scopes:UL}),YL=Je({id:j(),sourceGroup:j(),targetGroup:j(),relationships:Z().int().nonnegative(),extracted:Z().int().nonnegative(),inferred:Z().int().nonnegative(),ambiguous:Z().int().nonnegative()});Je({title:j(),scope:ZL,evidence:GL,lens:Qb,groups:Re(HL),routes:Re(YL),statistics:Je({visibleNodes:Z().int().nonnegative(),totalNodes:Z().int().nonnegative(),visibleRelationships:Z().int().nonnegative(),totalRelationships:Z().int().nonnegative(),communities:Z().int().nonnegative(),extracted:Z().int().nonnegative(),inferred:Z().int().nonnegative(),ambiguous:Z().int().nonnegative()}),coverage:Je({internal:Z().int().nonnegative(),crossGroup:Z().int().nonnegative(),unassigned:Z().int().nonnegative()}),omissions:e0,quality:t0,provenance:Je({projectName:j(),builtAtCommit:j().nullable(),generatedAt:j().nullable()})});const $L=Je({id:j(),label:j(),kind:j(),sourceFile:j().nullable(),scope:FL,groupId:j()}),n0=Je({id:j(),source:j(),target:j(),sourceLabel:j(),targetLabel:j(),sourceFile:j().nullable(),targetFile:j().nullable(),sourceGroup:j(),targetGroup:j(),relation:j(),relationClass:Xb,confidence:VL}),NC=Je({page:Z().int().positive(),pageSize:Z().int().min(1).max(100),pageCount:Z().int().positive(),total:Z().int().nonnegative(),start:Z().int().nonnegative(),end:Z().int().nonnegative()});AA("kind",[NC.extend({kind:nt("symbols"),groupId:j(),items:Re($L)}),NC.extend({kind:nt("relationships"),groupId:j(),items:Re(n0)})]),NC.extend({routeId:j(),sourceGroup:j(),targetGroup:j(),items:Re(n0)});const WL=Je({id:j(),kind:Ue(["group","symbol","relationship"]),label:j(),detail:j(),groupId:j().nullable(),routeId:j().nullable(),sourceFile:j().nullable()});NC.extend({query:j(),items:Re(WL)});const KL="compass.viewer.hierarchy/1",XL=Ue(["dominantDirectory","modulePrefix","hubMember","communityId"]),QL=Ue(["relationship","locationAffinity"]),qL=ye({index:Z().int().nonnegative(),id:j().min(1),signature:j().min(1),community:Z().int().nonnegative().optional(),label:j().min(1),labelRule:XL,labelGeneric:Yt(),memberCount:Z().int().positive(),childIndices:Re(Z().int().nonnegative()).default([]),cohesion:Z(),conductance:Z(),boundaryKinds:lA(j(),Z().int().nonnegative()).default({}),detailAvailable:Yt()}),JL=ye({level:Z().int().nonnegative(),merge:QL,resolution:Z().optional(),groupCount:Z().int().positive(),memberCount:Z().int().nonnegative(),groups:Re(qL).min(1),model:jo.optional()}),i0=ye({schema:nt(KL),budgetIdentity:j().min(1),mergePolicy:j().min(1),initialLevel:Z().int().nonnegative().optional(),rootTarget:Z().int().positive(),levelTarget:Z().int().positive(),maxLevels:Z().int().positive(),budgetSatisfied:Yt(),finestCommunityCount:Z().int().nonnegative(),finestSignature:j().min(1),boundaryKinds:Re(j()).default([]),levels:Re(JL).min(1)}),e4="compass.community-hierarchy-diff/1",o0=ye({generation:j(),graphDigest:j(),hierarchyDigest:j(),levels:Z().int().nonnegative(),groups:Z().int().nonnegative()}),t4=ye({kind:Ue(["stable","split","merged","appeared","disappeared","ambiguous"]),level:Z().int().nonnegative(),baseIds:Re(j()),targetIds:Re(j()),overlap:Z(),memberCount:Z().int().nonnegative()}),n4=ye({schema:nt(e4),base:o0,target:o0,policy:ye({keepThreshold:Z(),ambiguityMargin:Z(),maxEvents:Z().int().positive()}),stable:Z().int().nonnegative(),split:Z().int().nonnegative(),merged:Z().int().nonnegative(),appeared:Z().int().nonnegative(),disappeared:Z().int().nonnegative(),ambiguous:Z().int().nonnegative(),events:Re(t4),omittedEvents:Z().int().nonnegative(),resultDigest:j().min(1)}),i4="compass.viewer.workbench/1",o4=ye({status:Ue(["complete","summary","partial"]),truncated:Yt(),nodes:Z().int().nonnegative(),edges:Z().int().nonnegative(),hierarchyLevels:Z().int().nonnegative().optional(),limitations:Re(j()).default([])}),ys={id:j().min(1),title:j().min(1),description:j(),coverage:o4},r4=Ue(["dependencies","routes","data","messaging","tests","provenance"]),s4=ye({id:j().min(1),label:j(),kind:j().optional(),community:Z().int(),communityName:j().optional(),degree:Z().int().nonnegative().optional(),source:OC.optional(),previewAvailable:Yt()}),g4=ye({totalNodes:Z().int().nonnegative(),nodes:Re(s4).max(1e5)}).refine(t=>t.nodes.length<=t.totalNodes,{message:"search index cannot contain more nodes than the full graph"}),a4=AA("kind",[ye({...ys,kind:nt("code"),model:jo,communityDetails:lA(j(),jo).default({}),searchIndex:g4.optional(),hierarchy:i0.optional()}),ye({...ys,kind:nt("call"),root:j(),graph:mL}),ye({...ys,kind:nt("impact"),root:j(),result:oL}),ye({...ys,kind:nt("architecture"),model:BL}),ye({...ys,kind:nt("history"),baseRevision:j(),targetRevision:j(),before:jo,after:jo,hierarchyDiff:n4.optional()}),ye({...ys,kind:nt("affected"),root:j(),relations:Re(j()),depth:Z().int().nonnegative(),model:jo}),ye({...ys,kind:nt("artifact"),lens:r4,relations:Re(j()),model:jo})]),A4=ye({schema:nt(i4),title:j(),graphIdentity:j().min(1),defaultView:j(),views:Re(a4).min(1)}).superRefine((t,e)=>{const n=new Set;for(const[i,o]of t.views.entries())n.has(o.id)&&e.addIssue({code:"custom",path:["views",i,"id"],message:`duplicate workbench view id '${o.id}'`}),n.add(o.id);n.has(t.defaultView)||e.addIssue({code:"custom",path:["defaultView"],message:"defaultView must identify one included view"})});var E=Xd();const CA=Rn({__proto__:null,default:ti(E)},[E]);var bs=jy();const l4=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),C4=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase()),r0=t=>{const e=C4(t);return e.charAt(0).toUpperCase()+e.slice(1)},s0=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim(),I4=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var c4={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const d4=E.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:o="",children:s,iconNode:a,...l},C)=>E.createElement("svg",{ref:C,...c4,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:s0("lucide",o),...!s&&!I4(l)&&{"aria-hidden":"true"},...l},[...a.map(([c,u])=>E.createElement(c,u)),...Array.isArray(s)?s:[s]]));const Te=(t,e)=>{const n=E.forwardRef(({className:i,...o},s)=>E.createElement(d4,{ref:s,iconNode:e,className:s0(`lucide-${l4(r0(t))}`,`lucide-${t}`,i),...o}));return n.displayName=r0(t),n};const Iu=Te("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);const u4=Te("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const h4=Te("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const cu=Te("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const du=Te("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);const f4=Te("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);const p4=Te("badge-check",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const m4=Te("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const g0=Te("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);const uu=Te("braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const v4=Te("bubbles",[["path",{d:"M7.2 14.8a2 2 0 0 1 2 2",key:"1tw9gg"}],["circle",{cx:"18.5",cy:"8.5",r:"3.5",key:"1wadoa"}],["circle",{cx:"7.5",cy:"16.5",r:"5.5",key:"6mdt3g"}],["circle",{cx:"7.5",cy:"4.5",r:"2.5",key:"637s54"}]]);const y4=Te("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const hu=Te("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const b4=Te("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const MC=Te("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const w4=Te("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const x4=Te("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const S4=Te("circle-dot-dashed",[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);const a0=Te("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const E4=Te("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const T4=Te("compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const RC=Te("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const O4=Te("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const N4=Te("file-code-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);const M4=Te("file-cog",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m2.305 15.53.923-.382",key:"yfp9st"}],["path",{d:"m3.228 12.852-.924-.383",key:"bckynb"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.852 11.228-.383-.923",key:"1j88i9"}],["path",{d:"m4.852 16.772-.383.924",key:"sag1dv"}],["path",{d:"m7.148 11.228.383-.923",key:"rj39hk"}],["path",{d:"m7.53 17.696-.382-.924",key:"1uu5cs"}],["path",{d:"m8.772 12.852.923-.383",key:"13811l"}],["path",{d:"m8.772 15.148.923.383",key:"z1a5l0"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]]);const A0=Te("file-image",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);const R4=Te("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);const l0=Te("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);const C0=Te("git-compare-arrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);const fu=Te("git-fork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);const k4=Te("grid-2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);const D4=Te("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const _4=Te("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);const j4=Te("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);const z4=Te("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);const P4=Te("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);const I0=Te("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);const L4=Te("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const B4=Te("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);const Z4=Te("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);const G4=Te("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);const kC=Te("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);const F4=Te("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);const V4=Te("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);const c0=Te("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);const U4=Te("panel-right-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);const d0=Te("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);const H4=Te("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);const u0=Te("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Y4=Te("radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]);const h0=Te("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const f0=Te("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);const $4=Te("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);const p0=Te("scan-search",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);const m0=Te("scan-text",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);const W4=Te("search-code",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const v0=Te("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const K4=Te("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const X4=Te("shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]);const Q4=Te("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);const q4=Te("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const J4=Te("signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);const eB=Te("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);const tB=Te("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const nB=Te("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]);const iB=Te("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);const IA=Te("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const oB=Te("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);const rB=Te("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function y0(t,e){if(e.kind!=="symbols")return t.levels.find(n=>n.level===e.level)?.model}function b0(t,e,n){const i=t.levels.find(h=>h.level===e),o=t.levels.find(h=>h.level===e+1),s=i?.groups.find(h=>h.index===n);if(!s||!o?.model)return;const a=new Set(s.childIndices.map(h=>o.groups[h]?.id).filter(h=>typeof h=="string"));if(a.size===0)return;const l=o.model.nodes.filter(h=>a.has(h.id)),C=new Set(l.map(h=>h.id)),c=o.model.edges.filter(h=>C.has(h.source)&&C.has(h.target)),u=new Set(l.map(h=>h.community));return{...o.model,stats:{...o.model.stats,nodes:l.length,edges:c.length,communities:u.size},nodes:l,edges:c,communities:o.model.communities.filter(h=>u.has(h.id))}}function sB(t){return t.levels.find(n=>n.groups.length>1&&n.model!==void 0)?.level}const w0=5,gB=4,x0=new Map;function aB(t){if(!t)return x0;const e=new Map,n=t.levels[t.levels.length-1];for(const i of n?.groups??[])i.community!==void 0&&e.set(i.community,i.label);return e.size>0?e:x0}function pu(t,e){const n=t.trim();return n===""||n===String(e)||n===`Community ${e}`}function AB(t,e){if(e.size===0)return t;let n=!1;const i=t.nodes.map(s=>{const a=e.get(s.community);if(a===void 0)return s;const l=s.kind==="community"&&pu(s.label,s.community)?a:s.label,C=s.communityName===void 0||pu(s.communityName,s.community)?a:s.communityName;return l===s.label&&C===s.communityName?s:(n=!0,{...s,label:l,communityName:C})}),o=t.communities.map(s=>{const a=e.get(s.id);return a===void 0||!pu(s.label,s.id)||a===s.label?s:(n=!0,{...s,label:a})});return n?{...t,nodes:i,communities:o}:t}function lB(t,e,n){if(!t)return;for(const[a,l]of t.levels.entries()){const C=l.groups.find(c=>c.id===e.id);if(C)return{levelIndex:a,level:l,group:C}}if(!n)return;const i=t.levels.length-1,o=t.levels[i],s=o?.groups.find(a=>a.community===e.community);return s&&o?{levelIndex:i,level:o,group:s}:void 0}function CB(t,e,n){const i=t?.level.model,o=t&&i?i.nodes.find(u=>u.id===t.group.id):void 0,s=i&&o?i:e,a=o?.id??n.id,l=new Map(s.nodes.map(u=>[u.id,u])),C=new Map;for(const u of s.edges){const h=u.source===a?u.target:u.target===a?u.source:void 0;h!==void 0&&C.set(h,(C.get(h)??0)+(u.weight??1))}const c=[...C.entries()].map(([u,h])=>({label:l.get(u)?.label??u,edges:h})).sort((u,h)=>h.edges-u.edges||u.label.localeCompare(h.label));return{edges:c.slice(0,w0),count:c.reduce((u,h)=>u+h.edges,0),complete:c.length<=w0}}function IB(t,e,n,i={}){if(!(n.kind==="community"||e.stats.aggregated))return;const s=lB(t,n,i.communityKeyed??!0),a=s?.group.memberCount??n.memberCount;if(s===void 0&&a===void 0)return;const l=CB(s,e,n),C=Object.entries(s?.group.boundaryKinds??{}).filter(([,c])=>c>0).sort(([c],[u])=>c.localeCompare(u)).slice(0,gB);return{label:s?.group.label??n.communityName??n.label,symbols:a??0,...s?{groupId:s.group.id}:{},...s?.group.community===void 0?{}:{communityId:s.group.community},...s?{level:s.level.level,merge:s.level.merge,...s.level.resolution===void 0?{}:{resolution:s.level.resolution},childGroups:s.group.childIndices.length,cohesion:s.group.cohesion,conductance:s.group.conductance}:{},boundaryKinds:C,couplings:l.edges,couplingCount:l.count,couplingsComplete:l.complete}}const cB=["callable","type","module","boundary","other"],S0=["execution","dependency","structure","flow","other"],dB=new Set(["closure","constructor","function","lambda","macro","method","procedure","subroutine","database_procedure"]),uB=new Set(["class","component","enum","interface","annotation","protocol","struct","trait","type","type_alias","union"]),hB=new Set(["directory","document","export","file","folder","import","migration","module","namespace","package"]),E0=new Set(["command","config_key","database","database_column","database_constraint","database_index","database_schema","database_table","database_trigger","database_view","endpoint","event","job","message","query","queue","resource","route","schema","table","topic"]),fB=new Set(["awaits","calls","dispatches","executes","handles","instantiates","invokes","schedules","tests","triggers","spawns"]),pB=new Set(["depends_on","exports","imports","imports_from","links","re_exports","references","returns","type_of","aliases","uses"]),mB=new Set(["contains","decorates","declares","documents","embeds","extends","implements","inherits","member_of","mixes_in","overrides","renders","owns"]),vB=new Set(["consumes","emits","maps_to","produces","publishes","reads","receives","registers","routes_to","sends","subscribes","writes"]);function mu(t){return(t??"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function yg(t){const e=mu(t);return dB.has(e)?"callable":uB.has(e)?"type":hB.has(e)?"module":E0.has(e)?"boundary":"other"}function bg(t){const e=mu(t);return fB.has(e)?"execution":pB.has(e)?"dependency":mB.has(e)?"structure":vB.has(e)?"flow":"other"}function yB(t){return t!==void 0&&E0.has(mu(t))}function bB(t){return t==="type"?"diamond":t==="module"?"square":t==="boundary"?"triangle":"dot"}function wB(t){return t==="callable"?"var(--vscode-symbolIcon-functionForeground, #3d86c2)":t==="type"?"var(--vscode-symbolIcon-classForeground, #b4763f)":t==="module"?"var(--vscode-symbolIcon-moduleForeground, #2f9a8b)":t==="boundary"?"var(--vscode-symbolIcon-eventForeground, #c46a5c)":"var(--vscode-descriptionForeground, #7a838e)"}function T0(t){return t==="execution"?"var(--vscode-symbolIcon-functionForeground, #3d86c2)":t==="dependency"?"var(--vscode-symbolIcon-moduleForeground, #2f9a8b)":t==="structure"?"var(--vscode-symbolIcon-classForeground, #b4763f)":t==="flow"?"var(--vscode-symbolIcon-eventForeground, #a96298)":"var(--vscode-descriptionForeground, #7a838e)"}const xB=600,SB=3,EB=2e3,O0=9,TB=26,N0=13,M0=18;function vu(t){return`community:${t}`}function OB(t){if(t.stats.aggregated||t.nodes.lengthn.community));return e.size>=SB&&e.size{const a=e.get(o)??[];return(e.get(s)??[]).length-a.length||o-s});for(const o of i){const s=e.get(o)??[];n.set(o,[...s].sort((a,l)=>(l.degree??0)-(a.degree??0)||(l.memberCount??0)-(a.memberCount??0)||a.id.localeCompare(l.id)))}return{members:n,order:i}}function NB(t,e){const n=Math.max(1,e),i=Math.sqrt(Math.max(1,t)/n);return O0+(TB-O0)*i}function yu(t,e,n){return Math.log2(1+Math.max(0,t))+1.5*Math.log2(1+Math.max(0,e))+2*Math.log2(1+Math.max(0,n))}function MB(t){return t<=40?t:t<=120?20:t<=400?14:10}function bu(t,e){const n=MB(t.length);if(n>=t.length)return new Set(t.map(o=>o.id));const i=o=>e?.get(o.id)??yu(o.memberCount??0,o.degree??0,0);return new Set([...t].sort((o,s)=>i(s)-i(o)||(s.memberCount??0)-(o.memberCount??0)||(s.degree??0)-(o.degree??0)||o.id.localeCompare(s.id)).slice(0,n).map(o=>o.id))}function k0(t){const e=t.replace(/\s+/g," ").trim();return e.length<=M0?e:`${e.slice(0,M0-1).trimEnd()}…`}function RB(t,e){const n=new Map;for(const s of t.edges){const a=e.get(s.source),l=e.get(s.target);if(a===void 0||l===void 0||a===l)continue;const C=Math.min(a,l),c=Math.max(a,l),u=`${C}:${c}`,h=n.get(u)??{source:C,target:c,total:0,relations:new Map};h.total+=1,h.relations.set(s.relation,(h.relations.get(s.relation)??0)+1),n.set(u,h)}const i=[...n.entries()].sort(([,s],[,a])=>s.source-a.source||s.target-a.target),o=new Map;return{edges:i.map(([s,{source:a,target:l,total:C,relations:c}])=>{const u=`community-edge:${s}`,h=kB(c),m=h[0];return m&&o.set(u,bg(m.relation)),{id:u,source:vu(a),target:vu(l),relation:_B(h,C),weight:C,confidence:"aggregated"}}),pairs:i.map(([,{source:s,target:a}])=>[s,a]),categories:o}}function kB(t){return[...t.entries()].map(([e,n])=>({relation:e,count:n})).sort((e,n)=>n.count-e.count||D0(e.relation)-D0(n.relation)||e.relation.localeCompare(n.relation))}function D0(t){return S0.indexOf(bg(t))}const DB=3;function _B(t,e){const n=t.slice(0,DB),i=n.map(({relation:s,count:a})=>`${a} ${s}`),o=e-n.reduce((s,a)=>s+a.count,0);return o>0&&i.push(`${o} more`),i.join(" · ")}function jB(t){const e=R0(t),n=new Map(t.nodes.map(b=>[b.id,b.community])),i=new Map(t.nodes.map(b=>[b.id,b])),{edges:o,categories:s,pairs:a}=RB(t,n),l=new Map;for(const b of t.nodes)yB(b.kind)&&l.set(b.community,(l.get(b.community)??0)+1);const C=new Map;for(const[b,x]of a){const y=C.get(b)??new Set;y.add(x),C.set(b,y);const S=C.get(x)??new Set;S.add(b),C.set(x,S)}const c=e.order.reduce((b,x)=>Math.max(b,e.members.get(x)?.length??0),1),u=new Map(e.order.map(b=>[b,yu(e.members.get(b)?.length??0,C.get(b)?.size??0,l.get(b)??0)])),h=[...e.order].sort((b,x)=>(u.get(x)??0)-(u.get(b)??0)||(e.members.get(x)?.length??0)-(e.members.get(b)?.length??0)||b-x),m=new Map(t.communities.map(b=>[b.id,b])),v=h.map(b=>{const x=e.members.get(b)??[],y=x[0],S=m.get(b),T=S?.label?.trim(),O=T&&T!==`Community ${b}`?T:y?.communityName?.trim()||y?.label?.trim()||`Community ${b}`,M=S?.color??y?.color?.background??"#7A838E",k=y?i.get(y.id)?.language:void 0;return{id:vu(b),label:O,kind:"community",community:b,communityName:O,degree:C.get(b)?.size??0,memberCount:x.length,detailAvailable:!0,size:NB(x.length,c),color:{background:M,border:M},...k?{language:k}:{}}});return{model:{...t,stats:{nodes:v.length,edges:o.length,communities:v.length,aggregated:!0},nodes:v,edges:o,communities:t.communities.filter(b=>e.members.has(b.id)),hyperedges:[]},edgeCategories:s,importance:new Map(v.map(b=>[b.id,u.get(b.community)??0])),communityOrder:h}}function zB(t,e,n=EB){const i=R0(t).members.get(e);if(!i||i.length===0)return;const o=Math.max(1,Math.trunc(n)),s=i.slice(0,o),a=new Set(s.map(c=>c.id)),l=t.edges.filter(c=>a.has(c.source)&&a.has(c.target)),C=t.communities.find(c=>c.id===e);return{model:{...t,stats:{nodes:s.length,edges:l.length,communities:1,aggregated:!1},nodes:s,edges:l,communities:C?[C]:[],hyperedges:[]},bounded:s.length[h.id,h.community])),s=new Map;for(const h of n)s.set(h.community,e?.importance.get(h.id)??yu(h.memberCount??1,h.degree??0,0));const a=e?.communityOrder??[...n].sort((h,m)=>(s.get(m.community)??0)-(s.get(h.community)??0)||(m.memberCount??0)-(h.memberCount??0)||h.id.localeCompare(m.id)).map(h=>h.community),l=new Map(a.map((h,m)=>[h,m])),C=[...n].sort((h,m)=>(l.get(h.community)??0)-(l.get(m.community)??0)||h.id.localeCompare(m.id)).map(h=>({id:h.community,nodeId:h.id,label:h.communityName?.trim()||h.label,color:h.color?.background??"#6688aa",memberCount:h.memberCount??1,degree:h.degree??0,importance:s.get(h.community)??0})),c=new Map(C.map(h=>[h.id,h])),u=[];for(const h of i){const m=o.get(h.source),v=o.get(h.target);m===void 0||v===void 0||m===v||!c.has(m)||!c.has(v)||u.push({id:h.id,source:m,target:v,weight:Math.max(1,h.weight??1),relation:h.relation,category:e?.edgeCategories.get(h.id)??bg(h.relation)})}return{communities:C,byId:c,links:u,symbols:C.reduce((h,m)=>h+m.memberCount,0)}}function PB(t,e){const n=Math.max(1,Math.trunc(e));return{shown:t.communities.slice(0,n),omitted:Math.max(0,t.communities.length-n)}}const _0={width:1e3,height:620},j0=240;function LB(t,e=j0,n=_0){const i=Math.max(1,Math.trunc(e)),o=t.communities.slice(0,i),s=t.communities.slice(i),a={communities:s.length,symbols:s.reduce((C,c)=>C+c.memberCount,0)},l=[...o.map(C=>({community:C,value:Math.max(1,C.memberCount),tail:!1})),...a.communities>0?[{community:{id:-1,nodeId:"community:tail",label:`${a.communities.toLocaleString()} more communities`,color:"#8A93A0",memberCount:a.symbols,degree:0,importance:0},value:Math.max(1,a.symbols),tail:!0}]:[]];return{tiles:BB(l,n),omitted:a}}function BB(t,e){const n=t.reduce((c,u)=>c+u.value,0);if(n<=0)return[];const i=Math.max(1,Math.min(t.length,Math.round(Math.sqrt(t.length*e.height/e.width)))),o=[];let s=[...t],a=n;for(let c=0;c0;c+=1){const u=i-c,h=a/u,m=[];let v=0;for(;s.length>0;){const b=s[0];if(m.length>0&&v+b.value/2>h&&s.length>u-1)break;m.push(b),v+=b.value,s=s.slice(1)}a-=v,o.push(m)}const l=[];let C=0;for(const c of o){const u=c.reduce((v,b)=>v+b.value,0),h=e.height*(u/n);let m=0;for(const v of c){const b=e.width*(v.value/u);l.push({community:v.community,x:m,y:C,width:b,height:h}),m+=b}C+=h}return l}const ZB=60,GB=12;function FB(t,e=ZB,n=GB){const i=Math.max(1,Math.trunc(e)),o=Math.max(1,Math.trunc(n)),s=t.communities.slice(0,i),a=t.communities.slice(i),l=[];for(let c=0;cb+Math.max(1,x.memberCount),0);let m=0;const v=u.map(b=>{const x=Math.max(1,b.memberCount)/h,y={community:b,x:m,width:x};return m+=x,y});l.push({tier:l.length,entries:v})}const C={communities:a.length,symbols:a.reduce((c,u)=>c+u.memberCount,0)};return C.communities>0&&l.push({tier:l.length,entries:[{community:{id:-1,nodeId:"community:tail",label:`${C.communities.toLocaleString()} more communities`,color:"#8A93A0",memberCount:C.symbols,degree:0,importance:0},x:0,width:1}]}),{lanes:l,omitted:C}}function VB(t,e,n=240){const i=new Map;for(const o of e.lanes)for(const s of o.entries)s.community.id>=0&&i.set(s.community.id,{entry:s,tier:o.tier});return[...t.links].sort((o,s)=>s.weight-o.weight||o.source-s.source||o.target-s.target||o.id.localeCompare(s.id)).flatMap(o=>{const s=i.get(o.source),a=i.get(o.target);return!s||!a?[]:[{link:o,source:s.entry,target:a.entry,sourceTier:s.tier,targetTier:a.tier}]}).slice(0,Math.max(1,Math.trunc(n)))}function St(t,e){return typeof window>"u"?e:getComputedStyle(document.documentElement).getPropertyValue(t).trim()||e}function xu(){const[t,e]=E.useState(0);return E.useEffect(()=>{const n=()=>e(s=>s+1),i=new MutationObserver(n);i.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style"]}),i.observe(document.body,{attributes:!0,attributeFilter:["class","style"]});const o=typeof window.matchMedia=="function"?window.matchMedia("(prefers-color-scheme: dark)"):void 0;return o?.addEventListener("change",n),()=>{i.disconnect(),o?.removeEventListener("change",n)}},[]),t}function z0(){return St("--vscode-editor-background",St("--compass-canvas",St("--background","#FBFCFD")))}const UB=[{value:"auto",label:"Auto",hint:"Follow the operating system theme"},{value:"light",label:"Light",hint:"Always use the light palette"},{value:"dark",label:"Dark",hint:"Always use the dark palette"}];function P0(t){if(typeof document>"u")return;const e=document.documentElement;t==="auto"?delete e.dataset.compassTheme:e.dataset.compassTheme=t}const HB=32;function YB({data:t,limit:e=HB,onOpenCommunity:n}){const{shown:i,omitted:o}=E.useMemo(()=>PB(t,e),[t,e]),[s,a]=E.useState(null),l=E.useMemo(()=>{const m=new Map;for(const v of t.links)m.set(`${v.source}:${v.target}`,v),m.set(`${v.target}:${v.source}`,v);return m},[t.links]),C=E.useMemo(()=>t.links.reduce((m,v)=>Math.max(m,v.weight),1),[t.links]),c=E.useMemo(()=>t.links.some(m=>m.category!=="other"),[t.links]),u=s?l.get(s):void 0,h=s?.split(":").map(Number)??[];return d.jsxs("div",{className:"compass-variant compass-matrix","data-variant":"matrix",children:[d.jsx("div",{className:"compass-variant-scroll",children:d.jsxs("table",{role:"grid","aria-label":"Community coupling matrix",children:[d.jsx("caption",{className:"sr-only",children:"Community coupling. Rows are relationships from a community, columns are relationships to a community."}),d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{scope:"col","aria-label":"Community"}),i.map((m,v)=>d.jsx("th",{scope:"col","data-active":h[1]===m.id?"true":void 0,title:`${m.label} · ${m.memberCount.toLocaleString()} symbols`,children:d.jsx("span",{className:"compass-matrix-column-label",children:v+1})},m.id))]})}),d.jsx("tbody",{children:i.map(m=>d.jsxs("tr",{"data-active":h[0]===m.id?"true":void 0,children:[d.jsxs("th",{scope:"row",children:[d.jsx("span",{className:"compass-matrix-dot","aria-hidden":"true",style:{background:m.color}}),d.jsx("span",{className:"compass-matrix-row-label",children:m.label}),d.jsx("small",{children:m.memberCount.toLocaleString()})]}),i.map(v=>{const b=m.id===v.id,x=b?void 0:l.get(`${m.id}:${v.id}`),y=x?Math.min(.94,.22+.72*Math.sqrt(x.weight/C)):0,S=`${m.id}:${v.id}`;return d.jsxs("td",{"data-self":b?"true":void 0,"data-filled":x?"true":void 0,children:[d.jsxs("button",{type:"button",className:"compass-matrix-cell","aria-label":b?`${m.label}, ${m.memberCount.toLocaleString()} symbols`:x?`${m.label} to ${v.label}: ${x.relation}`:`${m.label} to ${v.label}: no direct relationship`,disabled:b||x===void 0,style:x?{"--compass-matrix-fill":T0(x.category),"--compass-matrix-intensity":y}:void 0,onMouseEnter:()=>a(x?S:null),onMouseLeave:()=>a(null),onFocus:()=>a(x?S:null),onBlur:()=>a(null),onClick:()=>n(x?v.id:m.id),children:[d.jsx("span",{className:"sr-only",children:x?`${x.weight} relationships`:"No relationship"}),x?d.jsx("i",{"aria-hidden":"true",style:{opacity:y}}):null]}),b?d.jsx("span",{className:"compass-matrix-self","aria-hidden":"true"}):null]},S)})]},m.id))})]})}),d.jsxs("div",{className:"compass-variant-footer",role:"status",children:[d.jsxs("span",{children:[i.length.toLocaleString()," of ",t.communities.length.toLocaleString()," communities",o>0?` · ${o.toLocaleString()} more below the importance cut`:""]}),u&&h.length===2?d.jsxs("span",{className:"compass-variant-detail",children:[d.jsxs("strong",{children:[t.byId.get(h[0])?.label," → ",t.byId.get(h[1])?.label]}),d.jsx("span",{children:u.relation})]}):d.jsx("span",{className:"compass-variant-hint",children:c?"Cell colour is the dominant relationship kind · select a cell to open that community":"This export records relationship counts without kinds · select a cell to open that community"})]})]})}function L0(t){const e=E.useRef(null),[n,i]=E.useState(t);return E.useEffect(()=>{const o=e.current;if(!o)return;const s=()=>{const l=o.clientWidth,C=o.clientHeight;l<=0||C<=0||i(c=>c.width===l&&c.height===C?c:{width:l,height:C})};if(s(),typeof ResizeObserver>"u")return;const a=new ResizeObserver(s);return a.observe(o),()=>a.disconnect()},[]),{ref:e,size:n}}function DC(t){const e=t.match(/^#([\da-f]{3}|[\da-f]{6})$/i)?.[1];if(e){const i=e.length===3?[...e].map(o=>`${o}${o}`).join(""):e;return[Number.parseInt(i.slice(0,2),16),Number.parseInt(i.slice(2,4),16),Number.parseInt(i.slice(4,6),16)]}const n=t.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);if(n)return[Number.parseFloat(n[1]??"0"),Number.parseFloat(n[2]??"0"),Number.parseFloat(n[3]??"0")]}function B0(t,e,n){const i=DC(t),o=DC(e);if(!i||!o)return e;const s=i.map((a,l)=>Math.round(a*(1-n)+o[l]*n));return`rgb(${s[0]}, ${s[1]}, ${s[2]})`}function Su(t){const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Z0(t){const e=DC(t);return e?.2126*Su(e[0])+.7152*Su(e[1])+.0722*Su(e[2]):1}function G0(t){const e=DC(t);return e?(e[0]*299+e[1]*587+e[2]*114)/1e3<145:!0}const F0="#0E1319",V0="#F5F8FC";function U0(t,e){const n=Z0(t),i=Z0(e),o=Math.max(n,i),s=Math.min(n,i);return(o+.05)/(s+.05)}function _C(t,e,n=1){const i=n>=1||n<=0?t:B0(e,t,n);return U0(i,F0)>=U0(i,V0)?F0:V0}const H0=.82;function $B({data:t,onOpenCommunity:e}){const{ref:n,size:i}=L0(_0),o=xu(),s=E.useMemo(()=>z0(),[o]),a=E.useMemo(()=>LB(t,j0,i),[t,i]),[l,C]=E.useState(null),c=l===null?void 0:t.byId.get(l),u=E.useMemo(()=>l===null?[]:t.links.filter(h=>h.source===l||h.target===l).sort((h,m)=>m.weight-h.weight||h.id.localeCompare(m.id)).slice(0,3),[l,t.links]);return d.jsxs("div",{className:"compass-variant compass-treemap","data-variant":"treemap",ref:n,children:[d.jsx("svg",{className:"compass-treemap-canvas",viewBox:`0 0 ${i.width} ${i.height}`,role:"group","aria-label":"Community area map",preserveAspectRatio:"none",children:a.tiles.map(h=>{const m=h.community.id<0,v=h.width>96&&h.height>46,b=h.width>70&&h.height>30;return d.jsxs("g",{transform:`translate(${h.x} ${h.y})`,"data-tail":m?"true":void 0,"data-active":l===h.community.id?"true":void 0,children:[d.jsx("rect",{width:Math.max(0,h.width-1.5),height:Math.max(0,h.height-1.5),rx:3,fill:h.community.color,fillOpacity:m?.32:.82}),m?null:d.jsx("rect",{className:"compass-treemap-hit",width:h.width,height:h.height,tabIndex:0,role:"button","aria-label":`${h.community.label}, ${h.community.memberCount.toLocaleString()} symbols`,onMouseEnter:()=>C(h.community.id),onMouseLeave:()=>C(null),onFocus:()=>C(h.community.id),onBlur:()=>C(null),onClick:()=>e(h.community.id),onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),e(h.community.id))}}),v?d.jsx("text",{className:"compass-treemap-label",x:7,y:20,style:m?void 0:{fill:_C(h.community.color,s,H0)},children:h.community.label}):null,b?d.jsxs("text",{className:"compass-treemap-count",x:7,y:v?36:22,style:m?void 0:{fill:_C(h.community.color,s,H0)},children:[h.community.memberCount.toLocaleString()," symbols"]}):null]},h.community.nodeId)})}),d.jsxs("div",{className:"compass-variant-footer",role:"status",children:[d.jsxs("span",{children:[t.communities.length.toLocaleString()," communities ·"," ",t.symbols.toLocaleString()," symbols · area is symbol count",a.omitted.communities>0?` · ${a.omitted.communities.toLocaleString()} smallest disclosed as one tile`:""]}),c?d.jsxs("span",{className:"compass-variant-detail",children:[d.jsx("strong",{children:c.label}),d.jsxs("span",{children:[c.memberCount.toLocaleString()," symbols"]}),u.map(h=>d.jsxs("span",{children:["↔ ",t.byId.get(h.source===c.id?h.target:h.source)?.label," ",h.relation]},h.id))]}):d.jsx("span",{className:"compass-variant-hint",children:"Hover a tile for its couplings · select a tile to open that community"})]})]})}const WB={width:1e3,height:620},Y0=26,KB=54,XB=96;function QB({data:t,onOpenCommunity:e}){const{ref:n,size:i}=L0(WB),o=xu(),s=E.useMemo(()=>z0(),[o]),a=E.useMemo(()=>FB(t),[t]),l=E.useMemo(()=>VB(t,a),[t,a]),C=Math.max(1,a.lanes.length),c=Math.max(KB,Math.min(XB,(i.height-40)/C-Y0)),[u,h]=E.useState(null),m=l.reduce((O,M)=>Math.max(O,M.link.weight),1),v=t.links.some(O=>O.category!=="other"),b=O=>20+O*(c+Y0),x=b(C-1)+c+12,y=Math.max(i.height,x),S=O=>8+O*(i.width-16),T=u===null?void 0:t.byId.get(u);return d.jsxs("div",{className:"compass-variant compass-lanes","data-variant":"lanes",ref:n,children:[d.jsxs("svg",{className:"compass-lanes-canvas",viewBox:`0 0 ${i.width} ${y}`,role:"group","aria-label":"Community tier map",preserveAspectRatio:"none",children:[l.map(O=>{const M=S(O.source.x+O.source.width/2),k=S(O.target.x+O.target.width/2),G=b(O.sourceTier)+c,L=b(O.targetTier),F=O.sourceTier<=O.targetTier,re=F?G:L+c,pe=F?L:G+c,ie=(re+pe)/2,J=u!==null&&(O.link.source===u||O.link.target===u);return d.jsx("path",{className:"compass-lane-ribbon","data-active":J?"true":void 0,"data-dim":u!==null&&!J?"true":void 0,d:`M ${M} ${G} C ${M} ${ie}, ${k} ${ie}, ${k} ${L}`,stroke:T0(O.link.category),strokeWidth:Math.min(12,1.4+3.4*Math.sqrt(O.link.weight/m)),children:d.jsx("title",{children:`${t.byId.get(O.link.source)?.label} ↔ ${t.byId.get(O.link.target)?.label}: ${O.link.relation}`})},O.link.id)}),a.lanes.map(O=>d.jsxs("g",{transform:`translate(0 ${b(O.tier)})`,children:[d.jsx("text",{className:"compass-lane-tier",x:8,y:-6,children:O.tier===a.lanes.length-1&&a.omitted.communities>0?"tail":`tier ${O.tier+1}`}),O.entries.map(M=>{const k=M.community.id<0,G=Math.max(2,M.width*(i.width-16)),L=G>78;return d.jsxs("g",{transform:`translate(${S(M.x)} 0)`,"data-tail":k?"true":void 0,children:[d.jsx("rect",{className:"compass-lane-bar",width:Math.max(0,G-2),height:c,rx:4,fill:M.community.color,fillOpacity:k?.3:u===M.community.id?1:.86}),k?null:d.jsx("rect",{className:"compass-lane-hit",width:Math.max(2,G-2),height:c,tabIndex:0,role:"button","aria-label":`${M.community.label}, ${M.community.memberCount.toLocaleString()} symbols`,onMouseEnter:()=>h(M.community.id),onMouseLeave:()=>h(null),onFocus:()=>h(M.community.id),onBlur:()=>h(null),onClick:()=>e(M.community.id),onKeyDown:F=>{F.key!=="Enter"&&F.key!==" "||(F.preventDefault(),e(M.community.id))}}),L?d.jsxs(d.Fragment,{children:[d.jsx("text",{className:"compass-lane-label",x:8,y:26,style:k?void 0:{fill:_C(M.community.color,s,.86)},children:M.community.label.length>18?`${M.community.label.slice(0,17).trimEnd()}…`:M.community.label}),d.jsx("text",{className:"compass-lane-count",x:8,y:c>64?44:40,style:k?void 0:{fill:_C(M.community.color,s,.86)},children:k?`${M.community.memberCount.toLocaleString()} symbols`:M.community.memberCount.toLocaleString()})]}):null]},M.community.nodeId)})]},O.tier))]}),d.jsxs("div",{className:"compass-variant-footer",role:"status",children:[d.jsxs("span",{children:[t.communities.length.toLocaleString()," communities ·"," ",l.length.toLocaleString()," couplings drawn · tier 1 is the most coupled and boundary-rich layer",a.omitted.communities>0?` · ${a.omitted.communities.toLocaleString()} more in the tail`:""]}),T?d.jsxs("span",{className:"compass-variant-detail",children:[d.jsx("strong",{children:T.label}),d.jsxs("span",{children:[T.memberCount.toLocaleString()," symbols ·"," ",T.degree.toLocaleString()," coupling",T.degree===1?"":"s"]})]}):d.jsx("span",{className:"compass-variant-hint",children:v?"Ribbon colour is the relationship kind · select a tier bar to open that community":"This export records relationship counts without kinds · select a tier bar to open that community"})]})]})}const $0=new Set(["color","change","evidence"]),qB=new Set(["anchor","anchors","columnEnd","columnStart","community","communityName","community_name","degree","endByte","endColumn","endLine","lineEnd","lineStart","line_end","line_start","location","normLabel","norm_label","relationshipSite","relationship_site","size","sourceDigest","sourceFile","sourceHash","source_digest","source_file","source_hash","startByte","startColumn","startLine","wiringSite","wiring_site"]);function jC(t,e){const n=zC(t),i=zC(e);return{...n?{before:n}:{},...i?{after:i}:{},fields:Tu(n,i)}}function W0(t,e,n){const i=zC(t),o=zC(e),s=Eu(t,n),a=Eu(e,n);return{...i?{before:i}:{},...o?{after:o}:{},fields:Tu(s,a)}}function JB(t,e){return Eu(t,e)??{}}function eZ(t,e=240){const n=t===void 0?"Not recorded":typeof t=="string"?t:JSON.stringify(t,null,cA(t)?2:void 0)??String(t);return n.length<=e?{text:n,truncated:!1}:{text:`${n.slice(0,Math.max(0,e-1)).trimEnd()}…`,truncated:!0}}function zC(t){if(t)return Q0(t)}function Eu(t,e){return t?X0(t,e==="node"?new Set(["source"]):new Set(["id","key"])):void 0}function K0(t){return Array.isArray(t)?t.map(K0):cA(t)?X0(t):t}function X0(t,e=new Set){return Object.fromEntries(Object.keys(t).filter(n=>!$0.has(n)&&!qB.has(n)&&!e.has(n)).sort((n,i)=>n.localeCompare(i)).map(n=>[n,K0(t[n])]))}function PC(t){return Array.isArray(t)?t.map(PC):cA(t)?Q0(t):t}function Q0(t){return Object.fromEntries(Object.keys(t).filter(e=>!$0.has(e)).sort((e,n)=>e.localeCompare(n)).map(e=>[e,PC(t[e])]))}function Tu(t,e,n=""){const i=new Set([...Object.keys(t??{}),...Object.keys(e??{})]),o=[];for(const s of[...i].sort((a,l)=>a.localeCompare(l))){const a=n?`${n}.${s}`:s,l=t?.[s],C=e?.[s];cA(l)&&cA(C)?o.push(...Tu(l,C,a)):tZ(l,C)||o.push({field:a,...l!==void 0?{before:l}:{},...C!==void 0?{after:C}:{}})}return o}function tZ(t,e){return JSON.stringify(PC(t))===JSON.stringify(PC(e))}function cA(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function nZ({node:t,edges:e,nodes:n,sourceRevisions:i,onFocus:o,onOpenSource:s}){const a=ew(t.evidence?.before),l=ew(t.evidence?.after);return d.jsxs(d.Fragment,{children:[t.evidence?.fields.length?d.jsxs("section",{className:"compass-record-evidence","aria-labelledby":"compass-node-changes-title",children:[d.jsxs("div",{className:"compass-evidence-heading",children:[d.jsx("h3",{id:"compass-node-changes-title",children:iZ(t.change)}),d.jsxs("span",{children:[t.evidence.fields.length," fields"]})]}),d.jsx(q0,{fields:t.evidence.fields}),t.change==="changed"&&(a||l)&&d.jsxs("div",{className:"compass-evidence-source-actions",children:[a&&d.jsxs("button",{type:"button",onClick:()=>s(a,i?.before),children:[d.jsx(RC,{"aria-hidden":"true"}),"Open before"]}),l&&d.jsxs("button",{type:"button",onClick:()=>s(l,i?.after),children:[d.jsx(RC,{"aria-hidden":"true"}),"Open after"]})]})]}):null,d.jsxs("section",{className:"compass-relationship-evidence","aria-labelledby":"compass-relationships-title",children:[d.jsxs("div",{className:"compass-neighbors-heading",children:[d.jsx("span",{id:"compass-relationships-title",children:"Relationships"}),d.jsx("strong",{children:e.length})]}),e.length?d.jsx("div",{className:"compass-relationship-list",children:e.map(C=>{const c=C.source===t.id?C.target:C.source,u=n.get(c);return d.jsxs("details",{children:[d.jsxs("summary",{children:[d.jsx("span",{className:"compass-change-badge","data-change":C.change,children:tw(C.change)}),d.jsx("span",{className:"compass-relationship-target",children:u?.label??c}),d.jsx("small",{children:C.relation}),C.confidence&&d.jsx("i",{children:C.confidence})]}),d.jsxs("div",{className:"compass-relationship-detail",children:[C.change==="changed"&&C.evidence?.fields.length?d.jsx(q0,{fields:C.evidence.fields}):d.jsxs("p",{children:[tw(C.change)," relationship: ",C.source," → ",C.target]}),d.jsxs("button",{type:"button",onClick:()=>o(c),children:["Focus ",u?.label??c]})]})]},C.id)})}):d.jsx("span",{className:"compass-empty",children:"No connected relationships"})]})]})}function q0({fields:t}){return d.jsx("div",{className:"compass-field-table-wrap",children:d.jsxs("table",{className:"compass-field-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Field"}),d.jsx("th",{children:"Before"}),d.jsx("th",{children:"After"})]})}),d.jsx("tbody",{children:t.map(e=>d.jsxs("tr",{children:[d.jsx("th",{scope:"row",children:e.field}),d.jsx(J0,{value:e.before}),d.jsx(J0,{value:e.after})]},e.field))})]})})}function J0({value:t}){const e=eZ(t);return d.jsxs("td",{children:[d.jsx("code",{children:e.text}),e.truncated&&d.jsx("span",{className:"compass-value-truncated",children:"Value shortened"})]})}function ew(t){const e=OC.safeParse(t?.source);return e.success?e.data:void 0}function tw(t){return!t||t==="unchanged"?"Context":`${t[0]?.toLocaleUpperCase()}${t.slice(1)}`}function iZ(t){return t==="added"?"Added symbol metadata":t==="removed"?"Removed symbol metadata":"What changed"}const nw=100,iw={changed:0,added:1,removed:2,unchanged:3};function oZ({nodes:t,query:e,selectedId:n,onFocus:i}){const[o,s]=E.useState(!1),a=e.trim().toLocaleLowerCase(),l=t.filter(c=>c.change&&c.change!=="unchanged").filter(c=>!a||c.label.toLocaleLowerCase().includes(a)||c.kind?.toLocaleLowerCase().includes(a)||c.source?.file.toLocaleLowerCase().includes(a)).sort((c,u)=>iw[c.change??"unchanged"]-iw[u.change??"unchanged"]||c.label.localeCompare(u.label)||c.id.localeCompare(u.id)),C=o?l:l.slice(0,nw);return d.jsxs("section",{className:"compass-changed-symbols","aria-labelledby":"compass-changed-symbols-title",children:[d.jsxs("div",{className:"compass-section-heading",children:[d.jsx("h2",{id:"compass-changed-symbols-title",children:"Changed symbols"}),d.jsx("span",{children:l.length})]}),C.length?d.jsx("div",{className:"compass-changed-symbol-list",children:C.map(c=>d.jsxs("button",{type:"button","aria-pressed":c.id===n,"data-change":c.change,onClick:()=>i(c.id),children:[d.jsx("span",{className:"compass-changed-symbol-status",children:rZ(c.change)}),d.jsx("strong",{children:c.label}),d.jsx("small",{children:c.source?.file??c.kind??"Graph symbol"})]},c.id))}):d.jsx("p",{className:"compass-empty",children:a?"No affected symbols match this search.":"No symbol changes."}),!o&&l.length>nw&&d.jsxs("button",{className:"compass-changed-symbol-expand",type:"button",onClick:()=>s(!0),children:["Show all ",l.length.toLocaleString()," affected symbols"]})]})}function rZ(t){return!t||t==="unchanged"?"Context":`${t[0]?.toLocaleUpperCase()}${t.slice(1)}`}function ow({evidence:t,diagnostics:e=[],truncated:n=!1,title:i="Trust evidence",onOpenSource:o}){return!t.length&&!e.length&&!n?null:d.jsxs("section",{className:"compass-code-evidence","aria-label":i,children:[d.jsxs("div",{className:"compass-evidence-heading",children:[d.jsx("h3",{children:i}),d.jsxs("span",{children:[t.length," ",t.length===1?"record":"records"]})]}),n&&d.jsxs("p",{className:"compass-code-diagnostic","data-severity":"warning",role:"status",children:[d.jsx(IA,{"aria-hidden":"true"}),"Results reached a configured limit. Narrow the query or raise one bound."]}),e.map(s=>d.jsxs("p",{className:"compass-code-diagnostic","data-severity":s.code==="no_match"?"info":"warning",role:"status",children:[s.code==="no_match"?d.jsx(a0,{"aria-hidden":"true"}):d.jsx(IA,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:aZ(s.code)}),s.message]})]},`${s.code}:${s.message}`)),d.jsx("div",{className:"compass-code-evidence-ledger",children:t.map((s,a)=>{const l=gZ(s),C=s.wiringSite??s.anchor;return d.jsxs("article",{className:"compass-code-evidence-entry","data-status":l.key,children:[d.jsx("span",{className:"compass-code-evidence-icon","aria-hidden":"true",children:d.jsx(sZ,{item:s})}),d.jsxs("div",{className:"compass-code-evidence-copy",children:[d.jsxs("div",{className:"compass-code-evidence-status",children:[d.jsx("strong",{children:l.label}),d.jsx("span",{children:s.layer==="program_ir"?"Program IR":"Code graph"})]}),d.jsxs("dl",{children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Extractor"}),d.jsx("dd",{children:s.extractor})]}),d.jsxs("div",{children:[d.jsx("dt",{children:"Confidence"}),d.jsx("dd",{children:s.confidence})]}),s.rule&&d.jsxs("div",{children:[d.jsx("dt",{children:"Rule"}),d.jsx("dd",{children:s.rule})]})]}),C&&(o?d.jsxs("button",{className:"compass-code-evidence-source",type:"button",onClick:()=>o(C),children:[d.jsx(RC,{"aria-hidden":"true"}),rw(s,C)]}):d.jsx("span",{className:"compass-code-evidence-source",children:rw(s,C)})),s.candidates.length>0&&d.jsxs("div",{className:"compass-code-candidates",children:[d.jsx("span",{children:"Retained candidates"}),d.jsx("ul",{children:s.candidates.map(c=>d.jsxs("li",{children:[d.jsx("code",{children:c.nodeId}),d.jsx("span",{children:c.reason}),d.jsx("small",{children:c.confidence})]},`${c.nodeId}:${c.reason}`))})]})]})]},`${s.layer}:${s.extractor}:${a}`)})})]})}function sZ({item:t}){return t.resolution==="unresolved"?d.jsx(a0,{}):t.resolution==="ambiguous"||t.confidence==="ambiguous"?d.jsx(IA,{}):t.origin==="heuristic"?d.jsx(fu,{}):t.origin==="config"?d.jsx(M4,{}):t.origin==="convention"?d.jsx(J4,{}):d.jsx(p4,{})}function gZ(t){return t.resolution==="unresolved"?{key:"unresolved",label:"Unresolved"}:t.resolution==="ambiguous"||t.confidence==="ambiguous"?{key:"ambiguous",label:"Ambiguous"}:t.origin==="heuristic"?{key:"heuristic",label:"Heuristic"}:t.origin==="config"?{key:"config",label:"Configuration"}:t.origin==="convention"?{key:"convention",label:"Convention"}:{key:"exact",label:"Exact"}}function rw(t,e){return`${t.origin==="heuristic"?"Wired at":"Evidence at"} ${e.file}:${e.startLine}`}function aZ(t){return`${t.replaceAll("_"," ")}: `}const wg=[{id:"combined",label:"Combined"},{id:"native",label:"Native"},{id:"ocr",label:"OCR evidence"}];function AZ(t,e){if(!e.document)return;const n=e.source?.file,i=t.nodes.filter(a=>a.document?n===void 0||a.source?.file===n:!1),o=i.find(a=>a.document?.role==="root")??(e.document.role==="root"?e:void 0),s=i.filter(a=>a.document?.role==="block");if(e.document.role==="block"&&!s.some(a=>a.id===e.id)&&s.push(e),!(!o&&s.length===0))return s.sort(hZ),{...n!==void 0?{sourceFile:n}:{},...o?{root:o}:{},blocks:s}}function lZ({context:t,selectedId:e,onFocus:n}){const[i,o]=E.useState("combined"),s=E.useMemo(()=>t.blocks.filter(Ou),[t.blocks]),a=E.useMemo(()=>t.blocks.filter(y=>!Ou(y)),[t.blocks]),[l,C]=E.useState(e&&s.some(y=>y.id===e)?e:s[0]?.id);E.useEffect(()=>{o("combined"),C(e&&s.some(y=>y.id===e)?e:s[0]?.id)},[t.sourceFile,s,e]);const c=i==="ocr"?s:i==="native"?a:t.blocks,u=t.root?.document,h=u?.visualCoverage??(s.length>0?"complete":"not_requested"),m=u?.ocrMode??(s.length>0?"auto":"off"),v=gw(u?.ocrProfile)??s.map(y=>gw(Nu(y)?.profile)).find(Boolean),b=h==="failed"?"failed":h==="partial"?"partial":u?.complete===!1?"incomplete":void 0,x=s.find(y=>y.id===l);return d.jsxs("section",{className:"compass-document-evidence","aria-labelledby":"compass-document-evidence-title",children:[d.jsxs("header",{className:"compass-document-evidence-header",children:[d.jsxs("div",{className:"compass-document-evidence-heading",children:[d.jsx("span",{className:"compass-document-evidence-mark","aria-hidden":"true",children:d.jsx(m0,{})}),d.jsxs("span",{children:[d.jsx("small",{children:"Document evidence"}),d.jsx("h3",{id:"compass-document-evidence-title",children:pZ(t.sourceFile,u?.format)})]})]}),d.jsx(CZ,{mode:m,coverage:h,...v?{profile:v}:{}})]}),b&&d.jsxs("div",{className:"compass-document-warning","data-status":b,role:"alert",children:[d.jsx(Q4,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:b==="failed"?"OCR could not complete":b==="partial"?"OCR coverage is partial":"Document extraction is incomplete"}),d.jsx("small",{children:b==="incomplete"?"Compass retained the available evidence; review the document diagnostics before relying on it as complete.":"Native text is still available. Some visual regions could not be processed."})]})]}),d.jsx("div",{className:"compass-document-tabs",role:"tablist","aria-label":"Document evidence views",children:wg.map((y,S)=>{const T=y.id==="ocr"?s.length:y.id==="native"?a.length:t.blocks.length,O=i===y.id;return d.jsxs("button",{id:`compass-document-tab-${y.id}`,className:"compass-document-tab",type:"button",role:"tab","aria-selected":O,"aria-controls":"compass-document-panel",tabIndex:O?0:-1,onClick:()=>o(y.id),onKeyDown:M=>{const k=M.key==="ArrowRight"?(S+1)%wg.length:M.key==="ArrowLeft"?(S-1+wg.length)%wg.length:M.key==="Home"?0:M.key==="End"?wg.length-1:void 0;if(k===void 0)return;M.preventDefault();const G=wg[k];G&&(o(G.id),document.getElementById(`compass-document-tab-${G.id}`)?.focus())},children:[y.label,d.jsx("span",{children:T})]},y.id)})}),d.jsx("div",{id:"compass-document-panel",className:"compass-document-tab-panel",role:"tabpanel","aria-labelledby":`compass-document-tab-${i}`,tabIndex:0,children:c.length>0?d.jsx("div",{className:"compass-document-block-list",children:c.map(y=>d.jsx(IZ,{block:y,active:y.id===e,onClick:()=>{Ou(y)&&C(y.id),n(y.id)}},y.id))}):d.jsxs("div",{className:"compass-document-empty",children:[d.jsx(A0,{"aria-hidden":"true"}),d.jsx("strong",{children:i==="ocr"?"No OCR evidence":"No document blocks"}),d.jsx("span",{children:i==="ocr"?"Run extraction with a managed OCR profile to inspect visual text.":"This document did not publish readable native blocks."})]})}),x&&d.jsx(uZ,{block:x,siblings:s,...u?.previews?{previews:u.previews}:{},onFocus:y=>{C(y),n(y)}}),!x&&u?.previews&&u.previews.length>0&&d.jsx(dZ,{previews:u.previews})]})}function CZ({mode:t,coverage:e,profile:n}){const i=e==="complete",o=t!=="off",s=`OCR ${o?aw(t):"Off"} · ${o?Aw(e):"Native only"}${n?` · ${n}`:""}`;return d.jsxs("span",{className:"compass-ocr-status-chip","data-status":e,role:"status","aria-label":s,title:s,children:[i?d.jsx(x4,{"aria-hidden":"true"}):d.jsx(IA,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsxs("strong",{children:["OCR ",o?aw(t):"Off"]}),d.jsx("small",{children:o?Aw(e):"Native only"})]}),n&&d.jsx("em",{children:n})]})}function IZ({block:t,active:e,onClick:n}){const i=Nu(t),o=t.document?.text??t.label,s=t.document?.locator;return d.jsxs("button",{className:"compass-document-block","data-origin":i?"ocr":"native","data-active":e,type:"button","aria-pressed":e,onClick:n,children:[d.jsxs("span",{className:"compass-document-block-topline",children:[d.jsxs("span",{className:"compass-document-block-kind",children:[i?d.jsx(m0,{"aria-hidden":"true"}):d.jsx(A0,{"aria-hidden":"true"}),i?"OCR evidence":mZ(t.document?.kind)]}),i&&d.jsx(cZ,{confidence:i.confidence_bps})]}),d.jsx("span",{className:"compass-document-block-text",children:o||"(empty block)"}),d.jsxs("span",{className:"compass-document-block-locator",children:[d.jsx(z4,{"aria-hidden":"true"}),xg(s),i&&d.jsx(O4,{"aria-hidden":"true"})]})]})}function cZ({confidence:t}){const e=Math.max(0,Math.min(100,t/100)),n=e>=85?"high":e>=60?"medium":"low";return d.jsxs("span",{className:"compass-ocr-confidence","data-confidence":n,children:[e.toFixed(2),"%"]})}function dZ({previews:t}){const[e,n]=E.useState(0);E.useEffect(()=>{n(o=>Math.min(o,Math.max(0,t.length-1)))},[t.length]);const i=t[e];return i?d.jsxs("div",{className:"compass-ocr-preview compass-document-preview-gallery","aria-label":"Document preview",children:[d.jsxs("header",{children:[d.jsxs("span",{children:[d.jsx("strong",{children:i.label}),d.jsxs("small",{children:[xg(i.locator)," · Normalized preview"]})]}),t.length>1&&d.jsxs("span",{className:"compass-document-preview-controls",children:[d.jsx("button",{type:"button","aria-label":"Previous document preview",disabled:e===0,onClick:()=>n(o=>Math.max(0,o-1)),children:d.jsx(b4,{"aria-hidden":"true"})}),d.jsxs("span",{children:[e+1," / ",t.length]}),d.jsx("button",{type:"button","aria-label":"Next document preview",disabled:e===t.length-1,onClick:()=>n(o=>Math.min(t.length-1,o+1)),children:d.jsx(MC,{"aria-hidden":"true"})})]})]}),d.jsx("div",{className:"compass-document-preview-stage",children:d.jsx("img",{className:"compass-document-preview-image",src:lw(i.svg),alt:`${i.label} document preview`})}),d.jsx("p",{children:"Compass generated a bounded local snapshot. Native text remains the authoritative evidence."})]}):null}function uZ({block:t,siblings:e,previews:n,onFocus:i}){const o=t.document.locator,s=LC(o.width),a=LC(o.height),l=o.candidate_id,C=e.filter(u=>{const h=u.document.locator;return h.candidate_id===l&&h.width===o.width&&h.height===o.height});if(!s||!a)return null;const c=vZ(n,o);return d.jsxs("div",{className:"compass-ocr-preview","aria-label":"OCR region preview",children:[d.jsxs("header",{children:[d.jsxs("span",{children:[d.jsx("strong",{children:c?.label??"Visual region"}),d.jsxs("small",{children:[xg(o.owner)," · ",s," × ",a,"px"]})]}),d.jsxs("span",{className:"compass-ocr-preview-key",children:[d.jsx("i",{}),"OCR boxes",c?" · normalized preview":""]})]}),c?d.jsxs("div",{className:"compass-document-preview-stage",children:[d.jsx("img",{className:"compass-document-preview-image",src:lw(c.svg),alt:`${c.label} document preview`}),d.jsx("svg",{className:"compass-document-preview-overlay",viewBox:`0 0 ${c.width} ${c.height}`,role:"img","aria-label":`OCR bounding boxes over ${c.label}`,preserveAspectRatio:"none",children:C.map(u=>{const h=yZ(u.document.locator,c);return h?sw(u,h,u.id===t.id,i):null})})]}):d.jsxs("svg",{className:"compass-ocr-preview-canvas",viewBox:`0 0 ${s} ${a}`,role:"img","aria-label":`OCR bounding boxes for ${xg(o.owner)}`,children:[d.jsx("defs",{children:d.jsx("pattern",{id:"compass-ocr-preview-grid",width:"32",height:"32",patternUnits:"userSpaceOnUse",children:d.jsx("path",{d:"M 32 0 L 0 0 0 32",fill:"none",stroke:"currentColor",strokeOpacity:"0.12",strokeWidth:"1"})})}),d.jsx("rect",{width:s,height:a,fill:"var(--compass-ocr-preview-surface)"}),d.jsx("rect",{width:s,height:a,fill:"url(#compass-ocr-preview-grid)"}),C.map(u=>{const h=u.document.locator,m=wZ(h.polygon,s,a);return m?sw(u,m,u.id===t.id,i):null})]}),d.jsx("p",{children:c?"OCR boxes are mapped to the embedded image region. Click a box to inspect its text and confidence.":"Click a highlighted region to inspect its text and confidence."})]})}function sw(t,e,n,i){return d.jsx("polygon",{className:"compass-ocr-preview-box","data-active":n,points:e,role:"button",tabIndex:0,"aria-label":`${t.document.text??t.label} · ${xg(t.document.locator)}`,onClick:()=>i(t.id),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),i(t.id))},children:d.jsx("title",{children:t.document.text??t.label})},t.id)}function Ou(t){return Nu(t)!==void 0&&t.document?.locator?.kind==="ocr"}function Nu(t){return t.document?.origin?.kind==="ocr"?t.document.origin:void 0}function hZ(t,e){const n=t.document?.ordinal??Number.MAX_SAFE_INTEGER,i=e.document?.ordinal??Number.MAX_SAFE_INTEGER;return n-i||t.id.localeCompare(e.id)}function gw(t){const e=t?.profile;return typeof e=="string"?fZ(e):void 0}function fZ(t){return t.replace(/^pp-/,"PP-").replace(/ocrv(\d+)/i,"OCRv$1").replace(/-(small|medium)$/i,(e,n)=>` ${n[0]?.toUpperCase()}${n.slice(1)}`)}function aw(t){return t.length>0?`${t[0]?.toUpperCase()}${t.slice(1)}`:"Off"}function Aw(t){return{complete:"Complete",partial:"Partial coverage",failed:"Failed",not_requested:"Not requested"}[t]??"Unknown"}function pZ(t,e){const n=t?.split(/[\\/]/).pop()??"Document";return e?`${n} · ${e.toUpperCase()}`:n}function mZ(t){return t?t.replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase()):"Native text"}function xg(t){if(!t)return"Location unavailable";switch(t.kind){case"ocr":{const e=Ut(t,"owner"),n=oi(Ut(t,"occurrence"))??0;return`${xg(Cw(e)?e:void 0)} · Region ${n+1}`}case"pdf":return`Page ${oi(Ut(t,"page"))??"?"}`;case"page":return`Page ${oi(Ut(t,"page"))??"?"}`;case"slide":return`Slide ${oi(Ut(t,"slide"))??"?"}${Ut(t,"shape")!==void 0?` · Shape ${String(Ut(t,"shape"))}`:""}`;case"spreadsheet":{const e=Ut(t,"sheet");return`${typeof e=="string"?e:"Sheet"}!${bZ(oi(Ut(t,"column"))??1)}${oi(Ut(t,"row"))??"?"}`}case"package":{const e=Ut(t,"part"),n=Ut(t,"path"),i=typeof e=="string"?e:"Package part";if(/\/(?:media|embeddings)\//i.test(i)||/\.(?:avif|bmp|gif|jpe?g|png|tiff?|webp)$/i.test(i))return"Embedded image";const o=i.split(/[\\/]/).pop()||"Package part";return typeof n=="string"&&n.length>0?`${o} · ${n}`:o}case"text_range":{const e=oi(Ut(t,"start_line")),n=oi(Ut(t,"end_line"));return e!==void 0?`Lines ${e}${n!==void 0&&n!==e?`–${n}`:""}`:"Text range"}default:return"Document location"}}function vZ(t,e){if(!t||t.length===0)return;const n=e.candidate_id;if(n){const o=t.find(s=>s.regions.some(a=>a.candidate_id===n));if(o)return o}const i=e.owner;if(Cw(i)){if(i.kind==="slide"){const o=oi(Ut(i,"slide")),s=t.find(a=>a.kind==="slide"&&a.locator.kind==="slide"&&oi(Ut(a.locator,"slide"))===o);if(s)return s}if(i.kind==="spreadsheet"){const o=Ut(i,"sheet"),s=t.find(a=>a.kind==="sheet"&&a.locator.kind==="spreadsheet"&&Ut(a.locator,"sheet")===o);if(s)return s}}return t[0]}function lw(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function yZ(t,e){const n=t.candidate_id,i=n?e.regions.find(l=>l.candidate_id===n):void 0,o=LC(t.width),s=LC(t.height);if(!i||!o||!s||!Array.isArray(t.polygon))return;const a=t.polygon.slice(0,256).flatMap(l=>{if(typeof l!="object"||l===null)return[];const C=oi(Ut(l,"x")),c=oi(Ut(l,"y"));if(C===void 0||c===void 0)return[];const u=i.x+BC(C/o,0,1)*i.width,h=i.y+BC(c/s,0,1)*i.height;return[`${u},${h}`]});return a.length>=3?a.join(" "):void 0}function Ut(t,e){return t[e]}function Cw(t){return typeof t=="object"&&t!==null&&typeof Ut(t,"kind")=="string"}function oi(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function bZ(t){let e=Math.max(1,Math.floor(t)),n="";for(;e>0;){const i=(e-1)%26;n=String.fromCharCode(65+i)+n,e=Math.floor((e-1)/26)}return n}function LC(t){return t!==void 0&&Number.isFinite(t)&&t>0&&t<=1e4?t:void 0}function wZ(t,e,n){if(!Array.isArray(t))return;const i=t.slice(0,256).flatMap(o=>{if(typeof o!="object"||o===null)return[];const s=oi(Ut(o,"x")),a=oi(Ut(o,"y"));return s!==void 0&&a!==void 0?[`${BC(s,0,e)},${BC(a,0,n)}`]:[]});return i.length>=3?i.join(" "):void 0}function BC(t,e,n){return Math.max(e,Math.min(n,t))}function Iw(t){return dw(t.source)}function cw(t){return dw(t.relationshipSite)}function dw(t){return t?.file.trim()&&(t.startLine!==void 0||t.endLine!==void 0||t.startByte!==void 0||t.endByte!==void 0)?t:void 0}const Mu=200;function xZ(t,e,n){const i=new Map,o=new Map,s=(l,C,c)=>{const u=n.get(C);if(!u)return;const h=l.get(C);h?h.edges.push(c):l.set(C,{node:u,edges:[c]})};for(const l of e)l.target===t&&s(i,l.source,l),l.source===t&&s(o,l.target,l);const a=l=>[...l.values()].map(C=>({...C,edges:C.edges.sort((c,u)=>c.relation.localeCompare(u.relation)||c.id.localeCompare(u.id))})).sort((C,c)=>C.node.label.localeCompare(c.node.label)||C.node.id.localeCompare(c.node.id));return{incoming:a(i),outgoing:a(o)}}function SZ(t){const e=new Map;for(const n of t){const i=n.relation||"related";e.set(i,(e.get(i)??0)+(n.weight??1))}return[...e.entries()].sort(([n],[i])=>n.localeCompare(i)).map(([n,i])=>i>1?`${n} ×${i}`:n).join(" · ")}function EZ(t,e){if(e)return t?.groupId!==void 0?t.communityId:e.community}function TZ(t){return t.groupId!==void 0||t.level!==void 0||t.couplings.length>0||t.boundaryKinds.length>0}function OZ(t){if(t.level===void 0)return"Published hierarchy";const e=t.merge==="locationAffinity"?"grouped by shared location":t.resolution===void 0?"grouped by relationship evidence":`relationship evidence at ${t.resolution}`;return`Level ${t.level} · ${e}`}function NZ(t){return`${(t*100).toFixed(t>=.1?0:1)}%`}function MZ({direction:t,groups:e,communityColors:n,onFocus:i}){const o=t==="incoming",s=e.reduce((c,u)=>c+u.edges.length,0),a=o?"Incoming":"Outgoing",l=o?"Nodes that point to this node":"Nodes this node points to",C=o?Iu:du;return d.jsxs("section",{className:"compass-direction-group","data-direction":t,children:[d.jsxs("div",{className:"compass-direction-heading",children:[d.jsx("span",{className:"compass-direction-icon","aria-hidden":"true",children:d.jsx(C,{})}),d.jsxs("span",{className:"compass-direction-copy",children:[d.jsx("strong",{children:a}),d.jsx("small",{children:l})]}),d.jsxs("span",{className:"compass-direction-count",children:[d.jsx("strong",{children:e.length}),d.jsxs("small",{children:[s," ",s===1?"edge":"edges"]})]})]}),d.jsx("div",{className:"compass-direction-list",children:e.length?e.map(c=>{const u=SZ(c.edges);return d.jsxs("button",{type:"button",className:"compass-direction-link",title:`Focus ${c.node.label}`,"aria-label":`Focus ${c.node.label}; ${a.toLocaleLowerCase()}; ${u}`,onClick:()=>i(c.node.id),children:[d.jsx("span",{className:"compass-neighbor-dot","aria-hidden":"true",style:{background:c.node.color?.background??n.get(c.node.community)??"var(--border)"}}),d.jsxs("span",{className:"compass-direction-node",children:[d.jsx("strong",{children:c.node.label}),d.jsx("small",{children:u})]}),d.jsx(MC,{"aria-hidden":"true"})]},c.node.id)}):d.jsx("span",{className:"compass-direction-empty",children:o?"No incoming relationships":"No outgoing relationships"})})]})}function RZ({selectedId:t,relationships:e,communityColors:n,onFocus:i}){const o=E.useId(),[s,a]=E.useState(),l=s?.selectedId===t?s.direction:e.outgoing.length>0?"outgoing":"incoming",C=(u,h)=>{a({selectedId:t,direction:u}),h&&document.getElementById(`${o}-${u}-tab`)?.focus()},c=u=>{u.key==="ArrowLeft"||u.key==="ArrowRight"?(u.preventDefault(),C(l==="incoming"?"outgoing":"incoming",!0)):(u.key==="Home"||u.key==="End")&&(u.preventDefault(),C(u.key==="Home"?"incoming":"outgoing",!0))};return d.jsxs("div",{className:"compass-relationship-directions",children:[d.jsx("div",{className:"compass-relationship-tabs",role:"tablist","aria-label":"Relationship direction",onKeyDown:c,children:["incoming","outgoing"].map(u=>{const m=e[u].reduce((y,S)=>y+S.edges.length,0),v=l===u,b=u==="incoming"?"Incoming":"Outgoing",x=u==="incoming"?Iu:du;return d.jsxs("button",{id:`${o}-${u}-tab`,type:"button",role:"tab","aria-label":`${b}, ${m} ${m===1?"edge":"edges"}`,"aria-selected":v,"aria-controls":`${o}-${u}-panel`,tabIndex:v?0:-1,"data-direction":u,onClick:()=>C(u,!1),children:[d.jsx(x,{"aria-hidden":"true"}),d.jsx("span",{children:b}),d.jsx("small",{children:m})]},u)})}),["incoming","outgoing"].map(u=>d.jsx("div",{id:`${o}-${u}-panel`,role:"tabpanel","aria-labelledby":`${o}-${u}-tab`,tabIndex:l===u?0:-1,hidden:l!==u,children:l===u&&d.jsx(MZ,{direction:u,groups:e[u],communityColors:n,onFocus:i})},u))]})}function kZ(t,e,n){const i=e.trim().toLocaleLowerCase(),o=i?t.filter(a=>a.label.toLocaleLowerCase().includes(i)||String(a.id).includes(i)):t;if(!n)return o.slice(0,Mu);const s=new Map(n.map((a,l)=>[a,l]));return[...o].sort((a,l)=>(s.get(a.id)??Number.MAX_SAFE_INTEGER)-(s.get(l.id)??Number.MAX_SAFE_INTEGER)).slice(0,Mu)}function DZ(t){const e=t.source?.startLine,n=t.source?.endLine;if(e!==void 0)return n!==void 0&&n!==e?`${e}–${n}`:String(e)}function uw(t){const e=t.source?.startLine,n=t.source?.endLine;if(e!==void 0)return n!==void 0&&n!==e?{text:`Lines ${e}–${n}`,action:`at lines ${e}–${n}`}:{text:`Line ${e}`,action:`at line ${e}`};const i=t.source?.startByte,o=t.source?.endByte;if(i!==void 0)return o!==void 0&&o!==i?{text:`Bytes ${i}–${o}`,action:`at bytes ${i}–${o}`}:{text:`Byte ${i}`,action:`at byte ${i}`}}function hw(t,e){const n=uw(t);return`Open source ${e.file}${n?` ${n.action}`:""}`}function fw(t){return t==="unchanged"?"Context":t?`${t[0]?.toLocaleUpperCase()}${t.slice(1)}`:void 0}function _Z(t){if(t)return{added:"var(--vscode-gitDecoration-addedResourceForeground, #2ea043)",removed:"var(--vscode-gitDecoration-deletedResourceForeground, #f85149)",changed:"var(--vscode-gitDecoration-modifiedResourceForeground, #d29922)",unchanged:"var(--vscode-descriptionForeground, #6e7781)"}[t]}function jZ({model:t,selected:e,communityFacts:n,neighbors:i,connectedEdges:o,query:s,matches:a,searchSpansCommunities:l,searchCoverage:C,searchOnly:c,communityOrder:u,hiddenCommunities:h,communityDrilldown:m,subgraphAvailable:v,comparisonMode:b,sourceRevisions:x,queryResult:y,renderedEdgeCount:S,showHeader:T,onQueryChange:O,onFocus:M,onOpenSource:k,onOpenCommunity:G,onQueryNode:L,onToggleCommunity:F,onSetAllVisible:re,collapsed:pe,onToggleCollapsed:ie}){const[J,ve]=E.useState(0),me=!!m||e!==void 0,[ue,z]=E.useState(!m);E.useEffect(()=>{z(!m)},[m]);const U=b&&!ue,Q=e?Iw(e):void 0,le=e?DZ(e):void 0,X=e?uw(e):void 0,R=v===!0&&(n?.childGroups??0)>0,D=R?e?.community:EZ(n,e),H=!R&&t.stats.aggregated&&e?.memberCount!==void 0&&e.detailAvailable!==!1,se=G!==void 0&&D!==void 0&&(R||H),de=E.useMemo(()=>{const Ce=new Map;for(const Tt of t.nodes)Ce.set(Tt.community,(Ce.get(Tt.community)??0)+(Tt.memberCount??1));return Ce},[t.nodes]),be=E.useMemo(()=>t.stats.aggregated?t.nodes.reduce((Ce,Tt)=>Ce+(Tt.memberCount??0),0):void 0,[t.nodes,t.stats.aggregated]),Ne=h.size===0,ge=E.useMemo(()=>new Map(t.nodes.map(Ce=>[Ce.id,Ce])),[t.nodes]),ae=Ce=>{const Tt=Ce.source?.file??Ce.kind??"Graph node";return!l||ge.has(Ce.id)?Tt:`${Ce.communityName??t.communities.find(sn=>sn.id===Ce.community)?.label??`Community ${Ce.community}`} · ${Tt}${Ce.previewAvailable===!1?" · not in preview":""}`},xe=E.useMemo(()=>new Map(t.communities.map(Ce=>[Ce.id,Ce.color])),[t.communities]),Me=E.useMemo(()=>e?xZ(e.id,o,ge):{incoming:[],outgoing:[]},[o,ge,e?.id]),_=e?y?.nodes.find(Ce=>Ce.id===e.id):void 0,ce=e?AZ(t,e):void 0,Se=_?.evidence??e?.codeEvidence??[],_e=e?y?y.edges.filter(Ce=>Ce.source===e.id||Ce.target===e.id).flatMap(Ce=>Ce.evidence):o.flatMap(Ce=>Ce.codeEvidence??[]):[],gt=d.jsx(zZ,{model:t,communityCounts:de,hiddenCommunities:h,allVisible:Ne,onSetAllVisible:re,onToggleCommunity:F,communityOrder:u,onOpenCommunity:G}),Et=Ce=>{M(Ce.id),O(""),ve(0)},ot=Ce=>{!a.length&&Ce.key!=="Escape"||(Ce.key==="ArrowDown"?(Ce.preventDefault(),ve((J+1)%a.length)):Ce.key==="ArrowUp"?(Ce.preventDefault(),ve((J-1+a.length)%a.length)):Ce.key==="Enter"&&a[J]?(Ce.preventDefault(),Et(a[J])):Ce.key==="Escape"&&(O(""),ve(0)))};return pe?d.jsxs("aside",{className:"compass-graph-inspector compass-graph-inspector-collapsed","aria-label":"Graph inspector",children:[d.jsx("button",{className:"compass-inspector-disclosure compass-inspector-expand",type:"button","aria-label":"Expand graph inspector",title:"Expand graph inspector",onClick:ie,children:d.jsx(U4,{"aria-hidden":"true"})}),d.jsx("span",{className:"compass-inspector-rail-label","aria-hidden":"true",children:"Inspector"})]}):d.jsxs("aside",{className:"compass-graph-inspector","aria-label":"Graph inspector","data-focused":me,children:[T&&d.jsxs("header",{className:"compass-inspector-header",children:[d.jsx("span",{className:"compass-product-mark","aria-hidden":"true",children:d.jsx(T4,{})}),d.jsxs("span",{className:"compass-inspector-title",children:[d.jsx("strong",{children:"Compass"}),d.jsx("small",{children:t.title})]}),d.jsx("button",{className:"compass-inspector-disclosure",type:"button","aria-label":"Collapse graph inspector",title:"Collapse graph inspector",onClick:ie,children:d.jsx(c0,{"aria-hidden":"true"})})]}),d.jsxs("div",{className:"compass-inspector-search",role:"search",children:[d.jsx("label",{className:"sr-only",htmlFor:"compass-node-search",children:"Search graph nodes"}),d.jsxs("div",{className:"compass-inspector-search-row",children:[d.jsxs("div",{className:"compass-search-field",children:[d.jsx(v0,{"aria-hidden":"true"}),d.jsx("input",{id:"compass-node-search",type:"search",role:"combobox",value:s,placeholder:"Search nodes and files",autoComplete:"off","aria-controls":"compass-search-results","aria-autocomplete":"list","aria-expanded":a.length>0,"aria-activedescendant":a[J]?`compass-search-result-${J}`:void 0,onChange:Ce=>{O(Ce.target.value),ve(0)},onKeyDown:ot})]}),!T&&d.jsx("button",{className:"compass-inspector-disclosure compass-inspector-search-disclosure",type:"button","aria-label":"Collapse graph inspector",title:"Collapse graph inspector",onClick:ie,children:d.jsx(c0,{"aria-hidden":"true"})})]}),a.length>0&&d.jsx("div",{id:"compass-search-results",className:"compass-search-results",role:"listbox","aria-label":"Matching nodes",children:a.map((Ce,Tt)=>d.jsxs("button",{id:`compass-search-result-${Tt}`,type:"button",role:"option","aria-selected":Tt===J,className:"compass-search-item",onMouseEnter:()=>ve(Tt),onClick:()=>Et(Ce),children:[d.jsx("strong",{children:Ce.label}),d.jsx("span",{children:ae(Ce)})]},Ce.id))}),C&&d.jsx("small",{className:"compass-search-coverage",role:"status",children:C.indexed===C.total?`Search all ${C.total.toLocaleString()} graph nodes and files`:`Search indexes ${C.indexed.toLocaleString()} of ${C.total.toLocaleString()} graph nodes`})]}),d.jsxs("section",{className:"compass-info-panel","aria-labelledby":"compass-info-title",children:[d.jsxs("div",{className:"compass-section-heading",children:[d.jsx("h2",{id:"compass-info-title",children:"Inspector"}),d.jsx("span",{children:e?"Pinned":"Node details"})]}),e?d.jsxs("div",{className:"compass-info-content",children:[d.jsxs("div",{className:"compass-node-identity",children:[d.jsx("span",{className:"compass-node-swatch","aria-hidden":"true",style:{background:_Z(e.change)??e.color?.background??xe.get(e.community)}}),d.jsxs("span",{children:[d.jsx("strong",{children:e.label}),d.jsx("small",{children:e.kind??"Symbol"})]}),fw(e.change)&&d.jsx("span",{className:"compass-change-badge","data-change":e.change,children:fw(e.change)})]}),c&&d.jsx("p",{className:"compass-search-only-notice",role:"status",children:"Found in the full graph. This node is outside the bounded preview, so its relationships are unavailable here. Open the source when a link is available, or export its community for complete details."}),d.jsxs("dl",{className:"compass-metadata-grid",children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Community"}),d.jsx("dd",{children:n?.label??e.communityName??t.communities.find(Ce=>Ce.id===e.community)?.label??e.community})]}),n?d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Symbols"}),d.jsx("dd",{children:n.symbols.toLocaleString()})]}),n.childGroups!==void 0&&d.jsxs("div",{children:[d.jsx("dt",{children:"Sub-groups"}),d.jsx("dd",{children:n.childGroups.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("dt",{children:"Couplings"}),d.jsx("dd",{children:n.couplingCount.toLocaleString()})]})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Degree"}),d.jsx("dd",{children:e.degree??i.length})]}),!c&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Incoming"}),d.jsx("dd",{children:Me.incoming.length})]}),d.jsxs("div",{children:[d.jsx("dt",{children:"Outgoing"}),d.jsx("dd",{children:Me.outgoing.length})]})]})]}),e.language&&d.jsxs("div",{children:[d.jsx("dt",{children:"Language"}),d.jsx("dd",{children:e.language})]}),le&&d.jsxs("div",{children:[d.jsx("dt",{children:"Lines"}),d.jsx("dd",{children:le})]}),d.jsx("div",{className:"compass-metadata-wide compass-source-metadata","data-interactive":Q!==void 0,children:Q?d.jsxs(d.Fragment,{children:[d.jsx("dt",{className:"sr-only",children:"Source"}),d.jsx("dd",{children:d.jsxs("button",{className:"compass-source-card",type:"button","aria-label":hw(e,Q),title:hw(e,Q),onClick:()=>k(Q,e.change==="removed"?x?.before:x?.after),children:[d.jsxs("span",{className:"compass-source-copy",children:[d.jsx("span",{className:"compass-source-eyebrow","aria-hidden":"true",children:"Source"}),d.jsx("span",{className:"compass-source-path",children:Q.file}),X&&d.jsx("span",{className:"compass-source-range",children:X.text})]}),d.jsx(RC,{"aria-hidden":"true"})]})})]}):d.jsxs(d.Fragment,{children:[d.jsx("dt",{children:"Source"}),d.jsx("dd",{title:e.source?.file??"Not recorded",children:e.source?.file??"Not recorded"})]})})]}),e.signature&&d.jsx("code",{className:"compass-signature-block",children:e.signature}),se&&d.jsxs("button",{className:"compass-inspector-action",type:"button",onClick:()=>{D!==void 0&&G?.(D)},children:[d.jsx("span",{className:"compass-inspector-action-icon","aria-hidden":"true",children:d.jsx(m4,{})}),d.jsxs("span",{className:"compass-inspector-action-copy",children:[d.jsx("strong",{children:R?"Open subgraph":b?"Inspect changes":"Open community"}),d.jsx("small",{children:R?`${n?.childGroups??0} sub-groups`:`${e.memberCount?.toLocaleString()??0} ${b?"current symbols":"members"}`})]}),d.jsx(MC,{"aria-hidden":"true"})]}),n&&TZ(n)&&d.jsxs("section",{className:"compass-community-evidence","aria-labelledby":"compass-community-evidence-title",children:[d.jsxs("div",{className:"compass-inspector-subheading",children:[d.jsx("h3",{id:"compass-community-evidence-title",children:"Community evidence"}),d.jsx("span",{children:OZ(n)})]}),d.jsxs("dl",{className:"compass-metadata-grid",children:[n.communityId!==void 0&&d.jsxs("div",{children:[d.jsx("dt",{children:"Community id"}),d.jsx("dd",{children:n.communityId})]}),n.cohesion!==void 0&&d.jsxs("div",{children:[d.jsx("dt",{children:"Cohesion"}),d.jsx("dd",{children:NZ(n.cohesion)})]}),n.conductance!==void 0&&d.jsxs("div",{children:[d.jsx("dt",{children:"Conductance"}),d.jsx("dd",{children:n.conductance.toFixed(2)})]}),n.boundaryKinds.length>0&&d.jsxs("div",{className:"compass-metadata-wide",children:[d.jsx("dt",{children:"Boundary kinds"}),d.jsx("dd",{children:n.boundaryKinds.map(([Ce,Tt])=>`${Ce} ×${Tt}`).join(" · ")})]})]}),n.couplings.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"compass-inspector-subheading",children:[d.jsx("h3",{children:"Couplings"}),d.jsxs("span",{children:[n.couplingCount.toLocaleString()," ",n.couplingCount===1?"edge":"edges"]})]}),d.jsx("ul",{className:"compass-community-couplings",children:n.couplings.map(Ce=>d.jsxs("li",{children:[d.jsx("span",{children:Ce.label}),d.jsx("small",{children:Ce.edges.toLocaleString()})]},Ce.label))}),!n.couplingsComplete&&d.jsx("p",{className:"compass-empty",children:"The strongest couplings are listed; the level projection bounds the rest."})]}),n.groupId&&d.jsx("code",{className:"compass-signature-block",children:n.groupId})]}),ce&&d.jsx(lZ,{context:ce,selectedId:e.id,onFocus:M}),L&&d.jsxs("section",{className:"compass-node-actions","aria-labelledby":"compass-node-actions-title",children:[d.jsxs("div",{className:"compass-inspector-subheading",children:[d.jsx("h3",{id:"compass-node-actions-title",children:"Actions"}),d.jsx("span",{children:"3 available"})]}),d.jsxs("div",{className:"compass-code-query-actions","aria-label":"Code graph queries",children:[d.jsxs("button",{type:"button",title:"Find code that calls this node",onClick:()=>L("callers",e.id),children:[d.jsx(Iu,{"aria-hidden":"true"}),d.jsx("span",{children:"Callers"})]}),d.jsxs("button",{type:"button",title:"Find code called by this node",onClick:()=>L("callees",e.id),children:[d.jsx(du,{"aria-hidden":"true"}),d.jsx("span",{children:"Callees"})]}),d.jsxs("button",{type:"button",title:"Trace code affected by this node",onClick:()=>L("impact",e.id),children:[d.jsx(Y4,{"aria-hidden":"true"}),d.jsx("span",{children:"Impact"})]})]})]}),d.jsx(ow,{evidence:Se,diagnostics:y?.diagnostics,truncated:y?.truncated,title:"Node evidence",onOpenSource:k}),d.jsx(ow,{evidence:_e,title:"Relationship evidence",onOpenSource:k}),t.stats.aggregated&&e.memberCount!==void 0&&e.detailAvailable===!1&&!R&&D!==void 0&&d.jsx("p",{className:"compass-empty",children:"This community detail was omitted to keep the standalone HTML export bounded. Open the graph in VS Code or export this community as JSON for full inspection."}),c?null:b?d.jsx(nZ,{node:e,edges:o,nodes:ge,sourceRevisions:x,onFocus:M,onOpenSource:k}):d.jsxs("section",{className:"compass-relationships","aria-labelledby":"compass-relationships-title",children:[d.jsxs("div",{className:"compass-inspector-subheading",children:[d.jsx("h3",{id:"compass-relationships-title",children:"Relationships"}),d.jsxs("span",{children:[o.length," ",o.length===1?"edge":"edges"]})]}),d.jsx(RZ,{selectedId:e.id,relationships:Me,communityColors:xe,onFocus:M})]})]}):d.jsx("p",{className:"compass-empty",children:"Select a node to inspect its relationships."})]}),b&&!t.stats.aggregated&&d.jsx(oZ,{nodes:t.nodes,query:s,selectedId:e?.id,onFocus:M}),t.effectiveGraph&&d.jsxs("section",{className:"compass-info-panel","aria-labelledby":"compass-agent-overlay-title",children:[d.jsxs("div",{className:"compass-section-heading",children:[d.jsx("h2",{id:"compass-agent-overlay-title",children:"Agent overlay"}),d.jsx("span",{children:"Exact revision"})]}),d.jsxs("dl",{className:"compass-metadata-grid",children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Pinned profile"}),d.jsx("dd",{children:t.effectiveGraph.compositionProfile})]}),d.jsxs("div",{children:[d.jsx("dt",{children:"Retractions"}),d.jsx("dd",{children:t.effectiveGraph.retractions.total.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("dt",{children:"Omissions"}),d.jsx("dd",{children:t.effectiveGraph.omissions.total.toLocaleString()})]}),d.jsxs("div",{className:"compass-metadata-wide",children:[d.jsx("dt",{children:"Overlay revision"}),d.jsx("dd",{title:t.effectiveGraph.overlayRevision,children:d.jsx("code",{children:t.effectiveGraph.overlayRevision.slice(0,12)})})]})]}),t.effectiveGraph.retractions.examples.length>0&&d.jsxs("details",{children:[d.jsxs("summary",{children:["Retraction history",d.jsx("span",{children:t.effectiveGraph.retractions.examples.length})]}),d.jsx("ul",{children:t.effectiveGraph.retractions.examples.map(Ce=>d.jsxs("li",{children:[d.jsx("strong",{children:Ce.kind})," ",d.jsx("code",{children:Ce.id})," — ",Ce.reasonCode,": ",Ce.explanation]},`${Ce.kind}:${Ce.id}`))}),t.effectiveGraph.retractions.omittedExamples>0&&d.jsxs("p",{className:"compass-empty",children:[t.effectiveGraph.retractions.omittedExamples.toLocaleString()," additional Retractions omitted by the response bound."]})]}),d.jsx("p",{className:"compass-empty",children:"Changing augment or curated profile requires a new exact Effective Graph read; this viewer never relabels one identity as another."})]}),!me&&d.jsx("section",{className:"compass-community-panel","aria-labelledby":"compass-communities-title","data-secondary":b,"data-collapsed":String(U),children:b?d.jsxs("details",{open:ue,onToggle:Ce=>z(Ce.currentTarget.open),children:[d.jsxs("summary",{id:"compass-communities-title",children:["Communities",d.jsx("span",{children:t.communities.length})]}),gt]}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{id:"compass-communities-title",children:"Communities"}),gt]})}),!me&&d.jsx("footer",{className:"compass-graph-stats",children:t.stats.aggregated?d.jsxs(d.Fragment,{children:[t.stats.communities.toLocaleString()," communities ·"," ",(be??0).toLocaleString()," symbols ·"," ",t.stats.edges.toLocaleString()," cross-community relationships",SkZ(t.communities,C,a),[a,t.communities,C]),h=E.useMemo(()=>{const m=C.trim().toLocaleLowerCase();return m?t.communities.filter(v=>v.label.toLocaleLowerCase().includes(m)||String(v.id).includes(m)).length:t.communities.length},[t.communities,C]);return d.jsxs("div",{className:"compass-community-controls",children:[d.jsxs("label",{className:"compass-community-control",children:[d.jsx("input",{type:"checkbox",checked:i,onChange:m=>o(m.target.checked)}),d.jsx("span",{children:"Select all"})]}),t.communities.length>Mu&&d.jsxs("label",{className:"compass-community-search",children:[d.jsx("span",{className:"sr-only",children:"Filter communities"}),d.jsx(v0,{"aria-hidden":"true"}),d.jsx("input",{type:"search",value:C,placeholder:"Filter communities",onChange:m=>c(m.target.value)})]}),d.jsx("div",{className:"compass-community-list",children:u.map(m=>{const v=!n.has(m.id);return d.jsxs("div",{className:"compass-community-item","data-hidden":!v,children:[d.jsxs("label",{children:[d.jsx("input",{type:"checkbox",checked:v,onChange:()=>s(m.id)}),d.jsx("span",{className:"compass-community-dot","aria-hidden":"true",style:{background:m.color}}),d.jsx("span",{className:"compass-community-label",children:m.label})]}),d.jsx("small",{children:e.get(m.id)??0}),l?d.jsx("button",{className:"compass-community-open",type:"button","aria-label":`Open group ${m.label}`,title:`Open community ${m.label}`,onClick:()=>l(m.id),children:d.jsx(MC,{"aria-hidden":"true"})}):null]},m.id)})}),h>u.length&&d.jsxs("p",{className:"compass-community-limit",role:"status",children:["Showing ",u.length.toLocaleString()," of"," ",h.toLocaleString()," communities. Filter to find another community."]})]})}function pw({className:t="compass-load-logo",variant:e="glyph"}){return d.jsxs("svg",{className:t,viewBox:e==="app"?"0 0 128 128":"0 0 24 24",fill:"none","aria-hidden":"true",children:[e==="app"&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:"6",y:"6",width:"116",height:"116",rx:"29",fill:"#5865F2"}),d.jsx("rect",{x:"7",y:"7",width:"114",height:"114",rx:"28",fill:"none",stroke:"#FFFFFF",strokeOpacity:".22",strokeWidth:"2"})]}),d.jsx("path",{transform:e==="app"?"translate(13.6 13.6) scale(4.2)":void 0,fill:e==="app"?"#FFFFFF":"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M3.554 21.529c1.797 1.221 4.943-.038 11.236-2.554 1.342-.537 2.013-.806 2.54-1.267q.201-.177.378-.378c.461-.527.73-1.198 1.267-2.54 2.515-6.293 3.775-9.44 2.554-11.236a4.1 4.1 0 0 0-1.083-1.083c-1.797-1.221-4.944.037-11.236 2.554-1.342.537-2.013.806-2.54 1.267q-.201.177-.378.378c-.461.527-.73 1.198-1.267 2.54-2.517 6.292-3.775 9.439-2.554 11.236.29.426.657.793 1.083 1.083M8.25 12a3.75 3.75 0 1 1 7.5 0 3.75 3.75 0 0 1-7.5 0m1.5 0a2.25 2.25 0 1 1 4.5 0 2.25 2.25 0 0 1-4.5 0"})]})}const PZ=1e4;function mw(t){const[e,n]=E.useState(!1);E.useEffect(()=>{if(t.kind!=="layout"){n(!1);return}const a=window.setTimeout(()=>{n(!0)},PZ);return()=>window.clearTimeout(a)},[t.kind]);const i=t.kind==="community",o=i?`Opening ${t.communityLabel}`:e?"Still arranging this graph":"Arranging graph layout",s=i?"Fetching symbols and relationships for this community.":e?"This graph is taking longer than expected. You can open the current layout now.":"Positioning nodes and relationships for a readable first view.";return d.jsxs("section",{className:"compass-graph-transition","data-kind":t.kind,role:"status","aria-live":"polite","aria-atomic":"true",children:[d.jsxs("div",{className:"compass-load-visual","data-state":"loading","aria-hidden":"true",children:[d.jsx("span",{className:"compass-load-mark",children:d.jsx(pw,{})}),d.jsx("span",{className:"compass-load-progress",children:d.jsx("i",{})})]}),d.jsxs("div",{className:"compass-load-copy",children:[d.jsx("span",{className:"compass-load-eyebrow",children:"Compass graph"}),d.jsx("h1",{children:o}),d.jsx("p",{className:"compass-graph-transition-description",children:s}),!i&&e&&d.jsx("div",{className:"compass-load-actions",children:d.jsx("button",{className:"compass-load-action compass-load-action-primary",type:"button",onClick:t.onShowGraph,children:"Show graph now"})})]})]})}var LZ=Object.defineProperty,Ru=(t,e)=>LZ(t,"name",{value:e,configurable:!0});function ku(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Ru(ku,"setRef");function vw(...t){return e=>{let n=!1;const i=t.map(o=>{const s=ku(o,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;oBZ(t,"name",{value:e,configurable:!0});function yr(t){const e=E.forwardRef((n,i)=>{let{children:o,...s}=n,a=null,l=!1;const C=[];Du(o)&&typeof ZC=="function"&&(o=ZC(o._payload)),E.Children.forEach(o,m=>{if(Sw(m)){l=!0;const v=m;let b="child"in v.props?v.props.child:v.props.children;Du(b)&&typeof ZC=="function"&&(b=ZC(b._payload)),a=GZ(v,b),C.push(a?.props?.children)}else C.push(m)}),a?a=E.cloneElement(a,void 0,C):!l&&E.Children.count(o)===1&&E.isValidElement(o)&&(a=o);const c=a?xw(a):void 0,u=en(i,c);if(!a){if(o||o===0)throw new Error(l?UZ(t):VZ(t));return o}const h=ww(s,a.props??{});return a.type!==E.Fragment&&(h.ref=i?u:c),E.cloneElement(a,h)});return e.displayName=`${t}.Slot`,e}Yi(yr,"createSlot");var yw=yr("Slot"),bw=Symbol.for("radix.slottable");function ZZ(t){const e=Yi(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=bw,e}Yi(ZZ,"createSlottable");var GZ=Yi((t,e)=>{if("child"in t.props){const n=t.props.child;return E.isValidElement(n)?E.cloneElement(n,void 0,t.props.children(n.props.children)):null}return E.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function ww(t,e){const n={...e};for(const i in e){const o=t[i],s=e[i];/^on[A-Z]/.test(i)?o&&s?n[i]=(...l)=>{const C=s(...l);return o(...l),C}:o&&(n[i]=o):i==="style"?n[i]={...o,...s}:i==="className"&&(n[i]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}Yi(ww,"mergeProps");function xw(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Yi(xw,"getElementRef");function Sw(t){return E.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===bw}Yi(Sw,"isSlottable");var FZ=Symbol.for("react.lazy");function Du(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===FZ&&"_payload"in t&&Ew(t._payload)}Yi(Du,"isLazyComponent");function Ew(t){return typeof t=="object"&&t!==null&&"then"in t}Yi(Ew,"isPromiseLike");var VZ=Yi(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),UZ=Yi(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),ZC=CA[" use ".trim().toString()],HZ=Object.defineProperty,YZ=(t,e)=>HZ(t,"name",{value:e,configurable:!0}),$Z=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Yn=$Z.reduce((t,e)=>{const n=yr(`Primitive.${e}`),i=E.forwardRef((o,s)=>{const{asChild:a,...l}=o,C=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(C,{...l,ref:s})});return i.displayName=`Primitive.${e}`,{...t,[e]:i}},{});function Tw(t,e){t&&bs.flushSync(()=>t.dispatchEvent(e))}YZ(Tw,"dispatchDiscreteCustomEvent");var WZ=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),KZ=Object.defineProperty,Ni=(t,e)=>KZ(t,"name",{value:e,configurable:!0});function XZ(t,e){const n=E.createContext(e);n.displayName=t+"Context";const i=Ni(s=>{const{children:a,...l}=s,C=E.useMemo(()=>l,Object.values(l));return d.jsx(n.Provider,{value:C,children:a})},"Provider");i.displayName=t+"Provider";function o(s,a={}){const{optional:l=!1}=a,C=E.useContext(n);if(C)return C;if(e!==void 0)return e;if(!l)throw new Error(`\`${s}\` must be used within \`${t}\``)}return Ni(o,"useContext"),[i,o]}Ni(XZ,"createContext");function dA(t,e=[]){let n=[];function i(s,a){const l=E.createContext(a);l.displayName=s+"Context";const C=n.length;n=[...n,a];const c=Ni(h=>{const{scope:m,children:v,...b}=h,x=m?.[t]?.[C]||l,y=E.useMemo(()=>b,Object.values(b));return d.jsx(x.Provider,{value:y,children:v})},"Provider");c.displayName=s+"Provider";function u(h,m,v={}){const{optional:b=!1}=v,x=m?.[t]?.[C]||l,y=E.useContext(x);if(y)return y;if(a!==void 0)return a;if(!b)throw new Error(`\`${h}\` must be used within \`${s}\``)}return Ni(u,"useContext"),[c,u]}Ni(i,"createContext");const o=Ni(()=>{const s=n.map(a=>E.createContext(a));return Ni(function(l){const C=l?.[t]||s;return E.useMemo(()=>({[`__scope${t}`]:{...l,[t]:C}}),[l,C])},"useScope")},"createScope");return o.scopeName=t,[i,Ow(o,...e)]}Ni(dA,"createContextScope");function Ow(...t){const e=t[0];if(t.length===1)return e;const n=Ni(()=>{const i=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return Ni(function(s){const a=i.reduce((l,{useScope:C,scopeName:c})=>{const h=C(s)[`__scope${c}`];return{...l,...h}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}Ni(Ow,"composeContextScopes");var QZ=Object.defineProperty,xn=(t,e)=>QZ(t,"name",{value:e,configurable:!0});function Nw(t){const e=t+"CollectionProvider",[n,i]=dA(e),[o,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=xn(x=>{const{scope:y,children:S}=x,T=E.useRef(null),O=E.useRef(new Map).current;return d.jsx(o,{scope:y,itemMap:O,collectionRef:T,children:S})},"CollectionProvider");a.displayName=e;const l=t+"CollectionSlot",C=yr(l),c=E.forwardRef((x,y)=>{const{scope:S,children:T}=x,O=s(l,S),M=en(y,O.collectionRef);return d.jsx(C,{ref:M,children:T})});c.displayName=l;const u=t+"CollectionItemSlot",h="data-radix-collection-item",m=yr(u),v=E.forwardRef((x,y)=>{const{scope:S,children:T,...O}=x,M=E.useRef(null),k=en(y,M),G=s(u,S);return E.useEffect(()=>(G.itemMap.set(M,{ref:M,...O}),()=>{G.itemMap.delete(M)})),d.jsx(m,{[h]:"",ref:k,children:T})});v.displayName=u;function b(x){const y=s(t+"CollectionConsumer",x);return E.useCallback(()=>{const T=y.collectionRef.current;if(!T)return[];const O=Array.from(T.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((G,L)=>O.indexOf(G.ref.current)-O.indexOf(L.ref.current))},[y.collectionRef,y.itemMap])}return xn(b,"useCollection"),[{Provider:a,Slot:c,ItemSlot:v},b,i]}xn(Nw,"createCollection");var Mw=new WeakMap,_u=(vi=class extends Map{constructor(n){super(n);M_(this,un);Ey(this,un,[...super.keys()]),Mw.set(this,!0)}set(n,i){return Mw.get(this)&&(this.has(n)?Un(this,un)[Un(this,un).indexOf(n)]=n:Un(this,un).push(n)),super.set(n,i),this}insert(n,i,o){const s=this.has(i),a=Un(this,un).length,l=ju(n);let C=l>=0?l:a+l;const c=C<0||C>=a?-1:C;if(c===this.size||s&&c===this.size-1||c===-1)return this.set(i,o),this;const u=this.size+(s?0:1);l<0&&C++;const h=[...Un(this,un)];let m,v=!1;for(let b=C;b=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,i){const o=this.indexOf(n);if(o===-1)return;let s=o+i;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,i){let o=0;for(const s of this){if(Reflect.apply(n,i,[s,o,this]))return s;o++}}findIndex(n,i){let o=0;for(const s of this){if(Reflect.apply(n,i,[s,o,this]))return o;o++}return-1}filter(n,i){const o=[];let s=0;for(const a of this)Reflect.apply(n,i,[a,s,this])&&o.push(a),s++;return new vi(o)}map(n,i){const o=[];let s=0;for(const a of this)o.push([a[0],Reflect.apply(n,i,[a,s,this])]),s++;return new vi(o)}reduce(...n){const[i,o]=n;let s=0,a=o??this.at(0);for(const l of this)s===0&&n.length===1?a=l:a=Reflect.apply(i,this,[a,l,s,this]),s++;return a}reduceRight(...n){const[i,o]=n;let s=o??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?s=l:s=Reflect.apply(i,this,[s,l,a,this])}return s}toSorted(n){const i=[...this.entries()].sort(n);return new vi(i)}toReversed(){const n=new vi;for(let i=this.size-1;i>=0;i--){const o=this.keyAt(i),s=this.get(o);n.set(o,s)}return n}toSpliced(...n){const i=[...this.entries()];return i.splice(...n),new vi(i)}slice(n,i){const o=new vi;let s=this.size-1;if(n===void 0)return o;n<0&&(n=n+this.size),i!==void 0&&i>0&&(s=i-1);for(let a=n;a<=s;a++){const l=this.keyAt(a),C=this.get(l);o.set(l,C)}return o}every(n,i){let o=0;for(const s of this){if(!Reflect.apply(n,i,[s,o,this]))return!1;o++}return!0}some(n,i){let o=0;for(const s of this){if(Reflect.apply(n,i,[s,o,this]))return!0;o++}return!1}},un=new WeakMap,xn(vi,"OrderedDict"),vi);function GC(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=Rw(t,e);return n===-1?void 0:t[n]}xn(GC,"at");function Rw(t,e){const n=t.length,i=ju(e),o=i>=0?i:n+i;return o<0||o>=n?-1:o}xn(Rw,"toSafeIndex");function ju(t){return t!==t||t===0?0:Math.trunc(t)}xn(ju,"toSafeInteger");function qZ(t){const e=t+"CollectionProvider",[n,i]=dA(e),[o,s]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new _u,setItemMap:xn(()=>{},"setItemMap")}),a=xn(({state:O,...M})=>O?d.jsx(C,{...M,state:O}):d.jsx(l,{...M}),"CollectionProvider");a.displayName=e;const l=xn(O=>{const M=y();return d.jsx(C,{...O,state:M})},"CollectionInit");l.displayName=e+"Init";const C=xn(O=>{const{scope:M,children:k,state:G}=O,L=E.useRef(null),[F,re]=E.useState(null),pe=en(L,re),[ie,J]=G;return E.useEffect(()=>{if(!F)return;const ve=_w(()=>{});return ve.observe(F,{childList:!0,subtree:!0}),()=>{ve.disconnect()}},[F]),d.jsx(o,{scope:M,itemMap:ie,setItemMap:J,collectionRef:pe,collectionRefObject:L,collectionElement:F,children:k})},"CollectionProviderImpl");C.displayName=e+"Impl";const c=t+"CollectionSlot",u=yr(c),h=E.forwardRef((O,M)=>{const{scope:k,children:G}=O,L=s(c,k),F=en(M,L.collectionRef);return d.jsx(u,{ref:F,children:G})});h.displayName=c;const m=t+"CollectionItemSlot",v="data-radix-collection-item",b=yr(m),x=E.forwardRef((O,M)=>{const{scope:k,children:G,...L}=O,F=E.useRef(null),[re,pe]=E.useState(null),ie=en(M,F,pe),J=s(m,k),{setItemMap:ve}=J,me=E.useRef(L);kw(me.current,L)||(me.current=L);const ue=me.current;return E.useEffect(()=>{const z=ue;return ve(U=>re?U.has(re)?U.set(re,{...z,element:re}).toSorted(zu):(U.set(re,{...z,element:re}),U.toSorted(zu)):U),()=>{ve(U=>!re||!U.has(re)?U:(U.delete(re),new _u(U)))}},[re,ue,ve]),d.jsx(b,{[v]:"",ref:ie,children:G})});x.displayName=m;function y(){return E.useState(new _u)}xn(y,"useInitCollection");function S(O){const{itemMap:M}=s(t+"CollectionConsumer",O);return M}return xn(S,"useCollection"),[{Provider:a,Slot:h,ItemSlot:x},{createCollectionScope:i,useCollection:S,useInitCollection:y}]}xn(qZ,"createCollection");function kw(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||t[o]!==e[o])return!1;return!0}xn(kw,"shallowEqual");function Dw(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}xn(Dw,"isElementPreceding");function zu(t,e){return!t[1].element||!e[1].element?0:Dw(t[1].element,e[1].element)?-1:1}xn(zu,"sortByDocumentPosition");function _w(t){return new MutationObserver(n=>{for(const i of n)if(i.type==="childList"){t();return}})}xn(_w,"getChildListObserver");var JZ=Object.defineProperty,Sg=(t,e)=>JZ(t,"name",{value:e,configurable:!0}),jw=!!(typeof window<"u"&&window.document&&window.document.createElement);function tn(t,e,{checkForDefaultPrevented:n=!0}={}){return Sg(function(o){if(t?.(o),n===!1||!o||!o.defaultPrevented)return e?.(o)},"handleEvent")}Sg(tn,"composeEventHandlers");function e6(t){if(!jw)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}Sg(e6,"getOwnerWindow");function Pu(t){if(!jw)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}Sg(Pu,"getOwnerDocument");function zw(t,e=!1){const{activeElement:n}=Pu(t);if(!n?.nodeName)return null;if(Pw(n)&&n.contentDocument)return zw(n.contentDocument.body,e);if(e){const i=n.getAttribute("aria-activedescendant");if(i){const o=Pu(n).getElementById(i);if(o)return o}}return n}Sg(zw,"getActiveElement");function Pw(t){return t.tagName==="IFRAME"}Sg(Pw,"isFrame");var Sn=globalThis?.document?E.useLayoutEffect:()=>{},t6=Object.defineProperty,n6=(t,e)=>t6(t,"name",{value:e,configurable:!0}),Lw=CA[" useEffectEvent ".trim().toString()],Bw=CA[" useInsertionEffect ".trim().toString()];function Zw(t){if(typeof Lw=="function")return Lw(t);const e=E.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Bw=="function"?Bw(()=>{e.current=t}):Sn(()=>{e.current=t}),E.useMemo(()=>((...n)=>e.current?.(...n)),[])}n6(Zw,"useEffectEvent");var i6=Object.defineProperty,uA=(t,e)=>i6(t,"name",{value:e,configurable:!0}),o6=CA[" useInsertionEffect ".trim().toString()]||Sn;function Lu({prop:t,defaultProp:e,onChange:n=uA(()=>{},"onChange"),caller:i}){const[o,s,a]=Gw({defaultProp:e,onChange:n}),l=t!==void 0,C=l?t:o,c=E.useCallback(u=>{if(l){const h=Fw(u)?u(t):u;h!==t&&a.current?.(h)}else s(u)},[l,t,s,a]);return[C,c]}uA(Lu,"useControllableState");function Gw({defaultProp:t,onChange:e}){const[n,i]=E.useState(t),o=E.useRef(n),s=E.useRef(e);return o6(()=>{s.current=e},[e]),E.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,i,s]}uA(Gw,"useUncontrolledState");function Fw(t){return typeof t=="function"}uA(Fw,"isFunction");var Vw=Symbol("RADIX:SYNC_STATE");function r6(t,e,n,i){const{prop:o,defaultProp:s,onChange:a,caller:l}=e,C=o!==void 0,c=Zw(a),u=[{...n,state:s}];i&&u.push(i);const[h,m]=E.useReducer((y,S)=>{if(S.type===Vw)return{...y,state:S.state};const T=t(y,S);return C&&!Object.is(T.state,y.state)&&c(T.state),T},...u),v=h.state,b=E.useRef(v);E.useEffect(()=>{b.current!==v&&(b.current=v,C||c(v))},[v,b,C]);const x=E.useMemo(()=>o!==void 0?{...h,state:o}:h,[h,o]);return E.useEffect(()=>{C&&!Object.is(o,h.state)&&m({type:Vw,state:o})},[o,h.state,C]),[x,m]}uA(r6,"useControllableStateReducer");var s6=Object.defineProperty,zo=(t,e)=>s6(t,"name",{value:e,configurable:!0});function Uw(t,e){return E.useReducer((n,i)=>e[n][i]??n,t)}zo(Uw,"useStateMachine");var g6=zo(t=>{const{present:e,children:n}=t,i=Hw(e),o=typeof n=="function"?n({present:i.isPresent}):E.Children.only(n),s=Yw(i.ref,$w(o));return typeof n=="function"||i.isPresent?E.cloneElement(o,{ref:s}):null},"Presence");function Hw(t){const[e,n]=E.useState(),i=E.useRef(null),o=E.useRef(t),s=E.useRef("none"),a=E.useRef(void 0),l=t?"mounted":"unmounted",[C,c]=Uw(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{C==="mounted"?(s.current=a.current??Eg(i.current),a.current=void 0):s.current="none"},[C]),Sn(()=>{const u=i.current,h=o.current;if(h!==t){const v=s.current,b=Eg(u);t?(a.current=b,c("MOUNT")):b==="none"||u?.display==="none"?c("UNMOUNT"):c(h&&v!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,c]),Sn(()=>{if(e){let u;const h=e.ownerDocument.defaultView??window,m=zo(b=>{const y=Eg(i.current).includes(CSS.escape(b.animationName));if(b.target===e&&y&&(c("ANIMATION_END"),!o.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",u=h.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},"handleAnimationEnd"),v=zo(b=>{b.target===e&&(s.current=Eg(i.current))},"handleAnimationStart");return e.addEventListener("animationstart",v),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{h.clearTimeout(u),e.removeEventListener("animationstart",v),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(C),ref:E.useCallback(u=>{if(u){const h=getComputedStyle(u);i.current=h,a.current=Eg(h)}else i.current=null;n(u)},[])}}zo(Hw,"usePresence");function Bu(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}zo(Bu,"setRef");function Yw(...t){const e=E.useRef(t);return e.current=t,E.useCallback(n=>{const i=e.current;let o=!1;const s=i.map(a=>{const l=Bu(a,n);return!o&&typeof l=="function"&&(o=!0),l});if(o)return()=>{for(let a=0;aa6(t,"name",{value:e,configurable:!0}),l6=CA[" useId ".trim().toString()]||(()=>{}),C6=0;function Zu(t){const[e,n]=E.useState(l6());return Sn(()=>{t||n(i=>i??String(C6++))},[t]),t||(e?`radix-${e}`:"")}A6(Zu,"useId");var I6=Object.defineProperty,c6=(t,e)=>I6(t,"name",{value:e,configurable:!0}),d6=E.createContext(void 0);function Ww(t){const e=E.useContext(d6);return t||e||"ltr"}c6(Ww,"useDirection");var u6=Object.defineProperty,h6=(t,e)=>u6(t,"name",{value:e,configurable:!0});function lo(t){const e=E.useRef(t);return E.useEffect(()=>{e.current=t}),E.useMemo(()=>((...n)=>e.current?.(...n)),[])}h6(lo,"useCallbackRef");var f6=Object.defineProperty,En=(t,e)=>f6(t,"name",{value:e,configurable:!0}),Gu="dismissableLayer.update",p6="dismissableLayer.pointerDownOutside",m6="dismissableLayer.focusOutside",Kw,Xw=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),v6=E.forwardRef(En(function(e,n){const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:C,onDismiss:c,...u}=e,h=E.useContext(Xw),[m,v]=E.useState(null),b=m?.ownerDocument??globalThis?.document,[,x]=E.useState({}),y=en(n,v),S=Array.from(h.layers),[T]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),O=T?S.indexOf(T):-1,M=m?S.indexOf(m):-1,k=h.layersWithOutsidePointerEventsDisabled.size>0,G=M>=O,L=E.useRef(!1),F=Qw(J=>{a?.(J),C?.(J),J.defaultPrevented||c?.()},{ownerDocument:b,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:E.useCallback(J=>{if(!(J instanceof Node))return!1;const ve=[...h.branches].some(me=>me.contains(J));return G&&!ve},[h.branches,G])}),re=qw(J=>{if(o&&L.current)return;const ve=J.target;[...h.branches].some(ue=>ue.contains(ve))||(l?.(J),C?.(J),J.defaultPrevented||c?.())},b),pe=m?M===S.length-1:!1,ie=lo(J=>{J.key==="Escape"&&(s?.(J),!J.defaultPrevented&&c&&(J.preventDefault(),c()))});return E.useEffect(()=>{if(pe)return b.addEventListener("keydown",ie,{capture:!0}),()=>b.removeEventListener("keydown",ie,{capture:!0})},[b,pe,ie]),E.useEffect(()=>{if(m)return i&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Kw=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(m)),h.layers.add(m),Fu(),()=>{i&&(h.layersWithOutsidePointerEventsDisabled.delete(m),h.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=Kw))}},[m,b,i,h]),E.useEffect(()=>()=>{m&&(h.layers.delete(m),h.layersWithOutsidePointerEventsDisabled.delete(m),Fu())},[m,h]),E.useEffect(()=>{const J=En(()=>x({}),"handleUpdate");return document.addEventListener(Gu,J),()=>document.removeEventListener(Gu,J)},[]),d.jsx(Yn.div,{...u,ref:y,style:{pointerEvents:k?G?"auto":"none":void 0,...e.style},onFocusCapture:tn(e.onFocusCapture,re.onFocusCapture),onBlurCapture:tn(e.onBlurCapture,re.onBlurCapture),onPointerDownCapture:tn(e.onPointerDownCapture,F.onPointerDownCapture)})},"DismissableLayer"));function y6(){const t=E.useContext(Xw),[e,n]=E.useState(null);return E.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}En(y6,"useDismissableLayerSurface");var b6=En(()=>!0,"IS_TRUE");function Qw(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=b6}=e,l=lo(t),C=E.useRef(!1),c=E.useRef(!1),u=E.useRef(new Map),h=E.useRef(()=>{});return E.useEffect(()=>{function m(){c.current=!1,o.current=!1,u.current.clear()}En(m,"resetOutsideInteraction");function v(){return Array.from(u.current.values()).some(Boolean)}En(v,"isOutsideInteractionIntercepted");function b(O){if(!c.current)return;const M=O.target;M instanceof Node&&[...s].some(G=>G.contains(M))||u.current.set(O.type,!0),O.type==="click"&&window.setTimeout(()=>{c.current&&h.current()},0)}En(b,"handleInteractionCapture");function x(O){c.current&&u.current.set(O.type,!1)}En(x,"handleInteractionBubble");const y=En(O=>{if(O.target&&!C.current){let M=function(){n.removeEventListener("click",h.current);const G=v();m(),G||Vu(p6,l,k,{discrete:!0})};if(En(M,"handleAndDispatchPointerDownOutsideEvent"),!a(O.target)){n.removeEventListener("click",h.current),m(),C.current=!1;return}const k={originalEvent:O};c.current=!0,o.current=i&&O.button===0,u.current.clear(),!i||O.button!==0?M():(n.removeEventListener("click",h.current),h.current=M,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),m();C.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const O of S)n.addEventListener(O,b,!0),n.addEventListener(O,x);const T=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(T),n.removeEventListener("pointerdown",y),n.removeEventListener("click",h.current);for(const O of S)n.removeEventListener(O,b,!0),n.removeEventListener(O,x)}},[n,l,i,o,s,a]),{onPointerDownCapture:En(()=>C.current=!0,"onPointerDownCapture")}}En(Qw,"usePointerDownOutside");function qw(t,e=globalThis?.document){const n=lo(t),i=E.useRef(!1);return E.useEffect(()=>{const o=En(s=>{s.target&&!i.current&&Vu(m6,n,{originalEvent:s},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:En(()=>i.current=!0,"onFocusCapture"),onBlurCapture:En(()=>i.current=!1,"onBlurCapture")}}En(qw,"useFocusOutside");function Fu(){const t=new CustomEvent(Gu);document.dispatchEvent(t)}En(Fu,"dispatchUpdate");function Vu(t,e,n,{discrete:i}){const o=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),i?Tw(o,s):o.dispatchEvent(s)}En(Vu,"handleAndDispatchCustomEvent");var w6=Object.defineProperty,$n=(t,e)=>w6(t,"name",{value:e,configurable:!0}),Uu="focusScope.autoFocusOnMount",Hu="focusScope.autoFocusOnUnmount",Jw={bubbles:!1,cancelable:!0},x6=E.forwardRef($n(function(e,n){const{loop:i=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=e,[C,c]=E.useState(null),u=lo(s),h=lo(a),m=E.useRef(null),v=en(n,c),b=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(o){let y=function(M){if(b.paused||!C)return;const k=M.target;C.contains(k)?m.current=k:Po(m.current,{select:!0})},S=function(M){if(b.paused||!C)return;const k=M.relatedTarget;k!==null&&(C.contains(k)||Po(m.current,{select:!0}))},T=function(M){if(document.activeElement===document.body)for(const G of M)G.removedNodes.length>0&&Po(C)};$n(y,"handleFocusIn"),$n(S,"handleFocusOut"),$n(T,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",S);const O=new MutationObserver(T);return C&&O.observe(C,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[o,C,b.paused]),E.useEffect(()=>{if(C){ox.add(b);const y=document.activeElement;if(!C.contains(y)){const T=new CustomEvent(Uu,Jw);C.addEventListener(Uu,u),C.dispatchEvent(T),T.defaultPrevented||(ex(sx(Yu(C)),{select:!0}),document.activeElement===y&&Po(C))}return()=>{C.removeEventListener(Uu,u),setTimeout(()=>{const T=new CustomEvent(Hu,Jw);C.addEventListener(Hu,h),C.dispatchEvent(T),T.defaultPrevented||Po(y??document.body,{select:!0}),C.removeEventListener(Hu,h),ox.remove(b)},0)}}},[C,u,h,b]);const x=E.useCallback(y=>{if(!i&&!o||b.paused)return;const S=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,T=document.activeElement;if(S&&T){const O=y.currentTarget,[M,k]=tx(O);M&&k?!y.shiftKey&&T===k?(y.preventDefault(),i&&Po(M,{select:!0})):y.shiftKey&&T===M&&(y.preventDefault(),i&&Po(k,{select:!0})):T===O&&y.preventDefault()}},[i,o,b.paused]);return d.jsx(Yn.div,{tabIndex:-1,...l,ref:v,onKeyDown:x})},"FocusScope"));function ex(t,{select:e=!1}={}){const n=document.activeElement;for(const i of t)if(Po(i,{select:e}),document.activeElement!==n)return}$n(ex,"focusFirst");function tx(t){const e=Yu(t),n=$u(e,t),i=$u(e.reverse(),t);return[n,i]}$n(tx,"getTabbableEdges");function Yu(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:$n(i=>{const o=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||o?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}$n(Yu,"getTabbableCandidates");function $u(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const i of t)if(!(n?!i.checkVisibility({checkVisibilityCSS:!0}):nx(i,{upTo:e})))return i}$n($u,"findVisible");function nx(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}$n(nx,"isHidden");function ix(t){return t instanceof HTMLInputElement&&"select"in t}$n(ix,"isSelectableInput");function Po(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&ix(t)&&e&&t.select()}}$n(Po,"focus");var ox=rx();function rx(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=Wu(t,e),t.unshift(e)},remove(e){t=Wu(t,e),t[0]?.resume()}}}$n(rx,"createFocusScopesStack");function Wu(t,e){const n=[...t],i=n.indexOf(e);return i!==-1&&n.splice(i,1),n}$n(Wu,"arrayRemove");function sx(t){return t.filter(e=>e.tagName!=="A")}$n(sx,"removeLinks");var S6=Object.defineProperty,E6=(t,e)=>S6(t,"name",{value:e,configurable:!0}),T6=E.forwardRef(E6(function(e,n){const{container:i,...o}=e,[s,a]=E.useState(!1);Sn(()=>a(!0),[]);const l=i||s&&globalThis?.document?.body;return l?bs.createPortal(d.jsx(Yn.div,{...o,ref:n}),l):null},"Portal")),O6=Object.defineProperty,Ku=(t,e)=>O6(t,"name",{value:e,configurable:!0}),FC=0,Tg=null;function N6(t){return Xu(),t.children}Ku(N6,"FocusGuards");function Xu(){E.useEffect(()=>{Tg||(Tg={start:Qu(),end:Qu()});const{start:t,end:e}=Tg;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),FC++,()=>{FC===1&&(Tg?.start.remove(),Tg?.end.remove(),Tg=null),FC=Math.max(0,FC-1)}},[])}Ku(Xu,"useFocusGuards");function Qu(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}Ku(Qu,"createFocusGuard");var Co=function(){return Co=Object.assign||function(e){for(var n,i=1,o=arguments.length;i"u")return Y6;var e=$6(t),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,i-n+e[2]-e[0])}},K6=Cx(),Og="data-scroll-locked",X6=function(t,e,n,i){var o=t.left,s=t.top,a=t.right,l=t.gap;return n===void 0&&(n="margin"),` +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const a of t.seen.entries()){const l=a[1];if(e===a[0]){s(a);continue}if(t.external){const c=t.external.registry.get(a[0])?.id;if(e!==a[0]&&c){s(a);continue}}if(t.metadataRegistry.get(a[0])?.id){s(a);continue}if(l.cycle){s(a);continue}if(l.count>1&&t.reused==="ref"){s(a);continue}}}function Sb(t,e){const n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=l=>{const C=t.seen.get(l);if(C.ref===null)return;const c=C.def??C.schema,u={...c},h=C.ref;if(C.ref=null,h){i(h);const v=t.seen.get(h),b=v.schema;if(b.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(c.allOf=c.allOf??[],c.allOf.push(b)):Object.assign(c,b),Object.assign(c,u),l._zod.parent===h)for(const y in c)y==="$ref"||y==="allOf"||y in u||delete c[y];if(b.$ref&&v.def)for(const y in c)y==="$ref"||y==="allOf"||y in v.def&&JSON.stringify(c[y])===JSON.stringify(v.def[y])&&delete c[y]}const m=l._zod.parent;if(m&&m!==h){i(m);const v=t.seen.get(m);if(v?.schema.$ref&&(c.$ref=v.schema.$ref,v.def))for(const b in c)b==="$ref"||b==="allOf"||b in v.def&&JSON.stringify(c[b])===JSON.stringify(v.def[b])&&delete c[b]}t.override({zodSchema:l,jsonSchema:c,path:C.path??[]})};for(const l of[...t.seen.entries()].reverse())i(l[0]);const o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){const l=t.external.registry.get(e)?.id;if(!l)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(l)}Object.assign(o,n.def??n.schema);const s=t.metadataRegistry.get(e)?.id;s!==void 0&&o.id===s&&delete o.id;const a=t.external?.defs??{};for(const l of t.seen.entries()){const C=l[1];C.def&&C.defId&&(C.def.id===C.defId&&delete C.def.id,a[C.defId]=C.def)}t.external||Object.keys(a).length>0&&(t.target==="draft-2020-12"?o.$defs=a:o.definitions=a);try{const l=JSON.parse(JSON.stringify(o));return Object.defineProperty(l,"~standard",{value:{...e["~standard"],jsonSchema:{input:xC(e,"input",t.processors),output:xC(e,"output",t.processors)}},enumerable:!1,writable:!1}),l}catch{throw new Error("Error converting schema to JSON.")}}function Hn(t,e){const n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);const i=t._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return Hn(i.element,n);if(i.type==="set")return Hn(i.valueType,n);if(i.type==="lazy")return Hn(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault")return Hn(i.innerType,n);if(i.type==="intersection")return Hn(i.left,n)||Hn(i.right,n);if(i.type==="record"||i.type==="map")return Hn(i.keyType,n)||Hn(i.valueType,n);if(i.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:Hn(i.in,n)||Hn(i.out,n);if(i.type==="object"){for(const o in i.shape)if(Hn(i.shape[o],n))return!0;return!1}if(i.type==="union"){for(const o of i.options)if(Hn(o,n))return!0;return!1}if(i.type==="tuple"){for(const o of i.items)if(Hn(o,n))return!0;return!!(i.rest&&Hn(i.rest,n))}return!1}const B3=(t,e={})=>n=>{const i=wb({...n,processors:e});return ln(t,i),xb(i,t),Sb(i,t)},xC=(t,e,n={})=>i=>{const{libraryOptions:o,target:s}=i??{},a=wb({...o??{},target:s,io:e,processors:n});return ln(t,a),xb(a,t),Sb(a,t)},Z3={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},G3=(t,e,n,i)=>{const o=n;o.type="string";const{minimum:s,maximum:a,format:l,patterns:C,contentEncoding:c}=t._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof a=="number"&&(o.maxLength=a),l&&(o.format=Z3[l]??l,o.format===""&&delete o.format,l==="time"&&delete o.format),c&&(o.contentEncoding=c),C&&C.size>0){const u=[...C];u.length===1?o.pattern=u[0].source:u.length>1&&(o.allOf=[...u.map(h=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},F3=(t,e,n,i)=>{const o=n,{minimum:s,maximum:a,format:l,multipleOf:C,exclusiveMaximum:c,exclusiveMinimum:u}=t._zod.bag;typeof l=="string"&&l.includes("int")?o.type="integer":o.type="number";const h=typeof u=="number"&&u>=(s??Number.NEGATIVE_INFINITY),m=typeof c=="number"&&c<=(a??Number.POSITIVE_INFINITY),v=e.target==="draft-04"||e.target==="openapi-3.0";h?v?(o.minimum=u,o.exclusiveMinimum=!0):o.exclusiveMinimum=u:typeof s=="number"&&(o.minimum=s),m?v?(o.maximum=c,o.exclusiveMaximum=!0):o.exclusiveMaximum=c:typeof a=="number"&&(o.maximum=a),typeof C=="number"&&(o.multipleOf=C)},V3=(t,e,n,i)=>{n.type="boolean"},U3=(t,e,n,i)=>{n.not={}},H3=(t,e,n,i)=>{},Y3=(t,e,n,i)=>{const o=t._zod.def,s=Zy(o.entries);s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),n.enum=s},$3=(t,e,n,i)=>{const o=t._zod.def,s=[];for(const a of o.values)if(a===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof a=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(a))}else s.push(a);if(s.length!==0)if(s.length===1){const a=s[0];n.type=a===null?"null":typeof a,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[a]:n.const=a}else s.every(a=>typeof a=="number")&&(n.type="number"),s.every(a=>typeof a=="string")&&(n.type="string"),s.every(a=>typeof a=="boolean")&&(n.type="boolean"),s.every(a=>a===null)&&(n.type="null"),n.enum=s},W3=(t,e,n,i)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},K3=(t,e,n,i)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},X3=(t,e,n,i)=>{const o=n,s=t._zod.def,{minimum:a,maximum:l}=t._zod.bag;typeof a=="number"&&(o.minItems=a),typeof l=="number"&&(o.maxItems=l),o.type="array",o.items=ln(s.element,e,{...i,path:[...i.path,"items"]})},Q3=(t,e,n,i)=>{const o=n,s=t._zod.def;o.type="object",o.properties={};const a=s.shape;for(const c in a)o.properties[c]=ln(a[c],e,{...i,path:[...i.path,"properties",c]});const l=new Set(Object.keys(a)),C=new Set([...l].filter(c=>{const u=s.shape[c]._zod;return e.io==="input"?u.optin===void 0:u.optout===void 0}));C.size>0&&(o.required=Array.from(C)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=ln(s.catchall,e,{...i,path:[...i.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},q3=(t,e,n,i)=>{const o=t._zod.def,s=o.inclusive===!1,a=o.options.map((l,C)=>ln(l,e,{...i,path:[...i.path,s?"oneOf":"anyOf",C]}));s?n.oneOf=a:n.anyOf=a},J3=(t,e,n,i)=>{const o=t._zod.def,s=ln(o.left,e,{...i,path:[...i.path,"allOf",0]}),a=ln(o.right,e,{...i,path:[...i.path,"allOf",1]}),l=c=>"allOf"in c&&Object.keys(c).length===1,C=[...l(s)?s.allOf:[s],...l(a)?a.allOf:[a]];n.allOf=C},e5=(t,e,n,i)=>{const o=n,s=t._zod.def;o.type="object";const a=s.keyType,C=a._zod.bag?.patterns;if(s.mode==="loose"&&C&&C.size>0){const u=ln(s.valueType,e,{...i,path:[...i.path,"patternProperties","*"]});o.patternProperties={};for(const h of C)o.patternProperties[h.source]=u}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=ln(s.keyType,e,{...i,path:[...i.path,"propertyNames"]})),o.additionalProperties=ln(s.valueType,e,{...i,path:[...i.path,"additionalProperties"]});const c=a._zod.values;if(c){const u=[...c].filter(h=>typeof h=="string"||typeof h=="number");u.length>0&&(o.required=u)}},t5=(t,e,n,i)=>{const o=t._zod.def,s=ln(o.innerType,e,i),a=e.seen.get(t);e.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},n5=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType},i5=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},o5=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},r5=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},s5=(t,e,n,i)=>{const o=t._zod.def,s=o.in._zod.traits.has("$ZodTransform"),a=e.io==="input"?s?o.out:o.in:o.out;ln(a,e,i);const l=e.seen.get(t);l.ref=a},g5=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType,n.readOnly=!0},Eb=(t,e,n,i)=>{const o=t._zod.def;ln(o.innerType,e,i);const s=e.seen.get(t);s.ref=o.innerType},a5=ne("ZodISODateTime",(t,e)=>{Az.init(t,e),Vt.init(t,e)});function A5(t){return u3(a5,t)}const l5=ne("ZodISODate",(t,e)=>{lz.init(t,e),Vt.init(t,e)});function C5(t){return h3(l5,t)}const I5=ne("ZodISOTime",(t,e)=>{Cz.init(t,e),Vt.init(t,e)});function c5(t){return f3(I5,t)}const d5=ne("ZodISODuration",(t,e)=>{Iz.init(t,e),Vt.init(t,e)});function u5(t){return p3(d5,t)}const Oi=ne("ZodError",(t,e)=>{Yy.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>tj(t,n)},flatten:{value:n=>ej(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,Jd,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,Jd,2)}},isEmpty:{get(){return t.issues.length===0}}})},{Parent:Error}),h5=iu(Oi),f5=ou(Oi),p5=pC(Oi),m5=mC(Oi),v5=oj(Oi),y5=rj(Oi),b5=sj(Oi),w5=gj(Oi),x5=aj(Oi),S5=Aj(Oi),E5=lj(Oi),T5=Cj(Oi),Tb=new WeakMap;function aA(t,e,n){const i=Object.getPrototypeOf(t);let o=Tb.get(i);if(o||(o=new Set,Tb.set(i,o)),!o.has(e)){o.add(e);for(const s in n){const a=n[s];Object.defineProperty(i,s,{configurable:!0,enumerable:!1,get(){const l=a.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:l}),l},set(l){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:l})}})}}}const Ft=ne("ZodType",(t,e)=>(Gt.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:xC(t,"input"),output:xC(t,"output")}}),t.toJSONSchema=B3(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,i)=>h5(t,n,i,{callee:t.parse}),t.safeParse=(n,i)=>p5(t,n,i),t.parseAsync=async(n,i)=>f5(t,n,i,{callee:t.parseAsync}),t.safeParseAsync=async(n,i)=>m5(t,n,i),t.spa=t.safeParseAsync,t.encode=(n,i)=>v5(t,n,i),t.decode=(n,i)=>y5(t,n,i),t.encodeAsync=async(n,i)=>b5(t,n,i),t.decodeAsync=async(n,i)=>w5(t,n,i),t.safeEncode=(n,i)=>x5(t,n,i),t.safeDecode=(n,i)=>S5(t,n,i),t.safeEncodeAsync=async(n,i)=>E5(t,n,i),t.safeDecodeAsync=async(n,i)=>T5(t,n,i),aA(t,"ZodType",{check(...n){const i=this.def;return this.clone(mr(i,{checks:[...i.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,i){return vr(this,n,i)},brand(){return this},register(n,i){return n.add(this,i),this},refine(n,i){return this.check(fP(n,i))},superRefine(n,i){return this.check(pP(n,i))},overwrite(n){return this.check(mg(n))},optional(){return Lb(this)},exactOptional(){return oP(this)},nullable(){return Bb(this)},nullish(){return Lb(Bb(this))},nonoptional(n){return lP(this,n)},array(){return Oe(this)},or(n){return jb([this,n])},and(n){return J5(this,n)},transform(n){return Gb(this,nP(n))},default(n){return gP(this,n)},prefault(n){return AP(this,n)},catch(n){return IP(this,n)},pipe(n){return Gb(this,n)},readonly(){return uP(this)},describe(n){const i=this.clone();return gA.add(i,{description:n}),i},meta(...n){if(n.length===0)return gA.get(this);const i=this.clone();return gA.add(i,n[0]),i},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(t,"description",{get(){return gA.get(t)?.description},configurable:!0}),t)),Ob=ne("_ZodString",(t,e)=>{ru.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(i,o,s)=>G3(t,i,o);const n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,aA(t,"_ZodString",{regex(...i){return this.check(x3(...i))},includes(...i){return this.check(T3(...i))},startsWith(...i){return this.check(O3(...i))},endsWith(...i){return this.check(N3(...i))},min(...i){return this.check(wC(...i))},max(...i){return this.check(yb(...i))},length(...i){return this.check(bb(...i))},nonempty(...i){return this.check(wC(1,...i))},lowercase(i){return this.check(S3(i))},uppercase(i){return this.check(E3(i))},trim(){return this.check(R3())},normalize(...i){return this.check(M3(...i))},toLowerCase(){return this.check(k3())},toUpperCase(){return this.check(D3())},slugify(){return this.check(_3())}})}),O5=ne("ZodString",(t,e)=>{ru.init(t,e),Ob.init(t,e),t.email=n=>t.check(Wz(N5,n)),t.url=n=>t.check(Jz(M5,n)),t.jwt=n=>t.check(d3(H5,n)),t.emoji=n=>t.check(e3(R5,n)),t.guid=n=>t.check(fb(Nb,n)),t.uuid=n=>t.check(Kz(SC,n)),t.uuidv4=n=>t.check(Xz(SC,n)),t.uuidv6=n=>t.check(Qz(SC,n)),t.uuidv7=n=>t.check(qz(SC,n)),t.nanoid=n=>t.check(t3(k5,n)),t.guid=n=>t.check(fb(Nb,n)),t.cuid=n=>t.check(n3(D5,n)),t.cuid2=n=>t.check(i3(_5,n)),t.ulid=n=>t.check(o3(j5,n)),t.base64=n=>t.check(C3(F5,n)),t.base64url=n=>t.check(I3(V5,n)),t.xid=n=>t.check(r3(z5,n)),t.ksuid=n=>t.check(s3(P5,n)),t.ipv4=n=>t.check(g3(L5,n)),t.ipv6=n=>t.check(a3(B5,n)),t.cidrv4=n=>t.check(A3(Z5,n)),t.cidrv6=n=>t.check(l3(G5,n)),t.e164=n=>t.check(c3(U5,n)),t.datetime=n=>t.check(A5(n)),t.date=n=>t.check(C5(n)),t.time=n=>t.check(c5(n)),t.duration=n=>t.check(u5(n))});function _(t){return $z(O5,t)}const Vt=ne("ZodStringFormat",(t,e)=>{Bt.init(t,e),Ob.init(t,e)}),N5=ne("ZodEmail",(t,e)=>{ez.init(t,e),Vt.init(t,e)}),Nb=ne("ZodGUID",(t,e)=>{qj.init(t,e),Vt.init(t,e)}),SC=ne("ZodUUID",(t,e)=>{Jj.init(t,e),Vt.init(t,e)}),M5=ne("ZodURL",(t,e)=>{tz.init(t,e),Vt.init(t,e)}),R5=ne("ZodEmoji",(t,e)=>{nz.init(t,e),Vt.init(t,e)}),k5=ne("ZodNanoID",(t,e)=>{iz.init(t,e),Vt.init(t,e)}),D5=ne("ZodCUID",(t,e)=>{oz.init(t,e),Vt.init(t,e)}),_5=ne("ZodCUID2",(t,e)=>{rz.init(t,e),Vt.init(t,e)}),j5=ne("ZodULID",(t,e)=>{sz.init(t,e),Vt.init(t,e)}),z5=ne("ZodXID",(t,e)=>{gz.init(t,e),Vt.init(t,e)}),P5=ne("ZodKSUID",(t,e)=>{az.init(t,e),Vt.init(t,e)}),L5=ne("ZodIPv4",(t,e)=>{cz.init(t,e),Vt.init(t,e)}),B5=ne("ZodIPv6",(t,e)=>{dz.init(t,e),Vt.init(t,e)}),Z5=ne("ZodCIDRv4",(t,e)=>{uz.init(t,e),Vt.init(t,e)}),G5=ne("ZodCIDRv6",(t,e)=>{hz.init(t,e),Vt.init(t,e)}),F5=ne("ZodBase64",(t,e)=>{fz.init(t,e),Vt.init(t,e)}),V5=ne("ZodBase64URL",(t,e)=>{mz.init(t,e),Vt.init(t,e)}),U5=ne("ZodE164",(t,e)=>{vz.init(t,e),Vt.init(t,e)}),H5=ne("ZodJWT",(t,e)=>{bz.init(t,e),Vt.init(t,e)}),Mb=ne("ZodNumber",(t,e)=>{ib.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(i,o,s)=>F3(t,i,o),aA(t,"ZodNumber",{gt(i,o){return this.check(mb(i,o))},gte(i,o){return this.check(au(i,o))},min(i,o){return this.check(au(i,o))},lt(i,o){return this.check(pb(i,o))},lte(i,o){return this.check(gu(i,o))},max(i,o){return this.check(gu(i,o))},int(i){return this.check(Rb(i))},safe(i){return this.check(Rb(i))},positive(i){return this.check(mb(0,i))},nonnegative(i){return this.check(au(0,i))},negative(i){return this.check(pb(0,i))},nonpositive(i){return this.check(gu(0,i))},multipleOf(i,o){return this.check(vb(i,o))},step(i,o){return this.check(vb(i,o))},finite(){return this}});const n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function Z(t){return m3(Mb,t)}const Y5=ne("ZodNumberFormat",(t,e)=>{wz.init(t,e),Mb.init(t,e)});function Rb(t){return v3(Y5,t)}const $5=ne("ZodBoolean",(t,e)=>{xz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>V3(t,n,i)});function Yt(t){return y3($5,t)}const W5=ne("ZodUnknown",(t,e)=>{Sz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>H3()});function _o(){return b3(W5)}const K5=ne("ZodNever",(t,e)=>{Ez.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>U3(t,n,i)});function kb(t){return w3(K5,t)}const X5=ne("ZodArray",(t,e)=>{Tz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>X3(t,n,i,o),t.element=e.element,aA(t,"ZodArray",{min(n,i){return this.check(wC(n,i))},nonempty(n){return this.check(wC(1,n))},max(n,i){return this.check(yb(n,i))},length(n,i){return this.check(bb(n,i))},unwrap(){return this.element}})});function Oe(t,e){return j3(X5,t,e)}const Db=ne("ZodObject",(t,e)=>{Nz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>Q3(t,n,i,o),yt(t,"shape",()=>e.shape),aA(t,"ZodObject",{keyof(){return Ve(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:_o()})},loose(){return this.clone({...this._zod.def,catchall:_o()})},strict(){return this.clone({...this._zod.def,catchall:kb()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return W_(this,n)},safeExtend(n){return K_(this,n)},merge(n){return X_(this,n)},pick(n){return Y_(this,n)},omit(n){return $_(this,n)},partial(...n){return Q_(Pb,this,n[0])},required(...n){return q_(Zb,this,n[0])}})});function Je(t,e){const n={type:"object",shape:t??{},...Pe(e)};return new Db(n)}function ye(t,e){return new Db({type:"object",shape:t,catchall:kb(),...Pe(e)})}const _b=ne("ZodUnion",(t,e)=>{ab.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>q3(t,n,i,o),t.options=e.options});function jb(t,e){return new _b({type:"union",options:t,...Pe(e)})}const Q5=ne("ZodDiscriminatedUnion",(t,e)=>{_b.init(t,e),Mz.init(t,e)});function AA(t,e,n){return new Q5({type:"union",options:e,discriminator:t,...Pe(n)})}const q5=ne("ZodIntersection",(t,e)=>{Rz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>J3(t,n,i,o)});function J5(t,e){return new q5({type:"intersection",left:t,right:e})}const zb=ne("ZodRecord",(t,e)=>{kz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>e5(t,n,i,o),t.keyType=e.keyType,t.valueType=e.valueType});function lA(t,e,n){return!e||!e._zod?new zb({type:"record",keyType:_(),valueType:t,...Pe(e)}):new zb({type:"record",keyType:t,valueType:e,...Pe(n)})}const Au=ne("ZodEnum",(t,e)=>{Dz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(i,o,s)=>Y3(t,i,o),t.enum=e.entries,t.options=Object.values(e.entries);const n=new Set(Object.keys(e.entries));t.extract=(i,o)=>{const s={};for(const a of i)if(n.has(a))s[a]=e.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Au({...e,checks:[],...Pe(o),entries:s})},t.exclude=(i,o)=>{const s={...e.entries};for(const a of i)if(n.has(a))delete s[a];else throw new Error(`Key ${a} not found in enum`);return new Au({...e,checks:[],...Pe(o),entries:s})}});function Ve(t,e){const n=Array.isArray(t)?Object.fromEntries(t.map(i=>[i,i])):t;return new Au({type:"enum",entries:n,...Pe(e)})}const eP=ne("ZodLiteral",(t,e)=>{_z.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>$3(t,n,i),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function nt(t,e){return new eP({type:"literal",values:Array.isArray(t)?t:[t],...Pe(e)})}const tP=ne("ZodTransform",(t,e)=>{jz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>K3(t,n),t._zod.parse=(n,i)=>{if(i.direction==="backward")throw new By(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(sA(s,n.value,e));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=t),n.issues.push(sA(a))}};const o=e.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function nP(t){return new tP({type:"transform",transform:t})}const Pb=ne("ZodOptional",(t,e)=>{Cb.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>Eb(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function Lb(t){return new Pb({type:"optional",innerType:t})}const iP=ne("ZodExactOptional",(t,e)=>{zz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>Eb(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function oP(t){return new iP({type:"optional",innerType:t})}const rP=ne("ZodNullable",(t,e)=>{Pz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>t5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function Bb(t){return new rP({type:"nullable",innerType:t})}const sP=ne("ZodDefault",(t,e)=>{Lz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>i5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function gP(t,e){return new sP({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():Uy(e)}})}const aP=ne("ZodPrefault",(t,e)=>{Bz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>o5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function AP(t,e){return new aP({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():Uy(e)}})}const Zb=ne("ZodNonOptional",(t,e)=>{Zz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>n5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function lP(t,e){return new Zb({type:"nonoptional",innerType:t,...Pe(e)})}const CP=ne("ZodCatch",(t,e)=>{Gz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>r5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function IP(t,e){return new CP({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const cP=ne("ZodPipe",(t,e)=>{Fz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>s5(t,n,i,o),t.in=e.in,t.out=e.out});function Gb(t,e){return new cP({type:"pipe",in:t,out:e})}const dP=ne("ZodReadonly",(t,e)=>{Vz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>g5(t,n,i,o),t.unwrap=()=>t._zod.def.innerType});function uP(t){return new dP({type:"readonly",innerType:t})}const hP=ne("ZodCustom",(t,e)=>{Uz.init(t,e),Ft.init(t,e),t._zod.processJSONSchema=(n,i,o)=>W3(t,n)});function fP(t,e={}){return z3(hP,t,e)}function pP(t,e){return P3(t,e)}const mP="compass.query/1",vP=["file","module","package","namespace","class","struct","interface","trait","protocol","enum","enum_member","type_alias","function","method","constructor","property","field","variable","constant","parameter","import","export","macro","annotation","route","component","event","message","topic","queue","job","resource","schema","query","migration","config_key","database","database_schema","database_table","database_view","database_column","database_index","database_constraint","database_procedure","database_trigger"],yP=["contains","calls","imports","exports","extends","implements","references","type_of","returns","instantiates","overrides","decorates","routes_to","reads","writes","aliases","registers","handles","publishes","subscribes","produces","consumes","schedules","triggers","tests","depends_on","documents","maps_to","renders"],bP=["controller","route_handler","middleware","service","resolver","consumer","producer","subscriber","repository","model","test","fixture","generated","ui_component","hook","client_boundary","client_component","server_component","server_function","data_loader"],wP=["search","callers","callees","impact","explore","node_trail"],xP=["middleware","dependency","security","layout","template","loading","default","error_boundary","not_found","boundary","loader","action","handler","data_loader","route_component"],lu=_().min(1).refine(t=>t.includes("\\")||t.startsWith("/")||/^[A-Za-z]:/.test(t)?!1:t.split("/").every(e=>e!==""&&e!=="."&&e!==".."),"source path must be a safe repository-relative path"),vg=ye({file:lu,startByte:Z().int().nonnegative(),endByte:Z().int().nonnegative(),startLine:Z().int().positive(),startColumn:Z().int().nonnegative(),endLine:Z().int().positive(),endColumn:Z().int().nonnegative()}).refine(t=>t.endByte>=t.startByte&&(t.endLine>t.startLine||t.endLine===t.startLine&&t.endColumn>=t.startColumn),"source anchor must be ordered"),SP=Ve(vP),EP=Ve(yP),TP=Ve(bP),OP=Ve(wP),NP=Ve(["structural_graph","program_ir"]),MP=Ve(["ast","config","convention","artifact","heuristic"]),Cu=Ve(["exact","inferred","ambiguous"]),EC=Ve(["exact","ambiguous","unresolved"]),Fb=ye({nodeId:_().min(1),reason:_().min(1),confidence:Cu,score:Z().finite().nullable().optional(),anchor:vg.nullable().optional()}),TC=ye({layer:NP,origin:MP,extractor:_().min(1),confidence:Cu,anchor:vg.nullable(),rule:_().min(1).nullable(),wiringSite:vg.nullable(),resolution:EC,candidates:Oe(Fb).max(20).default([])}),RP=ye({type:nt("file"),data:ye({contentDigest:_().min(1),byteSize:Z().int().nonnegative(),generated:Yt()})}),kP=ye({type:nt("symbol"),data:ye({signature:_().nullable().optional(),modifiers:Oe(_()).default([]),overloadDiscriminator:_().nullable().optional(),declaringType:_().nullable().optional(),signatureDigest:_().nullable().optional(),implementationDigest:_().nullable().optional(),sourceDigest:_().nullable().optional()})}),DP=ye({type:nt("import_export"),data:ye({specifier:_(),importedName:_().nullable().optional(),localName:_().nullable().optional(),typeOnly:Yt()})}),Vb=Ve(xP),_P=ye({stage:Vb,position:Z().int().nonnegative(),reference:_().min(1),resolution:EC,sourceAnchor:vg.nullable(),target:_().nullable().optional(),candidates:Oe(Fb).max(20).default([])}),jP=ye({type:nt("route"),data:ye({operation:_(),path:_(),originalPath:_().nullable().optional(),declaringScope:_(),resolution:EC,middlewareCount:Z().int().nonnegative(),stages:Oe(_P).max(256).default([])})}),zP=ye({type:nt("component"),data:ye({componentType:_()})}),PP=ye({type:nt("resource"),data:ye({resourceKind:Ve(["document","paper","image","concept","rationale"]),uri:_().nullable().optional(),mediaType:_().nullable().optional(),content:_().max(4096).refine(t=>new TextEncoder().encode(t).length<=4096,"Resource content exceeds 4096 UTF-8 bytes").nullable().optional()}).refine(t=>t.content==null||["document","rationale"].includes(t.resourceKind),"Only document and rationale resources contain prose")}),LP=ye({type:nt("messaging"),data:ye({transport:_(),subject:_(),declaringScope:_()})}),BP=ye({type:nt("job"),data:ye({schedule:_().nullable().optional(),queue:_().nullable().optional()})}),ZP=ye({type:nt("schema"),data:ye({dialect:_().nullable().optional(),logicalDatabase:_().nullable().optional(),namespace:_().nullable().optional()})}),GP=ye({type:nt("query"),data:ye({dialect:_().nullable().optional(),operation:_().nullable().optional(),textDigest:_().nullable().optional()})}),FP=ye({type:nt("config"),data:ye({format:_(),keyPath:_()})}),VP=ye({type:nt("database"),data:ye({logicalDatabase:_(),databaseSchema:_().nullable().optional()})}),UP=AA("type",[RP,kP,DP,jP,zP,PP,LP,BP,ZP,GP,FP,VP]),HP=ye({type:nt("call"),data:ye({dispatch:Ve(["static","virtual","dynamic"]),receiverType:_().nullable().optional(),argumentCount:Z().int().nonnegative().nullable().optional()})}),YP=ye({type:nt("route"),data:ye({stage:Vb,position:Z().int().nonnegative().nullable().optional(),operation:_().nullable().optional()})}),$P=ye({type:nt("messaging"),data:ye({transport:_(),subject:_()})}),WP=ye({type:nt("schedule"),data:ye({expression:_().nullable().optional()})}),KP=ye({type:nt("mapping"),data:ye({mappingKind:_()})}),XP=ye({type:nt("render"),data:ye({renderKind:Ve(["jsx","create_element","root","lazy","dynamic"]),boundary:_().nullable().optional()})}),Ub=AA("type",[HP,YP,$P,WP,KP,XP]),QP=ye({maxDepth:Z().int().positive(),maxNodes:Z().int().positive(),maxEdges:Z().int().positive(),maxPaths:Z().int().positive(),maxCandidates:Z().int().positive(),maxSourceBytes:Z().int().positive(),maxResponseBytes:Z().int().positive()}),qP=ye({nodeId:_().min(1),score:Z().finite(),matchedFields:Oe(_())}),JP=ye({id:_().min(1),kind:SP,roles:Oe(TP),name:_().min(1),qualifiedName:_().min(1),language:_().nullable(),framework:_().nullable(),source:vg.nullable(),details:UP.nullable(),evidence:Oe(TC)}),eL=ye({id:_().min(1),source:_().min(1),target:_().min(1),kind:EP,relationshipSite:vg.nullable(),details:Ub.nullable(),evidence:Oe(TC)}),tL=ye({path:lu,contentDigest:_().min(1),source:_().nullable(),truncated:Yt()}),nL=ye({id:_().min(1),nodeIds:Oe(_().min(1)),edgeIds:Oe(_().min(1)),weakestResolution:EC,weakestConfidence:Cu}),iL=ye({code:Ve(["no_match","ambiguous_match","relationship_inconsistency","direction_mismatch","unresolved_handler","incomplete_coverage","stale_source_digest","bounded_truncation","program_orphan","program_conflict","program_unavailable"]),message:_().min(1),nodeId:_().nullable(),path:lu.nullable()}),oL=ye({schema:nt(mP),operation:OP,results:Oe(qP),nodes:Oe(JP),edges:Oe(eL),files:Oe(tL),paths:Oe(nL),conceptMatches:Oe(ye({nodeId:_(),method:Ve(["synonym","document_link","semantic_lsa"]),query:_(),matched:_(),via:Oe(_())})).optional(),diagnostics:Oe(iL),limits:QP,truncated:Yt()}),rL="compass.viewer.graph/1",OC=Je({file:_(),startLine:Z().int().positive().optional(),endLine:Z().int().positive().optional(),startByte:Z().int().nonnegative().optional(),endByte:Z().int().nonnegative().optional()}).passthrough(),sL=Je({field:_().min(1),before:_o().optional(),after:_o().optional()}),Hb=Je({before:lA(_(),_o()).optional(),after:lA(_(),_o()).optional(),fields:Oe(sL)}),Yb=Je({challenge:_().startsWith("challenge:"),targetId:_().min(1),effect:Ve(["flag","mask"]),masked:Yt(),certificateDigest:_().regex(/^[0-9a-f]{64}$/),summary:_()}).strict(),gL=Je({total:Z().int().nonnegative(),examples:Oe(Je({kind:Ve(["assertion","challenge"]),id:_().min(1),reasonCode:_().min(1),explanation:_(),sequence:Z().int().nonnegative()}).strict()),omittedExamples:Z().int().nonnegative()}).strict(),$b=lA(_(),_o()),aL=AA("kind",[Je({kind:nt("native")}).passthrough(),Je({kind:nt("ocr"),profile:$b,confidence_bps:Z().int().min(0).max(1e4)}).passthrough()]),Wb=Je({kind:_().min(1)}).passthrough(),AL=Je({candidate_id:_().min(1),x:Z().int().nonnegative(),y:Z().int().nonnegative(),width:Z().int().positive(),height:Z().int().positive()}).passthrough(),lL=Je({schema:nt("compass.document.preview/1"),kind:Ve(["page","slide","sheet"]),locator:Wb,label:_().min(1),width:Z().int().positive(),height:Z().int().positive(),svg:_().min(1).max(512*1024),regions:Oe(AL).max(256).default([]),digest:_().regex(/^sha256:[0-9a-f]{64}$/)}).passthrough(),CL=Je({role:Ve(["root","block"]).optional(),kind:_().optional(),format:_().optional(),text:_().optional(),ordinal:Z().int().nonnegative().optional(),complete:Yt().optional(),visualCoverage:Ve(["not_requested","complete","partial","failed"]).optional(),ocrMode:Ve(["off","auto","always"]).optional(),origin:aL.optional(),locator:Wb.optional(),ocrProfile:$b.optional(),previews:Oe(lL).max(256).optional()}).passthrough(),IL=Je({id:_().min(1),label:_(),kind:_().optional(),community:Z().int(),communityName:_().optional(),degree:Z().int().nonnegative().optional(),language:_().optional(),signature:_().optional(),size:Z().positive().optional(),memberCount:Z().int().nonnegative().optional(),detailAvailable:Yt().optional(),learningStatus:_().optional(),learningStale:Yt().optional(),depth:Z().int().nonnegative().optional(),root:Yt().optional(),agentAssertion:_().startsWith("assertion:").optional(),agentSummary:_().optional(),groundingStatus:nt("GROUNDED").optional(),challenged:Yt().optional(),challenge:Yb.optional(),change:Ve(["added","removed","changed","unchanged"]).optional(),evidence:Hb.optional(),codeEvidence:Oe(TC).optional(),source:OC.optional(),color:Je({background:_(),border:_()}).passthrough().optional(),document:CL.optional()}).passthrough(),cL=Je({id:_().min(1),source:_().min(1),target:_().min(1),relation:_(),weight:Z().int().positive().optional(),change:Ve(["added","removed","changed","unchanged"]).optional(),evidence:Hb.optional(),codeEvidence:Oe(TC).optional(),details:Ub.nullable().optional(),relationshipSite:OC.optional(),confidence:Ve(["extracted","inferred","ambiguous","aggregated"]).optional(),agentAssertion:_().startsWith("assertion:").optional(),agentSummary:_().optional(),groundingStatus:nt("GROUNDED").optional(),challenged:Yt().optional(),challenge:Yb.optional()}).passthrough(),dL=Je({id:Z().int(),label:_(),color:_(),hidden:Yt().default(!1)}).passthrough(),jo=Je({schema:nt(rL),title:_(),stats:Je({nodes:Z().int().nonnegative(),edges:Z().int().nonnegative(),communities:Z().int().nonnegative(),aggregated:Yt()}).passthrough(),nodes:Oe(IL),edges:Oe(cL),communities:Oe(dL),hyperedges:Oe(_o()).default([]),effectiveGraph:Je({effectiveIdentity:_().regex(/^[0-9a-f]{64}$/),baseGeneration:Je({generationId:_().min(1),graphDigest:_().regex(/^[0-9a-f]{64}$/)}).strict(),overlayRevision:_().regex(/^[0-9a-f]{64}$/),compositionProfile:Ve(["augment","curated"]),retractions:gL,omissions:Je({total:Z().int().nonnegative(),direct:Z().int().nonnegative(),cascaded:Z().int().nonnegative(),examples:Oe(_o()),omittedExamples:Z().int().nonnegative()}).strict()}).strict().optional()}).passthrough(),uL=Ve(["resolved","inferred","ambiguous","unresolved"]),Kb=Je({source_file:_(),start_byte:Z().int().nonnegative(),end_byte:Z().int().nonnegative()}),hL=Je({id:_(),symbol:_().nullable(),name:_(),file:_().nullable(),anchor:Kb.nullable().optional(),startLine:Z().int().positive().nullable().optional(),endLine:Z().int().positive().nullable().optional(),startByte:Z().int().nonnegative().nullable().optional(),endByte:Z().int().nonnegative().nullable().optional(),graphNodeId:_().nullable(),unresolved:Yt(),evidenceLayer:Ve(["structural_graph","program_ir","combined"]).optional()}),fL=jb([Je({anchor:Kb,evidence:Oe(_())}),Je({sourceFile:_().nullable(),line:Z().int().positive().nullable(),startByte:Z().int().nonnegative().nullable(),endByte:Z().int().nonnegative().nullable(),evidence:Oe(_())})]),pL=Je({id:_(),source:_(),target:_(),callee:_(),resolution:uL,confidence:_().nullable().optional(),callSites:Oe(fL),evidenceLayer:Ve(["structural_graph","program_ir","combined"]).optional()}),mL=Je({schema:Ve(["compass.program.call_graph/1","compass.call_graph/1"]),rootSymbol:_(),direction:Ve(["callers","callees","both"]),depth:Z().int().positive(),nodes:Oe(hL),edges:Oe(pL),truncated:Yt(),continuations:Oe(Je({symbol:_(),direction:Ve(["callers","callees","both"]),nextDepth:Z().int().positive()})),coverage:Je({resolved:Z().int().nonnegative(),inferred:Z().int().nonnegative(),ambiguous:Z().int().nonnegative(),unresolved:Z().int().nonnegative(),evidenceLayer:Ve(["structural_graph","program_ir","combined"]).optional(),partial:Yt().optional(),limitations:Oe(_()).optional(),warning:_()})}),vL="compass.viewer.architecture/1",yL=Ve(["production","all_code"]),Xb=Ve(["execution","dependency","type","structure","contextual","unknown"]),Qb=Ve(["architecture","execution","dependency","type","structure","all"]),bL=Ve(["owner","subsystem"]),wL=Ve(["overview","detail"]),xL=Ve(["overlay","persisted","owner","path","declaration","hub","provider","fallback"]),SL=Ve(["good","degraded","insufficient"]),EL=Ve(["info","warning","error"]),TL=Ve(["production","test","generated","vendor","documentation","unknown"]),qb=ye({production:Z().int().nonnegative(),test:Z().int().nonnegative(),generated:Z().int().nonnegative(),vendor:Z().int().nonnegative(),documentation:Z().int().nonnegative(),unknown:Z().int().nonnegative()}),Jb=ye({execution:Z().int().nonnegative(),dependency:Z().int().nonnegative(),type:Z().int().nonnegative(),structure:Z().int().nonnegative(),contextual:Z().int().nonnegative(),unknown:Z().int().nonnegative()}),OL=ye({extracted:Z().int().nonnegative(),inferred:Z().int().nonnegative(),ambiguous:Z().int().nonnegative()}),NL=ye({id:_().min(1),label:_(),kind:_(),sourceFile:_().nullable(),sourceScope:TL,scopeReason:_().min(1),community:Z().int().nonnegative().nullable()}),ML=ye({id:_().min(1),source:_().min(1),target:_().min(1),relation:_(),relationClass:Xb,confidence:Ve(["extracted","inferred","ambiguous"])}),RL=ye({value:_().min(1),provenance:xL,membershipSignature:_().min(1),quality:Z().int().min(0).max(100),evidence:Oe(_())}),kL=ye({id:_().min(1),parentId:_().nullable(),kind:bL,rank:Z().int().positive(),name:RL,ownerKey:_().min(1),communityIds:Oe(Z().int().nonnegative()),nodeCount:Z().int().nonnegative(),relationshipCount:Z().int().nonnegative(),neighborCount:Z().int().nonnegative(),cohesion:Z().finite(),sourceScopes:qb,pinned:Yt()}),DL=ye({nodeIndex:Z().int().nonnegative(),groupIndex:Z().int().nonnegative()}),_L=ye({id:_().min(1),level:wL,ownerId:_().nullable(),sourceGroup:_().min(1),targetGroup:_().min(1),relationshipCount:Z().int().nonnegative(),relationClasses:Jb,evidence:OL}),jL=ye({admitted:Z().int().nonnegative(),internal:Z().int().nonnegative(),crossGroup:Z().int().nonnegative(),unassigned:Z().int().nonnegative(),relationClasses:Jb}),e0=ye({totalGroups:Z().int().nonnegative(),shownGroups:Z().int().nonnegative(),omittedGroups:Z().int().nonnegative(),representedNodes:Z().int().nonnegative(),omittedNodes:Z().int().nonnegative(),representedRelationships:Z().int().nonnegative(),omittedRelationships:Z().int().nonnegative(),witnessGroupIds:Oe(_()),maxOverviewGroups:Z().int().positive(),maxOverviewRoutes:Z().int().positive()}),zL=ye({code:_().min(1),severity:EL,message:_(),observed:Z().nullable(),threshold:Z().nullable(),witnesses:Oe(_()),recommendedAction:_()}),t0=ye({status:SL,metrics:ye({sourceScopes:qb,unknownSourceFraction:Z().min(0).max(1),generatedVendorLeakage:Z().int().nonnegative(),representedNodeFraction:Z().min(0).max(1),representedRelationshipFraction:Z().min(0).max(1),duplicateNames:Z().int().nonnegative(),fallbackNames:Z().int().nonnegative(),largestGroupFraction:Z().min(0).max(1),unknownRelations:Z().int().nonnegative(),unassignedNodes:Z().int().nonnegative(),unassignedRelationships:Z().int().nonnegative()}),diagnostics:Oe(zL)}),PL=ye({scope:yL,defaultLens:Qb,groups:Oe(kL),memberships:Oe(DL),routes:Oe(_L),overviewGroupIds:Oe(_()),overviewRouteIds:Oe(_()),coverage:jL,omissions:e0,quality:t0}),LL=ye({maxNodes:Z().int().positive(),maxRelationships:Z().int().positive(),maxGroups:Z().int().positive(),maxRoutes:Z().int().positive(),maxOverviewGroups:Z().int().positive(),maxOverviewRoutes:Z().int().positive(),maxNameCandidates:Z().int().positive(),maxNameEvidence:Z().int().positive(),maxDiagnostics:Z().int().positive(),maxOmissionWitnesses:Z().int().positive()}),BL=ye({schema:nt(vL),title:_(),nodes:Oe(NL),relationships:Oe(ML),projections:Oe(PL).min(1),statistics:ye({nodes:Z().int().nonnegative(),relationships:Z().int().nonnegative(),communities:Z().int().nonnegative(),extracted:Z().int().nonnegative(),inferred:Z().int().nonnegative(),ambiguous:Z().int().nonnegative()}),provenance:ye({projectName:_(),builtAtCommit:_().nullable(),generatedAt:_().nullable()}),limits:LL}).superRefine((t,e)=>{const n=new Set(t.nodes.map(i=>i.id));n.size!==t.nodes.length&&e.addIssue({code:"custom",path:["nodes"],message:"node IDs must be unique"});for(const[i,o]of t.relationships.entries())(!n.has(o.source)||!n.has(o.target))&&e.addIssue({code:"custom",path:["relationships",i],message:"relationship endpoints must identify included nodes"});for(const[i,o]of t.projections.entries()){const s=new Set(o.groups.map(a=>a.id));for(const[a,l]of o.memberships.entries())(l.nodeIndex>=t.nodes.length||l.groupIndex>=o.groups.length)&&e.addIssue({code:"custom",path:["projections",i,"memberships",a],message:"membership indexes must identify an included node and group"});for(const[a,l]of o.routes.entries())(!s.has(l.sourceGroup)||!s.has(l.targetGroup))&&e.addIssue({code:"custom",path:["projections",i,"routes",a],message:"route endpoints must identify included groups"})}}),ZL=Ve(["production","all"]),GL=Ve(["all","extracted","inferred","ambiguous"]),FL=Ve(["production","test","generated","vendor","documentation","unknown"]),VL=Ve(["extracted","inferred","ambiguous"]),UL=Je({production:Z().int().nonnegative(),test:Z().int().nonnegative(),generated:Z().int().nonnegative(),vendor:Z().int().nonnegative(),documentation:Z().int().nonnegative(),unknown:Z().int().nonnegative()}),HL=Je({id:_(),name:_(),nodeCount:Z().int().nonnegative(),totalNodeCount:Z().int().nonnegative(),internalRelationshipCount:Z().int().nonnegative(),incomingRelationships:Z().int().nonnegative(),outgoingRelationships:Z().int().nonnegative(),scopes:UL}),YL=Je({id:_(),sourceGroup:_(),targetGroup:_(),relationships:Z().int().nonnegative(),extracted:Z().int().nonnegative(),inferred:Z().int().nonnegative(),ambiguous:Z().int().nonnegative()});Je({title:_(),scope:ZL,evidence:GL,lens:Qb,groups:Oe(HL),routes:Oe(YL),statistics:Je({visibleNodes:Z().int().nonnegative(),totalNodes:Z().int().nonnegative(),visibleRelationships:Z().int().nonnegative(),totalRelationships:Z().int().nonnegative(),communities:Z().int().nonnegative(),extracted:Z().int().nonnegative(),inferred:Z().int().nonnegative(),ambiguous:Z().int().nonnegative()}),coverage:Je({internal:Z().int().nonnegative(),crossGroup:Z().int().nonnegative(),unassigned:Z().int().nonnegative()}),omissions:e0,quality:t0,provenance:Je({projectName:_(),builtAtCommit:_().nullable(),generatedAt:_().nullable()})});const $L=Je({id:_(),label:_(),kind:_(),sourceFile:_().nullable(),scope:FL,groupId:_()}),n0=Je({id:_(),source:_(),target:_(),sourceLabel:_(),targetLabel:_(),sourceFile:_().nullable(),targetFile:_().nullable(),sourceGroup:_(),targetGroup:_(),relation:_(),relationClass:Xb,confidence:VL}),NC=Je({page:Z().int().positive(),pageSize:Z().int().min(1).max(100),pageCount:Z().int().positive(),total:Z().int().nonnegative(),start:Z().int().nonnegative(),end:Z().int().nonnegative()});AA("kind",[NC.extend({kind:nt("symbols"),groupId:_(),items:Oe($L)}),NC.extend({kind:nt("relationships"),groupId:_(),items:Oe(n0)})]),NC.extend({routeId:_(),sourceGroup:_(),targetGroup:_(),items:Oe(n0)});const WL=Je({id:_(),kind:Ve(["group","symbol","relationship"]),label:_(),detail:_(),groupId:_().nullable(),routeId:_().nullable(),sourceFile:_().nullable()});NC.extend({query:_(),items:Oe(WL)});const KL="compass.viewer.hierarchy/1",XL=Ve(["dominantDirectory","modulePrefix","hubMember","communityId"]),QL=Ve(["relationship","locationAffinity"]),qL=ye({index:Z().int().nonnegative(),id:_().min(1),signature:_().min(1),community:Z().int().nonnegative().optional(),label:_().min(1),labelRule:XL,labelGeneric:Yt(),memberCount:Z().int().positive(),childIndices:Oe(Z().int().nonnegative()).default([]),cohesion:Z(),conductance:Z(),boundaryKinds:lA(_(),Z().int().nonnegative()).default({}),detailAvailable:Yt()}),JL=ye({level:Z().int().nonnegative(),merge:QL,resolution:Z().optional(),groupCount:Z().int().positive(),memberCount:Z().int().nonnegative(),groups:Oe(qL).min(1),model:jo.optional()}),i0=ye({schema:nt(KL),budgetIdentity:_().min(1),mergePolicy:_().min(1),initialLevel:Z().int().nonnegative().optional(),rootTarget:Z().int().positive(),levelTarget:Z().int().positive(),maxLevels:Z().int().positive(),budgetSatisfied:Yt(),finestCommunityCount:Z().int().nonnegative(),finestSignature:_().min(1),boundaryKinds:Oe(_()).default([]),levels:Oe(JL).min(1)}),e4="compass.community-hierarchy-diff/1",o0=ye({generation:_(),graphDigest:_(),hierarchyDigest:_(),levels:Z().int().nonnegative(),groups:Z().int().nonnegative()}),t4=ye({kind:Ve(["stable","split","merged","appeared","disappeared","ambiguous"]),level:Z().int().nonnegative(),baseIds:Oe(_()),targetIds:Oe(_()),overlap:Z(),memberCount:Z().int().nonnegative()}),n4=ye({schema:nt(e4),base:o0,target:o0,policy:ye({keepThreshold:Z(),ambiguityMargin:Z(),maxEvents:Z().int().positive()}),stable:Z().int().nonnegative(),split:Z().int().nonnegative(),merged:Z().int().nonnegative(),appeared:Z().int().nonnegative(),disappeared:Z().int().nonnegative(),ambiguous:Z().int().nonnegative(),events:Oe(t4),omittedEvents:Z().int().nonnegative(),resultDigest:_().min(1)}),i4="compass.viewer.workbench/1",o4=ye({status:Ve(["complete","summary","partial"]),truncated:Yt(),nodes:Z().int().nonnegative(),edges:Z().int().nonnegative(),hierarchyLevels:Z().int().nonnegative().optional(),limitations:Oe(_()).default([])}),ys={id:_().min(1),title:_().min(1),description:_(),coverage:o4},r4=Ve(["dependencies","routes","data","messaging","tests","provenance"]),s4=ye({id:_().min(1),label:_(),kind:_().optional(),community:Z().int(),communityName:_().optional(),degree:Z().int().nonnegative().optional(),source:OC.optional(),previewAvailable:Yt()}),g4=ye({totalNodes:Z().int().nonnegative(),nodes:Oe(s4).max(1e5)}).refine(t=>t.nodes.length<=t.totalNodes,{message:"search index cannot contain more nodes than the full graph"}),a4=AA("kind",[ye({...ys,kind:nt("code"),model:jo,communityDetails:lA(_(),jo).default({}),searchIndex:g4.optional(),hierarchy:i0.optional()}),ye({...ys,kind:nt("call"),root:_(),graph:mL}),ye({...ys,kind:nt("impact"),root:_(),result:oL}),ye({...ys,kind:nt("architecture"),model:BL}),ye({...ys,kind:nt("history"),baseRevision:_(),targetRevision:_(),before:jo,after:jo,hierarchyDiff:n4.optional()}),ye({...ys,kind:nt("affected"),root:_(),relations:Oe(_()),depth:Z().int().nonnegative(),model:jo}),ye({...ys,kind:nt("artifact"),lens:r4,relations:Oe(_()),model:jo})]),A4=ye({schema:nt(i4),title:_(),graphIdentity:_().min(1),defaultView:_(),views:Oe(a4).min(1)}).superRefine((t,e)=>{const n=new Set;for(const[i,o]of t.views.entries())n.has(o.id)&&e.addIssue({code:"custom",path:["views",i,"id"],message:`duplicate workbench view id '${o.id}'`}),n.add(o.id);n.has(t.defaultView)||e.addIssue({code:"custom",path:["defaultView"],message:"defaultView must identify one included view"})});var E=Xd();const CA=Rn({__proto__:null,default:ti(E)},[E]);var bs=jy();const l4=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),C4=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase()),r0=t=>{const e=C4(t);return e.charAt(0).toUpperCase()+e.slice(1)},s0=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim(),I4=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var c4={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const d4=E.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:o="",children:s,iconNode:a,...l},C)=>E.createElement("svg",{ref:C,...c4,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:s0("lucide",o),...!s&&!I4(l)&&{"aria-hidden":"true"},...l},[...a.map(([c,u])=>E.createElement(c,u)),...Array.isArray(s)?s:[s]]));const Te=(t,e)=>{const n=E.forwardRef(({className:i,...o},s)=>E.createElement(d4,{ref:s,iconNode:e,className:s0(`lucide-${l4(r0(t))}`,`lucide-${t}`,i),...o}));return n.displayName=r0(t),n};const Iu=Te("arrow-down-to-line",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);const u4=Te("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);const h4=Te("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const cu=Te("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const du=Te("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);const f4=Te("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);const p4=Te("badge-check",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const m4=Te("box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);const g0=Te("boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);const uu=Te("braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);const v4=Te("bubbles",[["path",{d:"M7.2 14.8a2 2 0 0 1 2 2",key:"1tw9gg"}],["circle",{cx:"18.5",cy:"8.5",r:"3.5",key:"1wadoa"}],["circle",{cx:"7.5",cy:"16.5",r:"5.5",key:"6mdt3g"}],["circle",{cx:"7.5",cy:"4.5",r:"2.5",key:"637s54"}]]);const y4=Te("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const hu=Te("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const b4=Te("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const MC=Te("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const w4=Te("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);const x4=Te("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const S4=Te("circle-dot-dashed",[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);const a0=Te("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const E4=Te("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const T4=Te("compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const RC=Te("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const O4=Te("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const N4=Te("file-code-2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);const M4=Te("file-cog",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m2.305 15.53.923-.382",key:"yfp9st"}],["path",{d:"m3.228 12.852-.924-.383",key:"bckynb"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.852 11.228-.383-.923",key:"1j88i9"}],["path",{d:"m4.852 16.772-.383.924",key:"sag1dv"}],["path",{d:"m7.148 11.228.383-.923",key:"rj39hk"}],["path",{d:"m7.53 17.696-.382-.924",key:"1uu5cs"}],["path",{d:"m8.772 12.852.923-.383",key:"13811l"}],["path",{d:"m8.772 15.148.923.383",key:"z1a5l0"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]]);const A0=Te("file-image",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);const R4=Te("focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);const l0=Te("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);const C0=Te("git-compare-arrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);const fu=Te("git-fork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);const k4=Te("grid-2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);const D4=Te("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const _4=Te("keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);const j4=Te("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);const z4=Te("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);const P4=Te("map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);const I0=Te("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);const L4=Te("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);const B4=Te("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);const Z4=Te("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]);const G4=Te("move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);const kC=Te("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);const F4=Te("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);const V4=Te("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);const c0=Te("panel-right-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);const U4=Te("panel-right-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);const d0=Te("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);const H4=Te("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);const u0=Te("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Y4=Te("radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]);const h0=Te("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const f0=Te("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);const $4=Te("rows-3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);const p0=Te("scan-search",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);const m0=Te("scan-text",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);const W4=Te("search-code",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const v0=Te("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const K4=Te("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const X4=Te("shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]);const Q4=Te("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);const q4=Te("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const J4=Te("signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);const eB=Te("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);const tB=Te("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);const nB=Te("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]);const iB=Te("target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);const IA=Te("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const oB=Te("zoom-in",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);const rB=Te("zoom-out",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function y0(t,e){if(e.kind!=="symbols")return t.levels.find(n=>n.level===e.level)?.model}function b0(t,e,n){const i=t.levels.find(h=>h.level===e),o=t.levels.find(h=>h.level===e+1),s=i?.groups.find(h=>h.index===n);if(!s||!o?.model)return;const a=new Set(s.childIndices.map(h=>o.groups[h]?.id).filter(h=>typeof h=="string"));if(a.size===0)return;const l=o.model.nodes.filter(h=>a.has(h.id)),C=new Set(l.map(h=>h.id)),c=o.model.edges.filter(h=>C.has(h.source)&&C.has(h.target)),u=new Set(l.map(h=>h.community));return{...o.model,stats:{...o.model.stats,nodes:l.length,edges:c.length,communities:u.size},nodes:l,edges:c,communities:o.model.communities.filter(h=>u.has(h.id))}}function sB(t){return t.levels.find(n=>n.groups.length>1&&n.model!==void 0)?.level}const w0=5,gB=4,x0=new Map;function aB(t){if(!t)return x0;const e=new Map,n=t.levels[t.levels.length-1];for(const i of n?.groups??[])i.community!==void 0&&e.set(i.community,i.label);return e.size>0?e:x0}function pu(t,e){const n=t.trim();return n===""||n===String(e)||n===`Community ${e}`}function AB(t,e){if(e.size===0)return t;let n=!1;const i=t.nodes.map(s=>{const a=e.get(s.community);if(a===void 0)return s;const l=s.kind==="community"&&pu(s.label,s.community)?a:s.label,C=s.communityName===void 0||pu(s.communityName,s.community)?a:s.communityName;return l===s.label&&C===s.communityName?s:(n=!0,{...s,label:l,communityName:C})}),o=t.communities.map(s=>{const a=e.get(s.id);return a===void 0||!pu(s.label,s.id)||a===s.label?s:(n=!0,{...s,label:a})});return n?{...t,nodes:i,communities:o}:t}function lB(t,e,n){if(!t)return;for(const[a,l]of t.levels.entries()){const C=l.groups.find(c=>c.id===e.id);if(C)return{levelIndex:a,level:l,group:C}}if(!n)return;const i=t.levels.length-1,o=t.levels[i],s=o?.groups.find(a=>a.community===e.community);return s&&o?{levelIndex:i,level:o,group:s}:void 0}function CB(t,e,n){const i=t?.level.model,o=t&&i?i.nodes.find(u=>u.id===t.group.id):void 0,s=i&&o?i:e,a=o?.id??n.id,l=new Map(s.nodes.map(u=>[u.id,u])),C=new Map;for(const u of s.edges){const h=u.source===a?u.target:u.target===a?u.source:void 0;h!==void 0&&C.set(h,(C.get(h)??0)+(u.weight??1))}const c=[...C.entries()].map(([u,h])=>({label:l.get(u)?.label??u,edges:h})).sort((u,h)=>h.edges-u.edges||u.label.localeCompare(h.label));return{edges:c.slice(0,w0),count:c.reduce((u,h)=>u+h.edges,0),complete:c.length<=w0}}function IB(t,e,n,i={}){if(!(n.kind==="community"||e.stats.aggregated))return;const s=lB(t,n,i.communityKeyed??!0),a=s?.group.memberCount??n.memberCount;if(s===void 0&&a===void 0)return;const l=CB(s,e,n),C=Object.entries(s?.group.boundaryKinds??{}).filter(([,c])=>c>0).sort(([c],[u])=>c.localeCompare(u)).slice(0,gB);return{label:s?.group.label??n.communityName??n.label,symbols:a??0,...s?{groupId:s.group.id}:{},...s?.group.community===void 0?{}:{communityId:s.group.community},...s?{level:s.level.level,merge:s.level.merge,...s.level.resolution===void 0?{}:{resolution:s.level.resolution},childGroups:s.group.childIndices.length,cohesion:s.group.cohesion,conductance:s.group.conductance}:{},boundaryKinds:C,couplings:l.edges,couplingCount:l.count,couplingsComplete:l.complete}}const cB=["callable","type","module","boundary","other"],S0=["execution","dependency","structure","flow","other"],dB=new Set(["closure","constructor","function","lambda","macro","method","procedure","subroutine","database_procedure"]),uB=new Set(["class","component","enum","interface","annotation","protocol","struct","trait","type","type_alias","union"]),hB=new Set(["directory","document","export","file","folder","import","migration","module","namespace","package"]),E0=new Set(["command","config_key","database","database_column","database_constraint","database_index","database_schema","database_table","database_trigger","database_view","endpoint","event","job","message","query","queue","resource","route","schema","table","topic"]),fB=new Set(["awaits","calls","dispatches","executes","handles","instantiates","invokes","schedules","tests","triggers","spawns"]),pB=new Set(["depends_on","exports","imports","imports_from","links","re_exports","references","returns","type_of","aliases","uses"]),mB=new Set(["contains","decorates","declares","documents","embeds","extends","implements","inherits","member_of","mixes_in","overrides","renders","owns"]),vB=new Set(["consumes","emits","maps_to","produces","publishes","reads","receives","registers","routes_to","sends","subscribes","writes"]);function mu(t){return(t??"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function yg(t){const e=mu(t);return dB.has(e)?"callable":uB.has(e)?"type":hB.has(e)?"module":E0.has(e)?"boundary":"other"}function bg(t){const e=mu(t);return fB.has(e)?"execution":pB.has(e)?"dependency":mB.has(e)?"structure":vB.has(e)?"flow":"other"}function yB(t){return t!==void 0&&E0.has(mu(t))}function bB(t){return t==="type"?"diamond":t==="module"?"square":t==="boundary"?"triangle":"dot"}function wB(t){return t==="callable"?"var(--vscode-symbolIcon-functionForeground, #3d86c2)":t==="type"?"var(--vscode-symbolIcon-classForeground, #b4763f)":t==="module"?"var(--vscode-symbolIcon-moduleForeground, #2f9a8b)":t==="boundary"?"var(--vscode-symbolIcon-eventForeground, #c46a5c)":"var(--vscode-descriptionForeground, #7a838e)"}function T0(t){return t==="execution"?"var(--vscode-symbolIcon-functionForeground, #3d86c2)":t==="dependency"?"var(--vscode-symbolIcon-moduleForeground, #2f9a8b)":t==="structure"?"var(--vscode-symbolIcon-classForeground, #b4763f)":t==="flow"?"var(--vscode-symbolIcon-eventForeground, #a96298)":"var(--vscode-descriptionForeground, #7a838e)"}const xB=600,SB=3,EB=2e3,O0=9,TB=26,N0=13,M0=18;function vu(t){return`community:${t}`}function OB(t){if(t.stats.aggregated||t.nodes.lengthn.community));return e.size>=SB&&e.size{const a=e.get(o)??[];return(e.get(s)??[]).length-a.length||o-s});for(const o of i){const s=e.get(o)??[];n.set(o,[...s].sort((a,l)=>(l.degree??0)-(a.degree??0)||(l.memberCount??0)-(a.memberCount??0)||a.id.localeCompare(l.id)))}return{members:n,order:i}}function NB(t,e){const n=Math.max(1,e),i=Math.sqrt(Math.max(1,t)/n);return O0+(TB-O0)*i}function yu(t,e,n){return Math.log2(1+Math.max(0,t))+1.5*Math.log2(1+Math.max(0,e))+2*Math.log2(1+Math.max(0,n))}function MB(t){return t<=40?t:t<=120?20:t<=400?14:10}function bu(t,e){const n=MB(t.length);if(n>=t.length)return new Set(t.map(o=>o.id));const i=o=>e?.get(o.id)??yu(o.memberCount??0,o.degree??0,0);return new Set([...t].sort((o,s)=>i(s)-i(o)||(s.memberCount??0)-(o.memberCount??0)||(s.degree??0)-(o.degree??0)||o.id.localeCompare(s.id)).slice(0,n).map(o=>o.id))}function k0(t){const e=t.replace(/\s+/g," ").trim();return e.length<=M0?e:`${e.slice(0,M0-1).trimEnd()}…`}function RB(t,e){const n=new Map;for(const s of t.edges){const a=e.get(s.source),l=e.get(s.target);if(a===void 0||l===void 0||a===l)continue;const C=Math.min(a,l),c=Math.max(a,l),u=`${C}:${c}`,h=n.get(u)??{source:C,target:c,total:0,relations:new Map};h.total+=1,h.relations.set(s.relation,(h.relations.get(s.relation)??0)+1),n.set(u,h)}const i=[...n.entries()].sort(([,s],[,a])=>s.source-a.source||s.target-a.target),o=new Map;return{edges:i.map(([s,{source:a,target:l,total:C,relations:c}])=>{const u=`community-edge:${s}`,h=kB(c),m=h[0];return m&&o.set(u,bg(m.relation)),{id:u,source:vu(a),target:vu(l),relation:_B(h,C),weight:C,confidence:"aggregated"}}),pairs:i.map(([,{source:s,target:a}])=>[s,a]),categories:o}}function kB(t){return[...t.entries()].map(([e,n])=>({relation:e,count:n})).sort((e,n)=>n.count-e.count||D0(e.relation)-D0(n.relation)||e.relation.localeCompare(n.relation))}function D0(t){return S0.indexOf(bg(t))}const DB=3;function _B(t,e){const n=t.slice(0,DB),i=n.map(({relation:s,count:a})=>`${a} ${s}`),o=e-n.reduce((s,a)=>s+a.count,0);return o>0&&i.push(`${o} more`),i.join(" · ")}function jB(t){const e=R0(t),n=new Map(t.nodes.map(b=>[b.id,b.community])),i=new Map(t.nodes.map(b=>[b.id,b])),{edges:o,categories:s,pairs:a}=RB(t,n),l=new Map;for(const b of t.nodes)yB(b.kind)&&l.set(b.community,(l.get(b.community)??0)+1);const C=new Map;for(const[b,x]of a){const y=C.get(b)??new Set;y.add(x),C.set(b,y);const S=C.get(x)??new Set;S.add(b),C.set(x,S)}const c=e.order.reduce((b,x)=>Math.max(b,e.members.get(x)?.length??0),1),u=new Map(e.order.map(b=>[b,yu(e.members.get(b)?.length??0,C.get(b)?.size??0,l.get(b)??0)])),h=[...e.order].sort((b,x)=>(u.get(x)??0)-(u.get(b)??0)||(e.members.get(x)?.length??0)-(e.members.get(b)?.length??0)||b-x),m=new Map(t.communities.map(b=>[b.id,b])),v=h.map(b=>{const x=e.members.get(b)??[],y=x[0],S=m.get(b),T=S?.label?.trim(),O=T&&T!==`Community ${b}`?T:y?.communityName?.trim()||y?.label?.trim()||`Community ${b}`,M=S?.color??y?.color?.background??"#7A838E",k=y?i.get(y.id)?.language:void 0;return{id:vu(b),label:O,kind:"community",community:b,communityName:O,degree:C.get(b)?.size??0,memberCount:x.length,detailAvailable:!0,size:NB(x.length,c),color:{background:M,border:M},...k?{language:k}:{}}});return{model:{...t,stats:{nodes:v.length,edges:o.length,communities:v.length,aggregated:!0},nodes:v,edges:o,communities:t.communities.filter(b=>e.members.has(b.id)),hyperedges:[]},edgeCategories:s,importance:new Map(v.map(b=>[b.id,u.get(b.community)??0])),communityOrder:h}}function zB(t,e,n=EB){const i=R0(t).members.get(e);if(!i||i.length===0)return;const o=Math.max(1,Math.trunc(n)),s=i.slice(0,o),a=new Set(s.map(c=>c.id)),l=t.edges.filter(c=>a.has(c.source)&&a.has(c.target)),C=t.communities.find(c=>c.id===e);return{model:{...t,stats:{nodes:s.length,edges:l.length,communities:1,aggregated:!1},nodes:s,edges:l,communities:C?[C]:[],hyperedges:[]},bounded:s.length[h.id,h.community])),s=new Map;for(const h of n)s.set(h.community,e?.importance.get(h.id)??yu(h.memberCount??1,h.degree??0,0));const a=e?.communityOrder??[...n].sort((h,m)=>(s.get(m.community)??0)-(s.get(h.community)??0)||(m.memberCount??0)-(h.memberCount??0)||h.id.localeCompare(m.id)).map(h=>h.community),l=new Map(a.map((h,m)=>[h,m])),C=[...n].sort((h,m)=>(l.get(h.community)??0)-(l.get(m.community)??0)||h.id.localeCompare(m.id)).map(h=>({id:h.community,nodeId:h.id,label:h.communityName?.trim()||h.label,color:h.color?.background??"#6688aa",memberCount:h.memberCount??1,degree:h.degree??0,importance:s.get(h.community)??0})),c=new Map(C.map(h=>[h.id,h])),u=[];for(const h of i){const m=o.get(h.source),v=o.get(h.target);m===void 0||v===void 0||m===v||!c.has(m)||!c.has(v)||u.push({id:h.id,source:m,target:v,weight:Math.max(1,h.weight??1),relation:h.relation,category:e?.edgeCategories.get(h.id)??bg(h.relation)})}return{communities:C,byId:c,links:u,symbols:C.reduce((h,m)=>h+m.memberCount,0)}}function PB(t,e){const n=Math.max(1,Math.trunc(e));return{shown:t.communities.slice(0,n),omitted:Math.max(0,t.communities.length-n)}}const _0={width:1e3,height:620},j0=240;function LB(t,e=j0,n=_0){const i=Math.max(1,Math.trunc(e)),o=t.communities.slice(0,i),s=t.communities.slice(i),a={communities:s.length,symbols:s.reduce((C,c)=>C+c.memberCount,0)},l=[...o.map(C=>({community:C,value:Math.max(1,C.memberCount),tail:!1})),...a.communities>0?[{community:{id:-1,nodeId:"community:tail",label:`${a.communities.toLocaleString()} more communities`,color:"#8A93A0",memberCount:a.symbols,degree:0,importance:0},value:Math.max(1,a.symbols),tail:!0}]:[]];return{tiles:BB(l,n),omitted:a}}function BB(t,e){const n=t.reduce((c,u)=>c+u.value,0);if(n<=0)return[];const i=Math.max(1,Math.min(t.length,Math.round(Math.sqrt(t.length*e.height/e.width)))),o=[];let s=[...t],a=n;for(let c=0;c0;c+=1){const u=i-c,h=a/u,m=[];let v=0;for(;s.length>0;){const b=s[0];if(m.length>0&&v+b.value/2>h&&s.length>u-1)break;m.push(b),v+=b.value,s=s.slice(1)}a-=v,o.push(m)}const l=[];let C=0;for(const c of o){const u=c.reduce((v,b)=>v+b.value,0),h=e.height*(u/n);let m=0;for(const v of c){const b=e.width*(v.value/u);l.push({community:v.community,x:m,y:C,width:b,height:h}),m+=b}C+=h}return l}const ZB=60,GB=12;function FB(t,e=ZB,n=GB){const i=Math.max(1,Math.trunc(e)),o=Math.max(1,Math.trunc(n)),s=t.communities.slice(0,i),a=t.communities.slice(i),l=[];for(let c=0;cb+Math.max(1,x.memberCount),0);let m=0;const v=u.map(b=>{const x=Math.max(1,b.memberCount)/h,y={community:b,x:m,width:x};return m+=x,y});l.push({tier:l.length,entries:v})}const C={communities:a.length,symbols:a.reduce((c,u)=>c+u.memberCount,0)};return C.communities>0&&l.push({tier:l.length,entries:[{community:{id:-1,nodeId:"community:tail",label:`${C.communities.toLocaleString()} more communities`,color:"#8A93A0",memberCount:C.symbols,degree:0,importance:0},x:0,width:1}]}),{lanes:l,omitted:C}}function VB(t,e,n=240){const i=new Map;for(const o of e.lanes)for(const s of o.entries)s.community.id>=0&&i.set(s.community.id,{entry:s,tier:o.tier});return[...t.links].sort((o,s)=>s.weight-o.weight||o.source-s.source||o.target-s.target||o.id.localeCompare(s.id)).flatMap(o=>{const s=i.get(o.source),a=i.get(o.target);return!s||!a?[]:[{link:o,source:s.entry,target:a.entry,sourceTier:s.tier,targetTier:a.tier}]}).slice(0,Math.max(1,Math.trunc(n)))}function St(t,e){return typeof window>"u"?e:getComputedStyle(document.documentElement).getPropertyValue(t).trim()||e}function xu(){const[t,e]=E.useState(0);return E.useEffect(()=>{const n=()=>e(s=>s+1),i=new MutationObserver(n);i.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style"]}),i.observe(document.body,{attributes:!0,attributeFilter:["class","style"]});const o=typeof window.matchMedia=="function"?window.matchMedia("(prefers-color-scheme: dark)"):void 0;return o?.addEventListener("change",n),()=>{i.disconnect(),o?.removeEventListener("change",n)}},[]),t}function z0(){return St("--vscode-editor-background",St("--compass-canvas",St("--background","#FBFCFD")))}const UB=[{value:"auto",label:"Auto",hint:"Follow the operating system theme"},{value:"light",label:"Light",hint:"Always use the light palette"},{value:"dark",label:"Dark",hint:"Always use the dark palette"}];function P0(t){if(typeof document>"u")return;const e=document.documentElement;t==="auto"?delete e.dataset.compassTheme:e.dataset.compassTheme=t}const HB=32;function YB({data:t,limit:e=HB,onOpenCommunity:n}){const{shown:i,omitted:o}=E.useMemo(()=>PB(t,e),[t,e]),[s,a]=E.useState(null),l=E.useMemo(()=>{const m=new Map;for(const v of t.links)m.set(`${v.source}:${v.target}`,v),m.set(`${v.target}:${v.source}`,v);return m},[t.links]),C=E.useMemo(()=>t.links.reduce((m,v)=>Math.max(m,v.weight),1),[t.links]),c=E.useMemo(()=>t.links.some(m=>m.category!=="other"),[t.links]),u=s?l.get(s):void 0,h=s?.split(":").map(Number)??[];return d.jsxs("div",{className:"compass-variant compass-matrix","data-variant":"matrix",children:[d.jsx("div",{className:"compass-variant-scroll",children:d.jsxs("table",{role:"grid","aria-label":"Community coupling matrix",children:[d.jsx("caption",{className:"sr-only",children:"Community coupling. Rows are relationships from a community, columns are relationships to a community."}),d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{scope:"col","aria-label":"Community"}),i.map((m,v)=>d.jsx("th",{scope:"col","data-active":h[1]===m.id?"true":void 0,title:`${m.label} · ${m.memberCount.toLocaleString()} symbols`,children:d.jsx("span",{className:"compass-matrix-column-label",children:v+1})},m.id))]})}),d.jsx("tbody",{children:i.map(m=>d.jsxs("tr",{"data-active":h[0]===m.id?"true":void 0,children:[d.jsxs("th",{scope:"row",children:[d.jsx("span",{className:"compass-matrix-dot","aria-hidden":"true",style:{background:m.color}}),d.jsx("span",{className:"compass-matrix-row-label",children:m.label}),d.jsx("small",{children:m.memberCount.toLocaleString()})]}),i.map(v=>{const b=m.id===v.id,x=b?void 0:l.get(`${m.id}:${v.id}`),y=x?Math.min(.94,.22+.72*Math.sqrt(x.weight/C)):0,S=`${m.id}:${v.id}`;return d.jsxs("td",{"data-self":b?"true":void 0,"data-filled":x?"true":void 0,children:[d.jsxs("button",{type:"button",className:"compass-matrix-cell","aria-label":b?`${m.label}, ${m.memberCount.toLocaleString()} symbols`:x?`${m.label} to ${v.label}: ${x.relation}`:`${m.label} to ${v.label}: no direct relationship`,disabled:b||x===void 0,style:x?{"--compass-matrix-fill":T0(x.category),"--compass-matrix-intensity":y}:void 0,onMouseEnter:()=>a(x?S:null),onMouseLeave:()=>a(null),onFocus:()=>a(x?S:null),onBlur:()=>a(null),onClick:()=>n(x?v.id:m.id),children:[d.jsx("span",{className:"sr-only",children:x?`${x.weight} relationships`:"No relationship"}),x?d.jsx("i",{"aria-hidden":"true",style:{opacity:y}}):null]}),b?d.jsx("span",{className:"compass-matrix-self","aria-hidden":"true"}):null]},S)})]},m.id))})]})}),d.jsxs("div",{className:"compass-variant-footer",role:"status",children:[d.jsxs("span",{children:[i.length.toLocaleString()," of ",t.communities.length.toLocaleString()," communities",o>0?` · ${o.toLocaleString()} more below the importance cut`:""]}),u&&h.length===2?d.jsxs("span",{className:"compass-variant-detail",children:[d.jsxs("strong",{children:[t.byId.get(h[0])?.label," → ",t.byId.get(h[1])?.label]}),d.jsx("span",{children:u.relation})]}):d.jsx("span",{className:"compass-variant-hint",children:c?"Cell colour is the dominant relationship kind · select a cell to open that community":"This export records relationship counts without kinds · select a cell to open that community"})]})]})}function L0(t){const e=E.useRef(null),[n,i]=E.useState(t);return E.useEffect(()=>{const o=e.current;if(!o)return;const s=()=>{const l=o.clientWidth,C=o.clientHeight;l<=0||C<=0||i(c=>c.width===l&&c.height===C?c:{width:l,height:C})};if(s(),typeof ResizeObserver>"u")return;const a=new ResizeObserver(s);return a.observe(o),()=>a.disconnect()},[]),{ref:e,size:n}}function DC(t){const e=t.match(/^#([\da-f]{3}|[\da-f]{6})$/i)?.[1];if(e){const i=e.length===3?[...e].map(o=>`${o}${o}`).join(""):e;return[Number.parseInt(i.slice(0,2),16),Number.parseInt(i.slice(2,4),16),Number.parseInt(i.slice(4,6),16)]}const n=t.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)/i);if(n)return[Number.parseFloat(n[1]??"0"),Number.parseFloat(n[2]??"0"),Number.parseFloat(n[3]??"0")]}function B0(t,e,n){const i=DC(t),o=DC(e);if(!i||!o)return e;const s=i.map((a,l)=>Math.round(a*(1-n)+o[l]*n));return`rgb(${s[0]}, ${s[1]}, ${s[2]})`}function Su(t){const e=t/255;return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Z0(t){const e=DC(t);return e?.2126*Su(e[0])+.7152*Su(e[1])+.0722*Su(e[2]):1}function G0(t){const e=DC(t);return e?(e[0]*299+e[1]*587+e[2]*114)/1e3<145:!0}const F0="#0E1319",V0="#F5F8FC";function U0(t,e){const n=Z0(t),i=Z0(e),o=Math.max(n,i),s=Math.min(n,i);return(o+.05)/(s+.05)}function _C(t,e,n=1){const i=n>=1||n<=0?t:B0(e,t,n);return U0(i,F0)>=U0(i,V0)?F0:V0}const H0=.82;function $B({data:t,onOpenCommunity:e}){const{ref:n,size:i}=L0(_0),o=xu(),s=E.useMemo(()=>z0(),[o]),a=E.useMemo(()=>LB(t,j0,i),[t,i]),[l,C]=E.useState(null),c=l===null?void 0:t.byId.get(l),u=E.useMemo(()=>l===null?[]:t.links.filter(h=>h.source===l||h.target===l).sort((h,m)=>m.weight-h.weight||h.id.localeCompare(m.id)).slice(0,3),[l,t.links]);return d.jsxs("div",{className:"compass-variant compass-treemap","data-variant":"treemap",ref:n,children:[d.jsx("svg",{className:"compass-treemap-canvas",viewBox:`0 0 ${i.width} ${i.height}`,role:"group","aria-label":"Community area map",preserveAspectRatio:"none",children:a.tiles.map(h=>{const m=h.community.id<0,v=h.width>96&&h.height>46,b=h.width>70&&h.height>30;return d.jsxs("g",{transform:`translate(${h.x} ${h.y})`,"data-tail":m?"true":void 0,"data-active":l===h.community.id?"true":void 0,children:[d.jsx("rect",{width:Math.max(0,h.width-1.5),height:Math.max(0,h.height-1.5),rx:3,fill:h.community.color,fillOpacity:m?.32:.82}),m?null:d.jsx("rect",{className:"compass-treemap-hit",width:h.width,height:h.height,tabIndex:0,role:"button","aria-label":`${h.community.label}, ${h.community.memberCount.toLocaleString()} symbols`,onMouseEnter:()=>C(h.community.id),onMouseLeave:()=>C(null),onFocus:()=>C(h.community.id),onBlur:()=>C(null),onClick:()=>e(h.community.id),onKeyDown:x=>{x.key!=="Enter"&&x.key!==" "||(x.preventDefault(),e(h.community.id))}}),v?d.jsx("text",{className:"compass-treemap-label",x:7,y:20,style:m?void 0:{fill:_C(h.community.color,s,H0)},children:h.community.label}):null,b?d.jsxs("text",{className:"compass-treemap-count",x:7,y:v?36:22,style:m?void 0:{fill:_C(h.community.color,s,H0)},children:[h.community.memberCount.toLocaleString()," symbols"]}):null]},h.community.nodeId)})}),d.jsxs("div",{className:"compass-variant-footer",role:"status",children:[d.jsxs("span",{children:[t.communities.length.toLocaleString()," communities ·"," ",t.symbols.toLocaleString()," symbols · area is symbol count",a.omitted.communities>0?` · ${a.omitted.communities.toLocaleString()} smallest disclosed as one tile`:""]}),c?d.jsxs("span",{className:"compass-variant-detail",children:[d.jsx("strong",{children:c.label}),d.jsxs("span",{children:[c.memberCount.toLocaleString()," symbols"]}),u.map(h=>d.jsxs("span",{children:["↔ ",t.byId.get(h.source===c.id?h.target:h.source)?.label," ",h.relation]},h.id))]}):d.jsx("span",{className:"compass-variant-hint",children:"Hover a tile for its couplings · select a tile to open that community"})]})]})}const WB={width:1e3,height:620},Y0=26,KB=54,XB=96;function QB({data:t,onOpenCommunity:e}){const{ref:n,size:i}=L0(WB),o=xu(),s=E.useMemo(()=>z0(),[o]),a=E.useMemo(()=>FB(t),[t]),l=E.useMemo(()=>VB(t,a),[t,a]),C=Math.max(1,a.lanes.length),c=Math.max(KB,Math.min(XB,(i.height-40)/C-Y0)),[u,h]=E.useState(null),m=l.reduce((O,M)=>Math.max(O,M.link.weight),1),v=t.links.some(O=>O.category!=="other"),b=O=>20+O*(c+Y0),x=b(C-1)+c+12,y=Math.max(i.height,x),S=O=>8+O*(i.width-16),T=u===null?void 0:t.byId.get(u);return d.jsxs("div",{className:"compass-variant compass-lanes","data-variant":"lanes",ref:n,children:[d.jsxs("svg",{className:"compass-lanes-canvas",viewBox:`0 0 ${i.width} ${y}`,role:"group","aria-label":"Community tier map",preserveAspectRatio:"none",children:[l.map(O=>{const M=S(O.source.x+O.source.width/2),k=S(O.target.x+O.target.width/2),G=b(O.sourceTier)+c,L=b(O.targetTier),F=O.sourceTier<=O.targetTier,re=F?G:L+c,pe=F?L:G+c,ie=(re+pe)/2,J=u!==null&&(O.link.source===u||O.link.target===u);return d.jsx("path",{className:"compass-lane-ribbon","data-active":J?"true":void 0,"data-dim":u!==null&&!J?"true":void 0,d:`M ${M} ${G} C ${M} ${ie}, ${k} ${ie}, ${k} ${L}`,stroke:T0(O.link.category),strokeWidth:Math.min(12,1.4+3.4*Math.sqrt(O.link.weight/m)),children:d.jsx("title",{children:`${t.byId.get(O.link.source)?.label} ↔ ${t.byId.get(O.link.target)?.label}: ${O.link.relation}`})},O.link.id)}),a.lanes.map(O=>d.jsxs("g",{transform:`translate(0 ${b(O.tier)})`,children:[d.jsx("text",{className:"compass-lane-tier",x:8,y:-6,children:O.tier===a.lanes.length-1&&a.omitted.communities>0?"tail":`tier ${O.tier+1}`}),O.entries.map(M=>{const k=M.community.id<0,G=Math.max(2,M.width*(i.width-16)),L=G>78;return d.jsxs("g",{transform:`translate(${S(M.x)} 0)`,"data-tail":k?"true":void 0,children:[d.jsx("rect",{className:"compass-lane-bar",width:Math.max(0,G-2),height:c,rx:4,fill:M.community.color,fillOpacity:k?.3:u===M.community.id?1:.86}),k?null:d.jsx("rect",{className:"compass-lane-hit",width:Math.max(2,G-2),height:c,tabIndex:0,role:"button","aria-label":`${M.community.label}, ${M.community.memberCount.toLocaleString()} symbols`,onMouseEnter:()=>h(M.community.id),onMouseLeave:()=>h(null),onFocus:()=>h(M.community.id),onBlur:()=>h(null),onClick:()=>e(M.community.id),onKeyDown:F=>{F.key!=="Enter"&&F.key!==" "||(F.preventDefault(),e(M.community.id))}}),L?d.jsxs(d.Fragment,{children:[d.jsx("text",{className:"compass-lane-label",x:8,y:26,style:k?void 0:{fill:_C(M.community.color,s,.86)},children:M.community.label.length>18?`${M.community.label.slice(0,17).trimEnd()}…`:M.community.label}),d.jsx("text",{className:"compass-lane-count",x:8,y:c>64?44:40,style:k?void 0:{fill:_C(M.community.color,s,.86)},children:k?`${M.community.memberCount.toLocaleString()} symbols`:M.community.memberCount.toLocaleString()})]}):null]},M.community.nodeId)})]},O.tier))]}),d.jsxs("div",{className:"compass-variant-footer",role:"status",children:[d.jsxs("span",{children:[t.communities.length.toLocaleString()," communities ·"," ",l.length.toLocaleString()," couplings drawn · tier 1 is the most coupled and boundary-rich layer",a.omitted.communities>0?` · ${a.omitted.communities.toLocaleString()} more in the tail`:""]}),T?d.jsxs("span",{className:"compass-variant-detail",children:[d.jsx("strong",{children:T.label}),d.jsxs("span",{children:[T.memberCount.toLocaleString()," symbols ·"," ",T.degree.toLocaleString()," coupling",T.degree===1?"":"s"]})]}):d.jsx("span",{className:"compass-variant-hint",children:v?"Ribbon colour is the relationship kind · select a tier bar to open that community":"This export records relationship counts without kinds · select a tier bar to open that community"})]})]})}const $0=new Set(["color","change","evidence"]),qB=new Set(["anchor","anchors","columnEnd","columnStart","community","communityName","community_name","degree","endByte","endColumn","endLine","lineEnd","lineStart","line_end","line_start","location","normLabel","norm_label","relationshipSite","relationship_site","size","sourceDigest","sourceFile","sourceHash","source_digest","source_file","source_hash","startByte","startColumn","startLine","wiringSite","wiring_site"]);function jC(t,e){const n=zC(t),i=zC(e);return{...n?{before:n}:{},...i?{after:i}:{},fields:Tu(n,i)}}function W0(t,e,n){const i=zC(t),o=zC(e),s=Eu(t,n),a=Eu(e,n);return{...i?{before:i}:{},...o?{after:o}:{},fields:Tu(s,a)}}function JB(t,e){return Eu(t,e)??{}}function eZ(t,e=240){const n=t===void 0?"Not recorded":typeof t=="string"?t:JSON.stringify(t,null,cA(t)?2:void 0)??String(t);return n.length<=e?{text:n,truncated:!1}:{text:`${n.slice(0,Math.max(0,e-1)).trimEnd()}…`,truncated:!0}}function zC(t){if(t)return Q0(t)}function Eu(t,e){return t?X0(t,e==="node"?new Set(["source"]):new Set(["id","key"])):void 0}function K0(t){return Array.isArray(t)?t.map(K0):cA(t)?X0(t):t}function X0(t,e=new Set){return Object.fromEntries(Object.keys(t).filter(n=>!$0.has(n)&&!qB.has(n)&&!e.has(n)).sort((n,i)=>n.localeCompare(i)).map(n=>[n,K0(t[n])]))}function PC(t){return Array.isArray(t)?t.map(PC):cA(t)?Q0(t):t}function Q0(t){return Object.fromEntries(Object.keys(t).filter(e=>!$0.has(e)).sort((e,n)=>e.localeCompare(n)).map(e=>[e,PC(t[e])]))}function Tu(t,e,n=""){const i=new Set([...Object.keys(t??{}),...Object.keys(e??{})]),o=[];for(const s of[...i].sort((a,l)=>a.localeCompare(l))){const a=n?`${n}.${s}`:s,l=t?.[s],C=e?.[s];cA(l)&&cA(C)?o.push(...Tu(l,C,a)):tZ(l,C)||o.push({field:a,...l!==void 0?{before:l}:{},...C!==void 0?{after:C}:{}})}return o}function tZ(t,e){return JSON.stringify(PC(t))===JSON.stringify(PC(e))}function cA(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function nZ({node:t,edges:e,nodes:n,sourceRevisions:i,onFocus:o,onOpenSource:s}){const a=ew(t.evidence?.before),l=ew(t.evidence?.after);return d.jsxs(d.Fragment,{children:[t.evidence?.fields.length?d.jsxs("section",{className:"compass-record-evidence","aria-labelledby":"compass-node-changes-title",children:[d.jsxs("div",{className:"compass-evidence-heading",children:[d.jsx("h3",{id:"compass-node-changes-title",children:iZ(t.change)}),d.jsxs("span",{children:[t.evidence.fields.length," fields"]})]}),d.jsx(q0,{fields:t.evidence.fields}),t.change==="changed"&&(a||l)&&d.jsxs("div",{className:"compass-evidence-source-actions",children:[a&&d.jsxs("button",{type:"button",onClick:()=>s(a,i?.before),children:[d.jsx(RC,{"aria-hidden":"true"}),"Open before"]}),l&&d.jsxs("button",{type:"button",onClick:()=>s(l,i?.after),children:[d.jsx(RC,{"aria-hidden":"true"}),"Open after"]})]})]}):null,d.jsxs("section",{className:"compass-relationship-evidence","aria-labelledby":"compass-relationships-title",children:[d.jsxs("div",{className:"compass-neighbors-heading",children:[d.jsx("span",{id:"compass-relationships-title",children:"Relationships"}),d.jsx("strong",{children:e.length})]}),e.length?d.jsx("div",{className:"compass-relationship-list",children:e.map(C=>{const c=C.source===t.id?C.target:C.source,u=n.get(c);return d.jsxs("details",{children:[d.jsxs("summary",{children:[d.jsx("span",{className:"compass-change-badge","data-change":C.change,children:tw(C.change)}),d.jsx("span",{className:"compass-relationship-target",children:u?.label??c}),d.jsx("small",{children:C.relation}),C.confidence&&d.jsx("i",{children:C.confidence})]}),d.jsxs("div",{className:"compass-relationship-detail",children:[C.change==="changed"&&C.evidence?.fields.length?d.jsx(q0,{fields:C.evidence.fields}):d.jsxs("p",{children:[tw(C.change)," relationship: ",C.source," → ",C.target]}),d.jsxs("button",{type:"button",onClick:()=>o(c),children:["Focus ",u?.label??c]})]})]},C.id)})}):d.jsx("span",{className:"compass-empty",children:"No connected relationships"})]})]})}function q0({fields:t}){return d.jsx("div",{className:"compass-field-table-wrap",children:d.jsxs("table",{className:"compass-field-table",children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"Field"}),d.jsx("th",{children:"Before"}),d.jsx("th",{children:"After"})]})}),d.jsx("tbody",{children:t.map(e=>d.jsxs("tr",{children:[d.jsx("th",{scope:"row",children:e.field}),d.jsx(J0,{value:e.before}),d.jsx(J0,{value:e.after})]},e.field))})]})})}function J0({value:t}){const e=eZ(t);return d.jsxs("td",{children:[d.jsx("code",{children:e.text}),e.truncated&&d.jsx("span",{className:"compass-value-truncated",children:"Value shortened"})]})}function ew(t){const e=OC.safeParse(t?.source);return e.success?e.data:void 0}function tw(t){return!t||t==="unchanged"?"Context":`${t[0]?.toLocaleUpperCase()}${t.slice(1)}`}function iZ(t){return t==="added"?"Added symbol metadata":t==="removed"?"Removed symbol metadata":"What changed"}const nw=100,iw={changed:0,added:1,removed:2,unchanged:3};function oZ({nodes:t,query:e,selectedId:n,onFocus:i}){const[o,s]=E.useState(!1),a=e.trim().toLocaleLowerCase(),l=t.filter(c=>c.change&&c.change!=="unchanged").filter(c=>!a||c.label.toLocaleLowerCase().includes(a)||c.kind?.toLocaleLowerCase().includes(a)||c.source?.file.toLocaleLowerCase().includes(a)).sort((c,u)=>iw[c.change??"unchanged"]-iw[u.change??"unchanged"]||c.label.localeCompare(u.label)||c.id.localeCompare(u.id)),C=o?l:l.slice(0,nw);return d.jsxs("section",{className:"compass-changed-symbols","aria-labelledby":"compass-changed-symbols-title",children:[d.jsxs("div",{className:"compass-section-heading",children:[d.jsx("h2",{id:"compass-changed-symbols-title",children:"Changed symbols"}),d.jsx("span",{children:l.length})]}),C.length?d.jsx("div",{className:"compass-changed-symbol-list",children:C.map(c=>d.jsxs("button",{type:"button","aria-pressed":c.id===n,"data-change":c.change,onClick:()=>i(c.id),children:[d.jsx("span",{className:"compass-changed-symbol-status",children:rZ(c.change)}),d.jsx("strong",{children:c.label}),d.jsx("small",{children:c.source?.file??c.kind??"Graph symbol"})]},c.id))}):d.jsx("p",{className:"compass-empty",children:a?"No affected symbols match this search.":"No symbol changes."}),!o&&l.length>nw&&d.jsxs("button",{className:"compass-changed-symbol-expand",type:"button",onClick:()=>s(!0),children:["Show all ",l.length.toLocaleString()," affected symbols"]})]})}function rZ(t){return!t||t==="unchanged"?"Context":`${t[0]?.toLocaleUpperCase()}${t.slice(1)}`}function ow({evidence:t,diagnostics:e=[],truncated:n=!1,title:i="Trust evidence",onOpenSource:o}){return!t.length&&!e.length&&!n?null:d.jsxs("section",{className:"compass-code-evidence","aria-label":i,children:[d.jsxs("div",{className:"compass-evidence-heading",children:[d.jsx("h3",{children:i}),d.jsxs("span",{children:[t.length," ",t.length===1?"record":"records"]})]}),n&&d.jsxs("p",{className:"compass-code-diagnostic","data-severity":"warning",role:"status",children:[d.jsx(IA,{"aria-hidden":"true"}),"Results reached a configured limit. Narrow the query or raise one bound."]}),e.map(s=>d.jsxs("p",{className:"compass-code-diagnostic","data-severity":s.code==="no_match"?"info":"warning",role:"status",children:[s.code==="no_match"?d.jsx(a0,{"aria-hidden":"true"}):d.jsx(IA,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:aZ(s.code)}),s.message]})]},`${s.code}:${s.message}`)),d.jsx("div",{className:"compass-code-evidence-ledger",children:t.map((s,a)=>{const l=gZ(s),C=s.wiringSite??s.anchor;return d.jsxs("article",{className:"compass-code-evidence-entry","data-status":l.key,children:[d.jsx("span",{className:"compass-code-evidence-icon","aria-hidden":"true",children:d.jsx(sZ,{item:s})}),d.jsxs("div",{className:"compass-code-evidence-copy",children:[d.jsxs("div",{className:"compass-code-evidence-status",children:[d.jsx("strong",{children:l.label}),d.jsx("span",{children:s.layer==="program_ir"?"Program IR":"Code graph"})]}),d.jsxs("dl",{children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Extractor"}),d.jsx("dd",{children:s.extractor})]}),d.jsxs("div",{children:[d.jsx("dt",{children:"Confidence"}),d.jsx("dd",{children:s.confidence})]}),s.rule&&d.jsxs("div",{children:[d.jsx("dt",{children:"Rule"}),d.jsx("dd",{children:s.rule})]})]}),C&&(o?d.jsxs("button",{className:"compass-code-evidence-source",type:"button",onClick:()=>o(C),children:[d.jsx(RC,{"aria-hidden":"true"}),rw(s,C)]}):d.jsx("span",{className:"compass-code-evidence-source",children:rw(s,C)})),s.candidates.length>0&&d.jsxs("div",{className:"compass-code-candidates",children:[d.jsx("span",{children:"Retained candidates"}),d.jsx("ul",{children:s.candidates.map(c=>d.jsxs("li",{children:[d.jsx("code",{children:c.nodeId}),d.jsx("span",{children:c.reason}),d.jsx("small",{children:c.confidence})]},`${c.nodeId}:${c.reason}`))})]})]})]},`${s.layer}:${s.extractor}:${a}`)})})]})}function sZ({item:t}){return t.resolution==="unresolved"?d.jsx(a0,{}):t.resolution==="ambiguous"||t.confidence==="ambiguous"?d.jsx(IA,{}):t.origin==="heuristic"?d.jsx(fu,{}):t.origin==="config"?d.jsx(M4,{}):t.origin==="convention"?d.jsx(J4,{}):d.jsx(p4,{})}function gZ(t){return t.resolution==="unresolved"?{key:"unresolved",label:"Unresolved"}:t.resolution==="ambiguous"||t.confidence==="ambiguous"?{key:"ambiguous",label:"Ambiguous"}:t.origin==="heuristic"?{key:"heuristic",label:"Heuristic"}:t.origin==="config"?{key:"config",label:"Configuration"}:t.origin==="convention"?{key:"convention",label:"Convention"}:{key:"exact",label:"Exact"}}function rw(t,e){return`${t.origin==="heuristic"?"Wired at":"Evidence at"} ${e.file}:${e.startLine}`}function aZ(t){return`${t.replaceAll("_"," ")}: `}const wg=[{id:"combined",label:"Combined"},{id:"native",label:"Native"},{id:"ocr",label:"OCR evidence"}];function AZ(t,e){if(!e.document)return;const n=e.source?.file,i=t.nodes.filter(a=>a.document?n===void 0||a.source?.file===n:!1),o=i.find(a=>a.document?.role==="root")??(e.document.role==="root"?e:void 0),s=i.filter(a=>a.document?.role==="block");if(e.document.role==="block"&&!s.some(a=>a.id===e.id)&&s.push(e),!(!o&&s.length===0))return s.sort(hZ),{...n!==void 0?{sourceFile:n}:{},...o?{root:o}:{},blocks:s}}function lZ({context:t,selectedId:e,onFocus:n}){const[i,o]=E.useState("combined"),s=E.useMemo(()=>t.blocks.filter(Ou),[t.blocks]),a=E.useMemo(()=>t.blocks.filter(y=>!Ou(y)),[t.blocks]),[l,C]=E.useState(e&&s.some(y=>y.id===e)?e:s[0]?.id);E.useEffect(()=>{o("combined"),C(e&&s.some(y=>y.id===e)?e:s[0]?.id)},[t.sourceFile,s,e]);const c=i==="ocr"?s:i==="native"?a:t.blocks,u=t.root?.document,h=u?.visualCoverage??(s.length>0?"complete":"not_requested"),m=u?.ocrMode??(s.length>0?"auto":"off"),v=gw(u?.ocrProfile)??s.map(y=>gw(Nu(y)?.profile)).find(Boolean),b=h==="failed"?"failed":h==="partial"?"partial":u?.complete===!1?"incomplete":void 0,x=s.find(y=>y.id===l);return d.jsxs("section",{className:"compass-document-evidence","aria-labelledby":"compass-document-evidence-title",children:[d.jsxs("header",{className:"compass-document-evidence-header",children:[d.jsxs("div",{className:"compass-document-evidence-heading",children:[d.jsx("span",{className:"compass-document-evidence-mark","aria-hidden":"true",children:d.jsx(m0,{})}),d.jsxs("span",{children:[d.jsx("small",{children:"Document evidence"}),d.jsx("h3",{id:"compass-document-evidence-title",children:pZ(t.sourceFile,u?.format)})]})]}),d.jsx(CZ,{mode:m,coverage:h,...v?{profile:v}:{}})]}),b&&d.jsxs("div",{className:"compass-document-warning","data-status":b,role:"alert",children:[d.jsx(Q4,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:b==="failed"?"OCR could not complete":b==="partial"?"OCR coverage is partial":"Document extraction is incomplete"}),d.jsx("small",{children:b==="incomplete"?"Compass retained the available evidence; review the document diagnostics before relying on it as complete.":"Native text is still available. Some visual regions could not be processed."})]})]}),d.jsx("div",{className:"compass-document-tabs",role:"tablist","aria-label":"Document evidence views",children:wg.map((y,S)=>{const T=y.id==="ocr"?s.length:y.id==="native"?a.length:t.blocks.length,O=i===y.id;return d.jsxs("button",{id:`compass-document-tab-${y.id}`,className:"compass-document-tab",type:"button",role:"tab","aria-selected":O,"aria-controls":"compass-document-panel",tabIndex:O?0:-1,onClick:()=>o(y.id),onKeyDown:M=>{const k=M.key==="ArrowRight"?(S+1)%wg.length:M.key==="ArrowLeft"?(S-1+wg.length)%wg.length:M.key==="Home"?0:M.key==="End"?wg.length-1:void 0;if(k===void 0)return;M.preventDefault();const G=wg[k];G&&(o(G.id),document.getElementById(`compass-document-tab-${G.id}`)?.focus())},children:[y.label,d.jsx("span",{children:T})]},y.id)})}),d.jsx("div",{id:"compass-document-panel",className:"compass-document-tab-panel",role:"tabpanel","aria-labelledby":`compass-document-tab-${i}`,tabIndex:0,children:c.length>0?d.jsx("div",{className:"compass-document-block-list",children:c.map(y=>d.jsx(IZ,{block:y,active:y.id===e,onClick:()=>{Ou(y)&&C(y.id),n(y.id)}},y.id))}):d.jsxs("div",{className:"compass-document-empty",children:[d.jsx(A0,{"aria-hidden":"true"}),d.jsx("strong",{children:i==="ocr"?"No OCR evidence":"No document blocks"}),d.jsx("span",{children:i==="ocr"?"Run extraction with a managed OCR profile to inspect visual text.":"This document did not publish readable native blocks."})]})}),x&&d.jsx(uZ,{block:x,siblings:s,...u?.previews?{previews:u.previews}:{},onFocus:y=>{C(y),n(y)}}),!x&&u?.previews&&u.previews.length>0&&d.jsx(dZ,{previews:u.previews})]})}function CZ({mode:t,coverage:e,profile:n}){const i=e==="complete",o=t!=="off",s=`OCR ${o?aw(t):"Off"} · ${o?Aw(e):"Native only"}${n?` · ${n}`:""}`;return d.jsxs("span",{className:"compass-ocr-status-chip","data-status":e,role:"status","aria-label":s,title:s,children:[i?d.jsx(x4,{"aria-hidden":"true"}):d.jsx(IA,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsxs("strong",{children:["OCR ",o?aw(t):"Off"]}),d.jsx("small",{children:o?Aw(e):"Native only"})]}),n&&d.jsx("em",{children:n})]})}function IZ({block:t,active:e,onClick:n}){const i=Nu(t),o=t.document?.text??t.label,s=t.document?.locator;return d.jsxs("button",{className:"compass-document-block","data-origin":i?"ocr":"native","data-active":e,type:"button","aria-pressed":e,onClick:n,children:[d.jsxs("span",{className:"compass-document-block-topline",children:[d.jsxs("span",{className:"compass-document-block-kind",children:[i?d.jsx(m0,{"aria-hidden":"true"}):d.jsx(A0,{"aria-hidden":"true"}),i?"OCR evidence":mZ(t.document?.kind)]}),i&&d.jsx(cZ,{confidence:i.confidence_bps})]}),d.jsx("span",{className:"compass-document-block-text",children:o||"(empty block)"}),d.jsxs("span",{className:"compass-document-block-locator",children:[d.jsx(z4,{"aria-hidden":"true"}),xg(s),i&&d.jsx(O4,{"aria-hidden":"true"})]})]})}function cZ({confidence:t}){const e=Math.max(0,Math.min(100,t/100)),n=e>=85?"high":e>=60?"medium":"low";return d.jsxs("span",{className:"compass-ocr-confidence","data-confidence":n,children:[e.toFixed(2),"%"]})}function dZ({previews:t}){const[e,n]=E.useState(0);E.useEffect(()=>{n(o=>Math.min(o,Math.max(0,t.length-1)))},[t.length]);const i=t[e];return i?d.jsxs("div",{className:"compass-ocr-preview compass-document-preview-gallery","aria-label":"Document preview",children:[d.jsxs("header",{children:[d.jsxs("span",{children:[d.jsx("strong",{children:i.label}),d.jsxs("small",{children:[xg(i.locator)," · Normalized preview"]})]}),t.length>1&&d.jsxs("span",{className:"compass-document-preview-controls",children:[d.jsx("button",{type:"button","aria-label":"Previous document preview",disabled:e===0,onClick:()=>n(o=>Math.max(0,o-1)),children:d.jsx(b4,{"aria-hidden":"true"})}),d.jsxs("span",{children:[e+1," / ",t.length]}),d.jsx("button",{type:"button","aria-label":"Next document preview",disabled:e===t.length-1,onClick:()=>n(o=>Math.min(t.length-1,o+1)),children:d.jsx(MC,{"aria-hidden":"true"})})]})]}),d.jsx("div",{className:"compass-document-preview-stage",children:d.jsx("img",{className:"compass-document-preview-image",src:lw(i.svg),alt:`${i.label} document preview`})}),d.jsx("p",{children:"Compass generated a bounded local snapshot. Native text remains the authoritative evidence."})]}):null}function uZ({block:t,siblings:e,previews:n,onFocus:i}){const o=t.document.locator,s=LC(o.width),a=LC(o.height),l=o.candidate_id,C=e.filter(u=>{const h=u.document.locator;return h.candidate_id===l&&h.width===o.width&&h.height===o.height});if(!s||!a)return null;const c=vZ(n,o);return d.jsxs("div",{className:"compass-ocr-preview","aria-label":"OCR region preview",children:[d.jsxs("header",{children:[d.jsxs("span",{children:[d.jsx("strong",{children:c?.label??"Visual region"}),d.jsxs("small",{children:[xg(o.owner)," · ",s," × ",a,"px"]})]}),d.jsxs("span",{className:"compass-ocr-preview-key",children:[d.jsx("i",{}),"OCR boxes",c?" · normalized preview":""]})]}),c?d.jsxs("div",{className:"compass-document-preview-stage",children:[d.jsx("img",{className:"compass-document-preview-image",src:lw(c.svg),alt:`${c.label} document preview`}),d.jsx("svg",{className:"compass-document-preview-overlay",viewBox:`0 0 ${c.width} ${c.height}`,role:"img","aria-label":`OCR bounding boxes over ${c.label}`,preserveAspectRatio:"none",children:C.map(u=>{const h=yZ(u.document.locator,c);return h?sw(u,h,u.id===t.id,i):null})})]}):d.jsxs("svg",{className:"compass-ocr-preview-canvas",viewBox:`0 0 ${s} ${a}`,role:"img","aria-label":`OCR bounding boxes for ${xg(o.owner)}`,children:[d.jsx("defs",{children:d.jsx("pattern",{id:"compass-ocr-preview-grid",width:"32",height:"32",patternUnits:"userSpaceOnUse",children:d.jsx("path",{d:"M 32 0 L 0 0 0 32",fill:"none",stroke:"currentColor",strokeOpacity:"0.12",strokeWidth:"1"})})}),d.jsx("rect",{width:s,height:a,fill:"var(--compass-ocr-preview-surface)"}),d.jsx("rect",{width:s,height:a,fill:"url(#compass-ocr-preview-grid)"}),C.map(u=>{const h=u.document.locator,m=wZ(h.polygon,s,a);return m?sw(u,m,u.id===t.id,i):null})]}),d.jsx("p",{children:c?"OCR boxes are mapped to the embedded image region. Click a box to inspect its text and confidence.":"Click a highlighted region to inspect its text and confidence."})]})}function sw(t,e,n,i){return d.jsx("polygon",{className:"compass-ocr-preview-box","data-active":n,points:e,role:"button",tabIndex:0,"aria-label":`${t.document.text??t.label} · ${xg(t.document.locator)}`,onClick:()=>i(t.id),onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),i(t.id))},children:d.jsx("title",{children:t.document.text??t.label})},t.id)}function Ou(t){return Nu(t)!==void 0&&t.document?.locator?.kind==="ocr"}function Nu(t){return t.document?.origin?.kind==="ocr"?t.document.origin:void 0}function hZ(t,e){const n=t.document?.ordinal??Number.MAX_SAFE_INTEGER,i=e.document?.ordinal??Number.MAX_SAFE_INTEGER;return n-i||t.id.localeCompare(e.id)}function gw(t){const e=t?.profile;return typeof e=="string"?fZ(e):void 0}function fZ(t){return t.replace(/^pp-/,"PP-").replace(/ocrv(\d+)/i,"OCRv$1").replace(/-(small|medium)$/i,(e,n)=>` ${n[0]?.toUpperCase()}${n.slice(1)}`)}function aw(t){return t.length>0?`${t[0]?.toUpperCase()}${t.slice(1)}`:"Off"}function Aw(t){return{complete:"Complete",partial:"Partial coverage",failed:"Failed",not_requested:"Not requested"}[t]??"Unknown"}function pZ(t,e){const n=t?.split(/[\\/]/).pop()??"Document";return e?`${n} · ${e.toUpperCase()}`:n}function mZ(t){return t?t.replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase()):"Native text"}function xg(t){if(!t)return"Location unavailable";switch(t.kind){case"ocr":{const e=Ut(t,"owner"),n=oi(Ut(t,"occurrence"))??0;return`${xg(Cw(e)?e:void 0)} · Region ${n+1}`}case"pdf":return`Page ${oi(Ut(t,"page"))??"?"}`;case"page":return`Page ${oi(Ut(t,"page"))??"?"}`;case"slide":return`Slide ${oi(Ut(t,"slide"))??"?"}${Ut(t,"shape")!==void 0?` · Shape ${String(Ut(t,"shape"))}`:""}`;case"spreadsheet":{const e=Ut(t,"sheet");return`${typeof e=="string"?e:"Sheet"}!${bZ(oi(Ut(t,"column"))??1)}${oi(Ut(t,"row"))??"?"}`}case"package":{const e=Ut(t,"part"),n=Ut(t,"path"),i=typeof e=="string"?e:"Package part";if(/\/(?:media|embeddings)\//i.test(i)||/\.(?:avif|bmp|gif|jpe?g|png|tiff?|webp)$/i.test(i))return"Embedded image";const o=i.split(/[\\/]/).pop()||"Package part";return typeof n=="string"&&n.length>0?`${o} · ${n}`:o}case"text_range":{const e=oi(Ut(t,"start_line")),n=oi(Ut(t,"end_line"));return e!==void 0?`Lines ${e}${n!==void 0&&n!==e?`–${n}`:""}`:"Text range"}default:return"Document location"}}function vZ(t,e){if(!t||t.length===0)return;const n=e.candidate_id;if(n){const o=t.find(s=>s.regions.some(a=>a.candidate_id===n));if(o)return o}const i=e.owner;if(Cw(i)){if(i.kind==="slide"){const o=oi(Ut(i,"slide")),s=t.find(a=>a.kind==="slide"&&a.locator.kind==="slide"&&oi(Ut(a.locator,"slide"))===o);if(s)return s}if(i.kind==="spreadsheet"){const o=Ut(i,"sheet"),s=t.find(a=>a.kind==="sheet"&&a.locator.kind==="spreadsheet"&&Ut(a.locator,"sheet")===o);if(s)return s}}return t[0]}function lw(t){return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`}function yZ(t,e){const n=t.candidate_id,i=n?e.regions.find(l=>l.candidate_id===n):void 0,o=LC(t.width),s=LC(t.height);if(!i||!o||!s||!Array.isArray(t.polygon))return;const a=t.polygon.slice(0,256).flatMap(l=>{if(typeof l!="object"||l===null)return[];const C=oi(Ut(l,"x")),c=oi(Ut(l,"y"));if(C===void 0||c===void 0)return[];const u=i.x+BC(C/o,0,1)*i.width,h=i.y+BC(c/s,0,1)*i.height;return[`${u},${h}`]});return a.length>=3?a.join(" "):void 0}function Ut(t,e){return t[e]}function Cw(t){return typeof t=="object"&&t!==null&&typeof Ut(t,"kind")=="string"}function oi(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function bZ(t){let e=Math.max(1,Math.floor(t)),n="";for(;e>0;){const i=(e-1)%26;n=String.fromCharCode(65+i)+n,e=Math.floor((e-1)/26)}return n}function LC(t){return t!==void 0&&Number.isFinite(t)&&t>0&&t<=1e4?t:void 0}function wZ(t,e,n){if(!Array.isArray(t))return;const i=t.slice(0,256).flatMap(o=>{if(typeof o!="object"||o===null)return[];const s=oi(Ut(o,"x")),a=oi(Ut(o,"y"));return s!==void 0&&a!==void 0?[`${BC(s,0,e)},${BC(a,0,n)}`]:[]});return i.length>=3?i.join(" "):void 0}function BC(t,e,n){return Math.max(e,Math.min(n,t))}function Iw(t){return dw(t.source)}function cw(t){return dw(t.relationshipSite)}function dw(t){return t?.file.trim()&&(t.startLine!==void 0||t.endLine!==void 0||t.startByte!==void 0||t.endByte!==void 0)?t:void 0}const Mu=200;function xZ(t,e,n){const i=new Map,o=new Map,s=(l,C,c)=>{const u=n.get(C);if(!u)return;const h=l.get(C);h?h.edges.push(c):l.set(C,{node:u,edges:[c]})};for(const l of e)l.target===t&&s(i,l.source,l),l.source===t&&s(o,l.target,l);const a=l=>[...l.values()].map(C=>({...C,edges:C.edges.sort((c,u)=>c.relation.localeCompare(u.relation)||c.id.localeCompare(u.id))})).sort((C,c)=>C.node.label.localeCompare(c.node.label)||C.node.id.localeCompare(c.node.id));return{incoming:a(i),outgoing:a(o)}}function SZ(t){const e=new Map;for(const n of t){const i=n.relation||"related";e.set(i,(e.get(i)??0)+(n.weight??1))}return[...e.entries()].sort(([n],[i])=>n.localeCompare(i)).map(([n,i])=>i>1?`${n} ×${i}`:n).join(" · ")}function EZ(t,e){if(e)return t?.groupId!==void 0?t.communityId:e.community}function TZ(t){return t.groupId!==void 0||t.level!==void 0||t.couplings.length>0||t.boundaryKinds.length>0}function OZ(t){if(t.level===void 0)return"Published hierarchy";const e=t.merge==="locationAffinity"?"grouped by shared location":t.resolution===void 0?"grouped by relationship evidence":`relationship evidence at ${t.resolution}`;return`Level ${t.level} · ${e}`}function NZ(t){return`${(t*100).toFixed(t>=.1?0:1)}%`}function MZ({direction:t,groups:e,communityColors:n,onFocus:i}){const o=t==="incoming",s=e.reduce((c,u)=>c+u.edges.length,0),a=o?"Incoming":"Outgoing",l=o?"Nodes that point to this node":"Nodes this node points to",C=o?Iu:du;return d.jsxs("section",{className:"compass-direction-group","data-direction":t,children:[d.jsxs("div",{className:"compass-direction-heading",children:[d.jsx("span",{className:"compass-direction-icon","aria-hidden":"true",children:d.jsx(C,{})}),d.jsxs("span",{className:"compass-direction-copy",children:[d.jsx("strong",{children:a}),d.jsx("small",{children:l})]}),d.jsxs("span",{className:"compass-direction-count",children:[d.jsx("strong",{children:e.length}),d.jsxs("small",{children:[s," ",s===1?"edge":"edges"]})]})]}),d.jsx("div",{className:"compass-direction-list",children:e.length?e.map(c=>{const u=SZ(c.edges);return d.jsxs("button",{type:"button",className:"compass-direction-link",title:`Focus ${c.node.label}`,"aria-label":`Focus ${c.node.label}; ${a.toLocaleLowerCase()}; ${u}`,onClick:()=>i(c.node.id),children:[d.jsx("span",{className:"compass-neighbor-dot","aria-hidden":"true",style:{background:c.node.color?.background??n.get(c.node.community)??"var(--border)"}}),d.jsxs("span",{className:"compass-direction-node",children:[d.jsx("strong",{children:c.node.label}),d.jsx("small",{children:u})]}),d.jsx(MC,{"aria-hidden":"true"})]},c.node.id)}):d.jsx("span",{className:"compass-direction-empty",children:o?"No incoming relationships":"No outgoing relationships"})})]})}function RZ({selectedId:t,relationships:e,communityColors:n,onFocus:i}){const o=E.useId(),[s,a]=E.useState(),l=s?.selectedId===t?s.direction:e.outgoing.length>0?"outgoing":"incoming",C=(u,h)=>{a({selectedId:t,direction:u}),h&&document.getElementById(`${o}-${u}-tab`)?.focus()},c=u=>{u.key==="ArrowLeft"||u.key==="ArrowRight"?(u.preventDefault(),C(l==="incoming"?"outgoing":"incoming",!0)):(u.key==="Home"||u.key==="End")&&(u.preventDefault(),C(u.key==="Home"?"incoming":"outgoing",!0))};return d.jsxs("div",{className:"compass-relationship-directions",children:[d.jsx("div",{className:"compass-relationship-tabs",role:"tablist","aria-label":"Relationship direction",onKeyDown:c,children:["incoming","outgoing"].map(u=>{const m=e[u].reduce((y,S)=>y+S.edges.length,0),v=l===u,b=u==="incoming"?"Incoming":"Outgoing",x=u==="incoming"?Iu:du;return d.jsxs("button",{id:`${o}-${u}-tab`,type:"button",role:"tab","aria-label":`${b}, ${m} ${m===1?"edge":"edges"}`,"aria-selected":v,"aria-controls":`${o}-${u}-panel`,tabIndex:v?0:-1,"data-direction":u,onClick:()=>C(u,!1),children:[d.jsx(x,{"aria-hidden":"true"}),d.jsx("span",{children:b}),d.jsx("small",{children:m})]},u)})}),["incoming","outgoing"].map(u=>d.jsx("div",{id:`${o}-${u}-panel`,role:"tabpanel","aria-labelledby":`${o}-${u}-tab`,tabIndex:l===u?0:-1,hidden:l!==u,children:l===u&&d.jsx(MZ,{direction:u,groups:e[u],communityColors:n,onFocus:i})},u))]})}function kZ(t,e,n){const i=e.trim().toLocaleLowerCase(),o=i?t.filter(a=>a.label.toLocaleLowerCase().includes(i)||String(a.id).includes(i)):t;if(!n)return o.slice(0,Mu);const s=new Map(n.map((a,l)=>[a,l]));return[...o].sort((a,l)=>(s.get(a.id)??Number.MAX_SAFE_INTEGER)-(s.get(l.id)??Number.MAX_SAFE_INTEGER)).slice(0,Mu)}function DZ(t){const e=t.source?.startLine,n=t.source?.endLine;if(e!==void 0)return n!==void 0&&n!==e?`${e}–${n}`:String(e)}function uw(t){const e=t.source?.startLine,n=t.source?.endLine;if(e!==void 0)return n!==void 0&&n!==e?{text:`Lines ${e}–${n}`,action:`at lines ${e}–${n}`}:{text:`Line ${e}`,action:`at line ${e}`};const i=t.source?.startByte,o=t.source?.endByte;if(i!==void 0)return o!==void 0&&o!==i?{text:`Bytes ${i}–${o}`,action:`at bytes ${i}–${o}`}:{text:`Byte ${i}`,action:`at byte ${i}`}}function hw(t,e){const n=uw(t);return`Open source ${e.file}${n?` ${n.action}`:""}`}function fw(t){return t==="unchanged"?"Context":t?`${t[0]?.toLocaleUpperCase()}${t.slice(1)}`:void 0}function _Z(t){if(t)return{added:"var(--vscode-gitDecoration-addedResourceForeground, #2ea043)",removed:"var(--vscode-gitDecoration-deletedResourceForeground, #f85149)",changed:"var(--vscode-gitDecoration-modifiedResourceForeground, #d29922)",unchanged:"var(--vscode-descriptionForeground, #6e7781)"}[t]}function jZ({model:t,selected:e,communityFacts:n,neighbors:i,connectedEdges:o,query:s,matches:a,searchSpansCommunities:l,searchCoverage:C,searchOnly:c,communityOrder:u,hiddenCommunities:h,communityDrilldown:m,subgraphAvailable:v,comparisonMode:b,sourceRevisions:x,queryResult:y,renderedEdgeCount:S,showHeader:T,onQueryChange:O,onFocus:M,onOpenSource:k,onOpenCommunity:G,onQueryNode:L,onToggleCommunity:F,onSetAllVisible:re,collapsed:pe,onToggleCollapsed:ie}){const[J,ve]=E.useState(0),me=!!m||e!==void 0,[ue,z]=E.useState(!m);E.useEffect(()=>{z(!m)},[m]);const U=b&&!ue,Q=e?Iw(e):void 0,le=e?DZ(e):void 0,X=e?uw(e):void 0,R=v===!0&&(n?.childGroups??0)>0,D=R?e?.community:EZ(n,e),H=!R&&t.stats.aggregated&&e?.memberCount!==void 0&&e.detailAvailable!==!1,se=G!==void 0&&D!==void 0&&(R||H),de=E.useMemo(()=>{const Ce=new Map;for(const Tt of t.nodes)Ce.set(Tt.community,(Ce.get(Tt.community)??0)+(Tt.memberCount??1));return Ce},[t.nodes]),be=E.useMemo(()=>t.stats.aggregated?t.nodes.reduce((Ce,Tt)=>Ce+(Tt.memberCount??0),0):void 0,[t.nodes,t.stats.aggregated]),Me=h.size===0,ge=E.useMemo(()=>new Map(t.nodes.map(Ce=>[Ce.id,Ce])),[t.nodes]),ae=Ce=>{const Tt=Ce.source?.file??Ce.kind??"Graph node";return!l||ge.has(Ce.id)?Tt:`${Ce.communityName??t.communities.find(sn=>sn.id===Ce.community)?.label??`Community ${Ce.community}`} · ${Tt}${Ce.previewAvailable===!1?" · not in preview":""}`},xe=E.useMemo(()=>new Map(t.communities.map(Ce=>[Ce.id,Ce.color])),[t.communities]),Re=E.useMemo(()=>e?xZ(e.id,o,ge):{incoming:[],outgoing:[]},[o,ge,e?.id]),j=e?y?.nodes.find(Ce=>Ce.id===e.id):void 0,ce=e?AZ(t,e):void 0,Se=j?.evidence??e?.codeEvidence??[],_e=e?y?y.edges.filter(Ce=>Ce.source===e.id||Ce.target===e.id).flatMap(Ce=>Ce.evidence):o.flatMap(Ce=>Ce.codeEvidence??[]):[],gt=d.jsx(zZ,{model:t,communityCounts:de,hiddenCommunities:h,allVisible:Me,onSetAllVisible:re,onToggleCommunity:F,communityOrder:u,onOpenCommunity:G}),Et=Ce=>{M(Ce.id),O(""),ve(0)},ot=Ce=>{!a.length&&Ce.key!=="Escape"||(Ce.key==="ArrowDown"?(Ce.preventDefault(),ve((J+1)%a.length)):Ce.key==="ArrowUp"?(Ce.preventDefault(),ve((J-1+a.length)%a.length)):Ce.key==="Enter"&&a[J]?(Ce.preventDefault(),Et(a[J])):Ce.key==="Escape"&&(O(""),ve(0)))};return pe?d.jsxs("aside",{className:"compass-graph-inspector compass-graph-inspector-collapsed","aria-label":"Graph inspector",children:[d.jsx("button",{className:"compass-inspector-disclosure compass-inspector-expand",type:"button","aria-label":"Expand graph inspector",title:"Expand graph inspector",onClick:ie,children:d.jsx(U4,{"aria-hidden":"true"})}),d.jsx("span",{className:"compass-inspector-rail-label","aria-hidden":"true",children:"Inspector"})]}):d.jsxs("aside",{className:"compass-graph-inspector","aria-label":"Graph inspector","data-focused":me,children:[T&&d.jsxs("header",{className:"compass-inspector-header",children:[d.jsx("span",{className:"compass-product-mark","aria-hidden":"true",children:d.jsx(T4,{})}),d.jsxs("span",{className:"compass-inspector-title",children:[d.jsx("strong",{children:"Compass"}),d.jsx("small",{children:t.title})]}),d.jsx("button",{className:"compass-inspector-disclosure",type:"button","aria-label":"Collapse graph inspector",title:"Collapse graph inspector",onClick:ie,children:d.jsx(c0,{"aria-hidden":"true"})})]}),d.jsxs("div",{className:"compass-inspector-search",role:"search",children:[d.jsx("label",{className:"sr-only",htmlFor:"compass-node-search",children:"Search graph nodes"}),d.jsxs("div",{className:"compass-inspector-search-row",children:[d.jsxs("div",{className:"compass-search-field",children:[d.jsx(v0,{"aria-hidden":"true"}),d.jsx("input",{id:"compass-node-search",type:"search",role:"combobox",value:s,placeholder:"Search nodes and files",autoComplete:"off","aria-controls":"compass-search-results","aria-autocomplete":"list","aria-expanded":a.length>0,"aria-activedescendant":a[J]?`compass-search-result-${J}`:void 0,onChange:Ce=>{O(Ce.target.value),ve(0)},onKeyDown:ot})]}),!T&&d.jsx("button",{className:"compass-inspector-disclosure compass-inspector-search-disclosure",type:"button","aria-label":"Collapse graph inspector",title:"Collapse graph inspector",onClick:ie,children:d.jsx(c0,{"aria-hidden":"true"})})]}),a.length>0&&d.jsx("div",{id:"compass-search-results",className:"compass-search-results",role:"listbox","aria-label":"Matching nodes",children:a.map((Ce,Tt)=>d.jsxs("button",{id:`compass-search-result-${Tt}`,type:"button",role:"option","aria-selected":Tt===J,className:"compass-search-item",onMouseEnter:()=>ve(Tt),onClick:()=>Et(Ce),children:[d.jsx("strong",{children:Ce.label}),d.jsx("span",{children:ae(Ce)})]},Ce.id))}),C&&d.jsx("small",{className:"compass-search-coverage",role:"status",children:C.indexed===C.total?`Search all ${C.total.toLocaleString()} graph nodes and files`:`Search indexes ${C.indexed.toLocaleString()} of ${C.total.toLocaleString()} graph nodes`})]}),d.jsxs("section",{className:"compass-info-panel","aria-labelledby":"compass-info-title",children:[d.jsxs("div",{className:"compass-section-heading",children:[d.jsx("h2",{id:"compass-info-title",children:"Inspector"}),d.jsx("span",{children:e?"Pinned":"Node details"})]}),e?d.jsxs("div",{className:"compass-info-content",children:[d.jsxs("div",{className:"compass-node-identity",children:[d.jsx("span",{className:"compass-node-swatch","aria-hidden":"true",style:{background:_Z(e.change)??e.color?.background??xe.get(e.community)}}),d.jsxs("span",{children:[d.jsx("strong",{children:e.label}),d.jsx("small",{children:e.kind??"Symbol"})]}),fw(e.change)&&d.jsx("span",{className:"compass-change-badge","data-change":e.change,children:fw(e.change)})]}),c&&d.jsx("p",{className:"compass-search-only-notice",role:"status",children:"Found in the full graph. This node is outside the bounded preview, so its relationships are unavailable here. Open the source when a link is available, or export its community for complete details."}),d.jsxs("dl",{className:"compass-metadata-grid",children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Community"}),d.jsx("dd",{children:n?.label??e.communityName??t.communities.find(Ce=>Ce.id===e.community)?.label??e.community})]}),n?d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Symbols"}),d.jsx("dd",{children:n.symbols.toLocaleString()})]}),n.childGroups!==void 0&&d.jsxs("div",{children:[d.jsx("dt",{children:"Sub-groups"}),d.jsx("dd",{children:n.childGroups.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("dt",{children:"Couplings"}),d.jsx("dd",{children:n.couplingCount.toLocaleString()})]})]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Degree"}),d.jsx("dd",{children:e.degree??i.length})]}),!c&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Incoming"}),d.jsx("dd",{children:Re.incoming.length})]}),d.jsxs("div",{children:[d.jsx("dt",{children:"Outgoing"}),d.jsx("dd",{children:Re.outgoing.length})]})]})]}),e.language&&d.jsxs("div",{children:[d.jsx("dt",{children:"Language"}),d.jsx("dd",{children:e.language})]}),le&&d.jsxs("div",{children:[d.jsx("dt",{children:"Lines"}),d.jsx("dd",{children:le})]}),d.jsx("div",{className:"compass-metadata-wide compass-source-metadata","data-interactive":Q!==void 0,children:Q?d.jsxs(d.Fragment,{children:[d.jsx("dt",{className:"sr-only",children:"Source"}),d.jsx("dd",{children:d.jsxs("button",{className:"compass-source-card",type:"button","aria-label":hw(e,Q),title:hw(e,Q),onClick:()=>k(Q,e.change==="removed"?x?.before:x?.after),children:[d.jsxs("span",{className:"compass-source-copy",children:[d.jsx("span",{className:"compass-source-eyebrow","aria-hidden":"true",children:"Source"}),d.jsx("span",{className:"compass-source-path",children:Q.file}),X&&d.jsx("span",{className:"compass-source-range",children:X.text})]}),d.jsx(RC,{"aria-hidden":"true"})]})})]}):d.jsxs(d.Fragment,{children:[d.jsx("dt",{children:"Source"}),d.jsx("dd",{title:e.source?.file??"Not recorded",children:e.source?.file??"Not recorded"})]})})]}),e.signature&&d.jsx("code",{className:"compass-signature-block",children:e.signature}),se&&d.jsxs("button",{className:"compass-inspector-action",type:"button",onClick:()=>{D!==void 0&&G?.(D)},children:[d.jsx("span",{className:"compass-inspector-action-icon","aria-hidden":"true",children:d.jsx(m4,{})}),d.jsxs("span",{className:"compass-inspector-action-copy",children:[d.jsx("strong",{children:R?"Open subgraph":b?"Inspect changes":"Open community"}),d.jsx("small",{children:R?`${n?.childGroups??0} sub-groups`:`${e.memberCount?.toLocaleString()??0} ${b?"current symbols":"members"}`})]}),d.jsx(MC,{"aria-hidden":"true"})]}),n&&TZ(n)&&d.jsxs("section",{className:"compass-community-evidence","aria-labelledby":"compass-community-evidence-title",children:[d.jsxs("div",{className:"compass-inspector-subheading",children:[d.jsx("h3",{id:"compass-community-evidence-title",children:"Community evidence"}),d.jsx("span",{children:OZ(n)})]}),d.jsxs("dl",{className:"compass-metadata-grid",children:[n.communityId!==void 0&&d.jsxs("div",{children:[d.jsx("dt",{children:"Community id"}),d.jsx("dd",{children:n.communityId})]}),n.cohesion!==void 0&&d.jsxs("div",{children:[d.jsx("dt",{children:"Cohesion"}),d.jsx("dd",{children:NZ(n.cohesion)})]}),n.conductance!==void 0&&d.jsxs("div",{children:[d.jsx("dt",{children:"Conductance"}),d.jsx("dd",{children:n.conductance.toFixed(2)})]}),n.boundaryKinds.length>0&&d.jsxs("div",{className:"compass-metadata-wide",children:[d.jsx("dt",{children:"Boundary kinds"}),d.jsx("dd",{children:n.boundaryKinds.map(([Ce,Tt])=>`${Ce} ×${Tt}`).join(" · ")})]})]}),n.couplings.length>0&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"compass-inspector-subheading",children:[d.jsx("h3",{children:"Couplings"}),d.jsxs("span",{children:[n.couplingCount.toLocaleString()," ",n.couplingCount===1?"edge":"edges"]})]}),d.jsx("ul",{className:"compass-community-couplings",children:n.couplings.map(Ce=>d.jsxs("li",{children:[d.jsx("span",{children:Ce.label}),d.jsx("small",{children:Ce.edges.toLocaleString()})]},Ce.label))}),!n.couplingsComplete&&d.jsx("p",{className:"compass-empty",children:"The strongest couplings are listed; the level projection bounds the rest."})]}),n.groupId&&d.jsx("code",{className:"compass-signature-block",children:n.groupId})]}),ce&&d.jsx(lZ,{context:ce,selectedId:e.id,onFocus:M}),L&&d.jsxs("section",{className:"compass-node-actions","aria-labelledby":"compass-node-actions-title",children:[d.jsxs("div",{className:"compass-inspector-subheading",children:[d.jsx("h3",{id:"compass-node-actions-title",children:"Actions"}),d.jsx("span",{children:"3 available"})]}),d.jsxs("div",{className:"compass-code-query-actions","aria-label":"Code graph queries",children:[d.jsxs("button",{type:"button",title:"Find code that calls this node",onClick:()=>L("callers",e.id),children:[d.jsx(Iu,{"aria-hidden":"true"}),d.jsx("span",{children:"Callers"})]}),d.jsxs("button",{type:"button",title:"Find code called by this node",onClick:()=>L("callees",e.id),children:[d.jsx(du,{"aria-hidden":"true"}),d.jsx("span",{children:"Callees"})]}),d.jsxs("button",{type:"button",title:"Trace code affected by this node",onClick:()=>L("impact",e.id),children:[d.jsx(Y4,{"aria-hidden":"true"}),d.jsx("span",{children:"Impact"})]})]})]}),d.jsx(ow,{evidence:Se,diagnostics:y?.diagnostics,truncated:y?.truncated,title:"Node evidence",onOpenSource:k}),d.jsx(ow,{evidence:_e,title:"Relationship evidence",onOpenSource:k}),t.stats.aggregated&&e.memberCount!==void 0&&e.detailAvailable===!1&&!R&&D!==void 0&&d.jsx("p",{className:"compass-empty",children:"This community detail was omitted to keep the standalone HTML export bounded. Open the graph in VS Code or export this community as JSON for full inspection."}),c?null:b?d.jsx(nZ,{node:e,edges:o,nodes:ge,sourceRevisions:x,onFocus:M,onOpenSource:k}):d.jsxs("section",{className:"compass-relationships","aria-labelledby":"compass-relationships-title",children:[d.jsxs("div",{className:"compass-inspector-subheading",children:[d.jsx("h3",{id:"compass-relationships-title",children:"Relationships"}),d.jsxs("span",{children:[o.length," ",o.length===1?"edge":"edges"]})]}),d.jsx(RZ,{selectedId:e.id,relationships:Re,communityColors:xe,onFocus:M})]})]}):d.jsx("p",{className:"compass-empty",children:"Select a node to inspect its relationships."})]}),b&&!t.stats.aggregated&&d.jsx(oZ,{nodes:t.nodes,query:s,selectedId:e?.id,onFocus:M}),t.effectiveGraph&&d.jsxs("section",{className:"compass-info-panel","aria-labelledby":"compass-agent-overlay-title",children:[d.jsxs("div",{className:"compass-section-heading",children:[d.jsx("h2",{id:"compass-agent-overlay-title",children:"Agent overlay"}),d.jsx("span",{children:"Exact revision"})]}),d.jsxs("dl",{className:"compass-metadata-grid",children:[d.jsxs("div",{children:[d.jsx("dt",{children:"Pinned profile"}),d.jsx("dd",{children:t.effectiveGraph.compositionProfile})]}),d.jsxs("div",{children:[d.jsx("dt",{children:"Retractions"}),d.jsx("dd",{children:t.effectiveGraph.retractions.total.toLocaleString()})]}),d.jsxs("div",{children:[d.jsx("dt",{children:"Omissions"}),d.jsx("dd",{children:t.effectiveGraph.omissions.total.toLocaleString()})]}),d.jsxs("div",{className:"compass-metadata-wide",children:[d.jsx("dt",{children:"Overlay revision"}),d.jsx("dd",{title:t.effectiveGraph.overlayRevision,children:d.jsx("code",{children:t.effectiveGraph.overlayRevision.slice(0,12)})})]})]}),t.effectiveGraph.retractions.examples.length>0&&d.jsxs("details",{children:[d.jsxs("summary",{children:["Retraction history",d.jsx("span",{children:t.effectiveGraph.retractions.examples.length})]}),d.jsx("ul",{children:t.effectiveGraph.retractions.examples.map(Ce=>d.jsxs("li",{children:[d.jsx("strong",{children:Ce.kind})," ",d.jsx("code",{children:Ce.id})," — ",Ce.reasonCode,": ",Ce.explanation]},`${Ce.kind}:${Ce.id}`))}),t.effectiveGraph.retractions.omittedExamples>0&&d.jsxs("p",{className:"compass-empty",children:[t.effectiveGraph.retractions.omittedExamples.toLocaleString()," additional Retractions omitted by the response bound."]})]}),d.jsx("p",{className:"compass-empty",children:"Changing augment or curated profile requires a new exact Effective Graph read; this viewer never relabels one identity as another."})]}),!me&&d.jsx("section",{className:"compass-community-panel","aria-labelledby":"compass-communities-title","data-secondary":b,"data-collapsed":String(U),children:b?d.jsxs("details",{open:ue,onToggle:Ce=>z(Ce.currentTarget.open),children:[d.jsxs("summary",{id:"compass-communities-title",children:["Communities",d.jsx("span",{children:t.communities.length})]}),gt]}):d.jsxs(d.Fragment,{children:[d.jsx("h2",{id:"compass-communities-title",children:"Communities"}),gt]})}),!me&&d.jsx("footer",{className:"compass-graph-stats",children:t.stats.aggregated?d.jsxs(d.Fragment,{children:[t.stats.communities.toLocaleString()," communities ·"," ",(be??0).toLocaleString()," symbols ·"," ",t.stats.edges.toLocaleString()," cross-community relationships",SkZ(t.communities,C,a),[a,t.communities,C]),h=E.useMemo(()=>{const m=C.trim().toLocaleLowerCase();return m?t.communities.filter(v=>v.label.toLocaleLowerCase().includes(m)||String(v.id).includes(m)).length:t.communities.length},[t.communities,C]);return d.jsxs("div",{className:"compass-community-controls",children:[d.jsxs("label",{className:"compass-community-control",children:[d.jsx("input",{type:"checkbox",checked:i,onChange:m=>o(m.target.checked)}),d.jsx("span",{children:"Select all"})]}),t.communities.length>Mu&&d.jsxs("label",{className:"compass-community-search",children:[d.jsx("span",{className:"sr-only",children:"Filter communities"}),d.jsx(v0,{"aria-hidden":"true"}),d.jsx("input",{type:"search",value:C,placeholder:"Filter communities",onChange:m=>c(m.target.value)})]}),d.jsx("div",{className:"compass-community-list",children:u.map(m=>{const v=!n.has(m.id);return d.jsxs("div",{className:"compass-community-item","data-hidden":!v,children:[d.jsxs("label",{children:[d.jsx("input",{type:"checkbox",checked:v,onChange:()=>s(m.id)}),d.jsx("span",{className:"compass-community-dot","aria-hidden":"true",style:{background:m.color}}),d.jsx("span",{className:"compass-community-label",children:m.label})]}),d.jsx("small",{children:e.get(m.id)??0}),l?d.jsx("button",{className:"compass-community-open",type:"button","aria-label":`Open group ${m.label}`,title:`Open community ${m.label}`,onClick:()=>l(m.id),children:d.jsx(MC,{"aria-hidden":"true"})}):null]},m.id)})}),h>u.length&&d.jsxs("p",{className:"compass-community-limit",role:"status",children:["Showing ",u.length.toLocaleString()," of"," ",h.toLocaleString()," communities. Filter to find another community."]})]})}function pw({className:t="compass-load-logo",variant:e="glyph"}){return d.jsxs("svg",{className:t,viewBox:e==="app"?"0 0 128 128":"0 0 24 24",fill:"none","aria-hidden":"true",children:[e==="app"&&d.jsxs(d.Fragment,{children:[d.jsx("rect",{x:"6",y:"6",width:"116",height:"116",rx:"29",fill:"#5865F2"}),d.jsx("rect",{x:"7",y:"7",width:"114",height:"114",rx:"28",fill:"none",stroke:"#FFFFFF",strokeOpacity:".22",strokeWidth:"2"})]}),d.jsx("path",{transform:e==="app"?"translate(13.6 13.6) scale(4.2)":void 0,fill:e==="app"?"#FFFFFF":"currentColor",fillRule:"evenodd",clipRule:"evenodd",d:"M3.554 21.529c1.797 1.221 4.943-.038 11.236-2.554 1.342-.537 2.013-.806 2.54-1.267q.201-.177.378-.378c.461-.527.73-1.198 1.267-2.54 2.515-6.293 3.775-9.44 2.554-11.236a4.1 4.1 0 0 0-1.083-1.083c-1.797-1.221-4.944.037-11.236 2.554-1.342.537-2.013.806-2.54 1.267q-.201.177-.378.378c-.461.527-.73 1.198-1.267 2.54-2.517 6.292-3.775 9.439-2.554 11.236.29.426.657.793 1.083 1.083M8.25 12a3.75 3.75 0 1 1 7.5 0 3.75 3.75 0 0 1-7.5 0m1.5 0a2.25 2.25 0 1 1 4.5 0 2.25 2.25 0 0 1-4.5 0"})]})}const PZ=1e4;function mw(t){const[e,n]=E.useState(!1);E.useEffect(()=>{if(t.kind!=="layout"){n(!1);return}const a=window.setTimeout(()=>{n(!0)},PZ);return()=>window.clearTimeout(a)},[t.kind]);const i=t.kind==="community",o=i?`Opening ${t.communityLabel}`:e?"Still arranging this graph":"Arranging graph layout",s=i?"Fetching symbols and relationships for this community.":e?"This graph is taking longer than expected. You can open the current layout now.":"Positioning nodes and relationships for a readable first view.";return d.jsxs("section",{className:"compass-graph-transition","data-kind":t.kind,role:"status","aria-live":"polite","aria-atomic":"true",children:[d.jsxs("div",{className:"compass-load-visual","data-state":"loading","aria-hidden":"true",children:[d.jsx("span",{className:"compass-load-mark",children:d.jsx(pw,{})}),d.jsx("span",{className:"compass-load-progress",children:d.jsx("i",{})})]}),d.jsxs("div",{className:"compass-load-copy",children:[d.jsx("span",{className:"compass-load-eyebrow",children:"Compass graph"}),d.jsx("h1",{children:o}),d.jsx("p",{className:"compass-graph-transition-description",children:s}),!i&&e&&d.jsx("div",{className:"compass-load-actions",children:d.jsx("button",{className:"compass-load-action compass-load-action-primary",type:"button",onClick:t.onShowGraph,children:"Show graph now"})})]})]})}var LZ=Object.defineProperty,Ru=(t,e)=>LZ(t,"name",{value:e,configurable:!0});function ku(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Ru(ku,"setRef");function vw(...t){return e=>{let n=!1;const i=t.map(o=>{const s=ku(o,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;oBZ(t,"name",{value:e,configurable:!0});function yr(t){const e=E.forwardRef((n,i)=>{let{children:o,...s}=n,a=null,l=!1;const C=[];Du(o)&&typeof ZC=="function"&&(o=ZC(o._payload)),E.Children.forEach(o,m=>{if(Sw(m)){l=!0;const v=m;let b="child"in v.props?v.props.child:v.props.children;Du(b)&&typeof ZC=="function"&&(b=ZC(b._payload)),a=GZ(v,b),C.push(a?.props?.children)}else C.push(m)}),a?a=E.cloneElement(a,void 0,C):!l&&E.Children.count(o)===1&&E.isValidElement(o)&&(a=o);const c=a?xw(a):void 0,u=en(i,c);if(!a){if(o||o===0)throw new Error(l?UZ(t):VZ(t));return o}const h=ww(s,a.props??{});return a.type!==E.Fragment&&(h.ref=i?u:c),E.cloneElement(a,h)});return e.displayName=`${t}.Slot`,e}Yi(yr,"createSlot");var yw=yr("Slot"),bw=Symbol.for("radix.slottable");function ZZ(t){const e=Yi(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=bw,e}Yi(ZZ,"createSlottable");var GZ=Yi((t,e)=>{if("child"in t.props){const n=t.props.child;return E.isValidElement(n)?E.cloneElement(n,void 0,t.props.children(n.props.children)):null}return E.isValidElement(e)?e:null},"getSlottableElementFromSlottable");function ww(t,e){const n={...e};for(const i in e){const o=t[i],s=e[i];/^on[A-Z]/.test(i)?o&&s?n[i]=(...l)=>{const C=s(...l);return o(...l),C}:o&&(n[i]=o):i==="style"?n[i]={...o,...s}:i==="className"&&(n[i]=[o,s].filter(Boolean).join(" "))}return{...t,...n}}Yi(ww,"mergeProps");function xw(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Yi(xw,"getElementRef");function Sw(t){return E.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===bw}Yi(Sw,"isSlottable");var FZ=Symbol.for("react.lazy");function Du(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===FZ&&"_payload"in t&&Ew(t._payload)}Yi(Du,"isLazyComponent");function Ew(t){return typeof t=="object"&&t!==null&&"then"in t}Yi(Ew,"isPromiseLike");var VZ=Yi(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),UZ=Yi(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),ZC=CA[" use ".trim().toString()],HZ=Object.defineProperty,YZ=(t,e)=>HZ(t,"name",{value:e,configurable:!0}),$Z=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Yn=$Z.reduce((t,e)=>{const n=yr(`Primitive.${e}`),i=E.forwardRef((o,s)=>{const{asChild:a,...l}=o,C=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(C,{...l,ref:s})});return i.displayName=`Primitive.${e}`,{...t,[e]:i}},{});function Tw(t,e){t&&bs.flushSync(()=>t.dispatchEvent(e))}YZ(Tw,"dispatchDiscreteCustomEvent");var WZ=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),KZ=Object.defineProperty,Ni=(t,e)=>KZ(t,"name",{value:e,configurable:!0});function XZ(t,e){const n=E.createContext(e);n.displayName=t+"Context";const i=Ni(s=>{const{children:a,...l}=s,C=E.useMemo(()=>l,Object.values(l));return d.jsx(n.Provider,{value:C,children:a})},"Provider");i.displayName=t+"Provider";function o(s,a={}){const{optional:l=!1}=a,C=E.useContext(n);if(C)return C;if(e!==void 0)return e;if(!l)throw new Error(`\`${s}\` must be used within \`${t}\``)}return Ni(o,"useContext"),[i,o]}Ni(XZ,"createContext");function dA(t,e=[]){let n=[];function i(s,a){const l=E.createContext(a);l.displayName=s+"Context";const C=n.length;n=[...n,a];const c=Ni(h=>{const{scope:m,children:v,...b}=h,x=m?.[t]?.[C]||l,y=E.useMemo(()=>b,Object.values(b));return d.jsx(x.Provider,{value:y,children:v})},"Provider");c.displayName=s+"Provider";function u(h,m,v={}){const{optional:b=!1}=v,x=m?.[t]?.[C]||l,y=E.useContext(x);if(y)return y;if(a!==void 0)return a;if(!b)throw new Error(`\`${h}\` must be used within \`${s}\``)}return Ni(u,"useContext"),[c,u]}Ni(i,"createContext");const o=Ni(()=>{const s=n.map(a=>E.createContext(a));return Ni(function(l){const C=l?.[t]||s;return E.useMemo(()=>({[`__scope${t}`]:{...l,[t]:C}}),[l,C])},"useScope")},"createScope");return o.scopeName=t,[i,Ow(o,...e)]}Ni(dA,"createContextScope");function Ow(...t){const e=t[0];if(t.length===1)return e;const n=Ni(()=>{const i=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return Ni(function(s){const a=i.reduce((l,{useScope:C,scopeName:c})=>{const h=C(s)[`__scope${c}`];return{...l,...h}},{});return E.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}Ni(Ow,"composeContextScopes");var QZ=Object.defineProperty,xn=(t,e)=>QZ(t,"name",{value:e,configurable:!0});function Nw(t){const e=t+"CollectionProvider",[n,i]=dA(e),[o,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),a=xn(x=>{const{scope:y,children:S}=x,T=E.useRef(null),O=E.useRef(new Map).current;return d.jsx(o,{scope:y,itemMap:O,collectionRef:T,children:S})},"CollectionProvider");a.displayName=e;const l=t+"CollectionSlot",C=yr(l),c=E.forwardRef((x,y)=>{const{scope:S,children:T}=x,O=s(l,S),M=en(y,O.collectionRef);return d.jsx(C,{ref:M,children:T})});c.displayName=l;const u=t+"CollectionItemSlot",h="data-radix-collection-item",m=yr(u),v=E.forwardRef((x,y)=>{const{scope:S,children:T,...O}=x,M=E.useRef(null),k=en(y,M),G=s(u,S);return E.useEffect(()=>(G.itemMap.set(M,{ref:M,...O}),()=>{G.itemMap.delete(M)})),d.jsx(m,{[h]:"",ref:k,children:T})});v.displayName=u;function b(x){const y=s(t+"CollectionConsumer",x);return E.useCallback(()=>{const T=y.collectionRef.current;if(!T)return[];const O=Array.from(T.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((G,L)=>O.indexOf(G.ref.current)-O.indexOf(L.ref.current))},[y.collectionRef,y.itemMap])}return xn(b,"useCollection"),[{Provider:a,Slot:c,ItemSlot:v},b,i]}xn(Nw,"createCollection");var Mw=new WeakMap,_u=(vi=class extends Map{constructor(n){super(n);M_(this,un);Ey(this,un,[...super.keys()]),Mw.set(this,!0)}set(n,i){return Mw.get(this)&&(this.has(n)?Un(this,un)[Un(this,un).indexOf(n)]=n:Un(this,un).push(n)),super.set(n,i),this}insert(n,i,o){const s=this.has(i),a=Un(this,un).length,l=ju(n);let C=l>=0?l:a+l;const c=C<0||C>=a?-1:C;if(c===this.size||s&&c===this.size-1||c===-1)return this.set(i,o),this;const u=this.size+(s?0:1);l<0&&C++;const h=[...Un(this,un)];let m,v=!1;for(let b=C;b=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,i){const o=this.indexOf(n);if(o===-1)return;let s=o+i;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,i){let o=0;for(const s of this){if(Reflect.apply(n,i,[s,o,this]))return s;o++}}findIndex(n,i){let o=0;for(const s of this){if(Reflect.apply(n,i,[s,o,this]))return o;o++}return-1}filter(n,i){const o=[];let s=0;for(const a of this)Reflect.apply(n,i,[a,s,this])&&o.push(a),s++;return new vi(o)}map(n,i){const o=[];let s=0;for(const a of this)o.push([a[0],Reflect.apply(n,i,[a,s,this])]),s++;return new vi(o)}reduce(...n){const[i,o]=n;let s=0,a=o??this.at(0);for(const l of this)s===0&&n.length===1?a=l:a=Reflect.apply(i,this,[a,l,s,this]),s++;return a}reduceRight(...n){const[i,o]=n;let s=o??this.at(-1);for(let a=this.size-1;a>=0;a--){const l=this.at(a);a===this.size-1&&n.length===1?s=l:s=Reflect.apply(i,this,[s,l,a,this])}return s}toSorted(n){const i=[...this.entries()].sort(n);return new vi(i)}toReversed(){const n=new vi;for(let i=this.size-1;i>=0;i--){const o=this.keyAt(i),s=this.get(o);n.set(o,s)}return n}toSpliced(...n){const i=[...this.entries()];return i.splice(...n),new vi(i)}slice(n,i){const o=new vi;let s=this.size-1;if(n===void 0)return o;n<0&&(n=n+this.size),i!==void 0&&i>0&&(s=i-1);for(let a=n;a<=s;a++){const l=this.keyAt(a),C=this.get(l);o.set(l,C)}return o}every(n,i){let o=0;for(const s of this){if(!Reflect.apply(n,i,[s,o,this]))return!1;o++}return!0}some(n,i){let o=0;for(const s of this){if(Reflect.apply(n,i,[s,o,this]))return!0;o++}return!1}},un=new WeakMap,xn(vi,"OrderedDict"),vi);function GC(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);const n=Rw(t,e);return n===-1?void 0:t[n]}xn(GC,"at");function Rw(t,e){const n=t.length,i=ju(e),o=i>=0?i:n+i;return o<0||o>=n?-1:o}xn(Rw,"toSafeIndex");function ju(t){return t!==t||t===0?0:Math.trunc(t)}xn(ju,"toSafeInteger");function qZ(t){const e=t+"CollectionProvider",[n,i]=dA(e),[o,s]=n(e,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new _u,setItemMap:xn(()=>{},"setItemMap")}),a=xn(({state:O,...M})=>O?d.jsx(C,{...M,state:O}):d.jsx(l,{...M}),"CollectionProvider");a.displayName=e;const l=xn(O=>{const M=y();return d.jsx(C,{...O,state:M})},"CollectionInit");l.displayName=e+"Init";const C=xn(O=>{const{scope:M,children:k,state:G}=O,L=E.useRef(null),[F,re]=E.useState(null),pe=en(L,re),[ie,J]=G;return E.useEffect(()=>{if(!F)return;const ve=_w(()=>{});return ve.observe(F,{childList:!0,subtree:!0}),()=>{ve.disconnect()}},[F]),d.jsx(o,{scope:M,itemMap:ie,setItemMap:J,collectionRef:pe,collectionRefObject:L,collectionElement:F,children:k})},"CollectionProviderImpl");C.displayName=e+"Impl";const c=t+"CollectionSlot",u=yr(c),h=E.forwardRef((O,M)=>{const{scope:k,children:G}=O,L=s(c,k),F=en(M,L.collectionRef);return d.jsx(u,{ref:F,children:G})});h.displayName=c;const m=t+"CollectionItemSlot",v="data-radix-collection-item",b=yr(m),x=E.forwardRef((O,M)=>{const{scope:k,children:G,...L}=O,F=E.useRef(null),[re,pe]=E.useState(null),ie=en(M,F,pe),J=s(m,k),{setItemMap:ve}=J,me=E.useRef(L);kw(me.current,L)||(me.current=L);const ue=me.current;return E.useEffect(()=>{const z=ue;return ve(U=>re?U.has(re)?U.set(re,{...z,element:re}).toSorted(zu):(U.set(re,{...z,element:re}),U.toSorted(zu)):U),()=>{ve(U=>!re||!U.has(re)?U:(U.delete(re),new _u(U)))}},[re,ue,ve]),d.jsx(b,{[v]:"",ref:ie,children:G})});x.displayName=m;function y(){return E.useState(new _u)}xn(y,"useInitCollection");function S(O){const{itemMap:M}=s(t+"CollectionConsumer",O);return M}return xn(S,"useCollection"),[{Provider:a,Slot:h,ItemSlot:x},{createCollectionScope:i,useCollection:S,useInitCollection:y}]}xn(qZ,"createCollection");function kw(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;const n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||t[o]!==e[o])return!1;return!0}xn(kw,"shallowEqual");function Dw(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}xn(Dw,"isElementPreceding");function zu(t,e){return!t[1].element||!e[1].element?0:Dw(t[1].element,e[1].element)?-1:1}xn(zu,"sortByDocumentPosition");function _w(t){return new MutationObserver(n=>{for(const i of n)if(i.type==="childList"){t();return}})}xn(_w,"getChildListObserver");var JZ=Object.defineProperty,Sg=(t,e)=>JZ(t,"name",{value:e,configurable:!0}),jw=!!(typeof window<"u"&&window.document&&window.document.createElement);function tn(t,e,{checkForDefaultPrevented:n=!0}={}){return Sg(function(o){if(t?.(o),n===!1||!o||!o.defaultPrevented)return e?.(o)},"handleEvent")}Sg(tn,"composeEventHandlers");function e6(t){if(!jw)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}Sg(e6,"getOwnerWindow");function Pu(t){if(!jw)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}Sg(Pu,"getOwnerDocument");function zw(t,e=!1){const{activeElement:n}=Pu(t);if(!n?.nodeName)return null;if(Pw(n)&&n.contentDocument)return zw(n.contentDocument.body,e);if(e){const i=n.getAttribute("aria-activedescendant");if(i){const o=Pu(n).getElementById(i);if(o)return o}}return n}Sg(zw,"getActiveElement");function Pw(t){return t.tagName==="IFRAME"}Sg(Pw,"isFrame");var Sn=globalThis?.document?E.useLayoutEffect:()=>{},t6=Object.defineProperty,n6=(t,e)=>t6(t,"name",{value:e,configurable:!0}),Lw=CA[" useEffectEvent ".trim().toString()],Bw=CA[" useInsertionEffect ".trim().toString()];function Zw(t){if(typeof Lw=="function")return Lw(t);const e=E.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Bw=="function"?Bw(()=>{e.current=t}):Sn(()=>{e.current=t}),E.useMemo(()=>((...n)=>e.current?.(...n)),[])}n6(Zw,"useEffectEvent");var i6=Object.defineProperty,uA=(t,e)=>i6(t,"name",{value:e,configurable:!0}),o6=CA[" useInsertionEffect ".trim().toString()]||Sn;function Lu({prop:t,defaultProp:e,onChange:n=uA(()=>{},"onChange"),caller:i}){const[o,s,a]=Gw({defaultProp:e,onChange:n}),l=t!==void 0,C=l?t:o,c=E.useCallback(u=>{if(l){const h=Fw(u)?u(t):u;h!==t&&a.current?.(h)}else s(u)},[l,t,s,a]);return[C,c]}uA(Lu,"useControllableState");function Gw({defaultProp:t,onChange:e}){const[n,i]=E.useState(t),o=E.useRef(n),s=E.useRef(e);return o6(()=>{s.current=e},[e]),E.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,i,s]}uA(Gw,"useUncontrolledState");function Fw(t){return typeof t=="function"}uA(Fw,"isFunction");var Vw=Symbol("RADIX:SYNC_STATE");function r6(t,e,n,i){const{prop:o,defaultProp:s,onChange:a,caller:l}=e,C=o!==void 0,c=Zw(a),u=[{...n,state:s}];i&&u.push(i);const[h,m]=E.useReducer((y,S)=>{if(S.type===Vw)return{...y,state:S.state};const T=t(y,S);return C&&!Object.is(T.state,y.state)&&c(T.state),T},...u),v=h.state,b=E.useRef(v);E.useEffect(()=>{b.current!==v&&(b.current=v,C||c(v))},[v,b,C]);const x=E.useMemo(()=>o!==void 0?{...h,state:o}:h,[h,o]);return E.useEffect(()=>{C&&!Object.is(o,h.state)&&m({type:Vw,state:o})},[o,h.state,C]),[x,m]}uA(r6,"useControllableStateReducer");var s6=Object.defineProperty,zo=(t,e)=>s6(t,"name",{value:e,configurable:!0});function Uw(t,e){return E.useReducer((n,i)=>e[n][i]??n,t)}zo(Uw,"useStateMachine");var g6=zo(t=>{const{present:e,children:n}=t,i=Hw(e),o=typeof n=="function"?n({present:i.isPresent}):E.Children.only(n),s=Yw(i.ref,$w(o));return typeof n=="function"||i.isPresent?E.cloneElement(o,{ref:s}):null},"Presence");function Hw(t){const[e,n]=E.useState(),i=E.useRef(null),o=E.useRef(t),s=E.useRef("none"),a=E.useRef(void 0),l=t?"mounted":"unmounted",[C,c]=Uw(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{C==="mounted"?(s.current=a.current??Eg(i.current),a.current=void 0):s.current="none"},[C]),Sn(()=>{const u=i.current,h=o.current;if(h!==t){const v=s.current,b=Eg(u);t?(a.current=b,c("MOUNT")):b==="none"||u?.display==="none"?c("UNMOUNT"):c(h&&v!==b?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,c]),Sn(()=>{if(e){let u;const h=e.ownerDocument.defaultView??window,m=zo(b=>{const y=Eg(i.current).includes(CSS.escape(b.animationName));if(b.target===e&&y&&(c("ANIMATION_END"),!o.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",u=h.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},"handleAnimationEnd"),v=zo(b=>{b.target===e&&(s.current=Eg(i.current))},"handleAnimationStart");return e.addEventListener("animationstart",v),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{h.clearTimeout(u),e.removeEventListener("animationstart",v),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(C),ref:E.useCallback(u=>{if(u){const h=getComputedStyle(u);i.current=h,a.current=Eg(h)}else i.current=null;n(u)},[])}}zo(Hw,"usePresence");function Bu(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}zo(Bu,"setRef");function Yw(...t){const e=E.useRef(t);return e.current=t,E.useCallback(n=>{const i=e.current;let o=!1;const s=i.map(a=>{const l=Bu(a,n);return!o&&typeof l=="function"&&(o=!0),l});if(o)return()=>{for(let a=0;aa6(t,"name",{value:e,configurable:!0}),l6=CA[" useId ".trim().toString()]||(()=>{}),C6=0;function Zu(t){const[e,n]=E.useState(l6());return Sn(()=>{t||n(i=>i??String(C6++))},[t]),t||(e?`radix-${e}`:"")}A6(Zu,"useId");var I6=Object.defineProperty,c6=(t,e)=>I6(t,"name",{value:e,configurable:!0}),d6=E.createContext(void 0);function Ww(t){const e=E.useContext(d6);return t||e||"ltr"}c6(Ww,"useDirection");var u6=Object.defineProperty,h6=(t,e)=>u6(t,"name",{value:e,configurable:!0});function lo(t){const e=E.useRef(t);return E.useEffect(()=>{e.current=t}),E.useMemo(()=>((...n)=>e.current?.(...n)),[])}h6(lo,"useCallbackRef");var f6=Object.defineProperty,En=(t,e)=>f6(t,"name",{value:e,configurable:!0}),Gu="dismissableLayer.update",p6="dismissableLayer.pointerDownOutside",m6="dismissableLayer.focusOutside",Kw,Xw=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),v6=E.forwardRef(En(function(e,n){const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:l,onInteractOutside:C,onDismiss:c,...u}=e,h=E.useContext(Xw),[m,v]=E.useState(null),b=m?.ownerDocument??globalThis?.document,[,x]=E.useState({}),y=en(n,v),S=Array.from(h.layers),[T]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),O=T?S.indexOf(T):-1,M=m?S.indexOf(m):-1,k=h.layersWithOutsidePointerEventsDisabled.size>0,G=M>=O,L=E.useRef(!1),F=Qw(J=>{a?.(J),C?.(J),J.defaultPrevented||c?.()},{ownerDocument:b,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:L,dismissableSurfaces:h.dismissableSurfaces,shouldHandlePointerDownOutside:E.useCallback(J=>{if(!(J instanceof Node))return!1;const ve=[...h.branches].some(me=>me.contains(J));return G&&!ve},[h.branches,G])}),re=qw(J=>{if(o&&L.current)return;const ve=J.target;[...h.branches].some(ue=>ue.contains(ve))||(l?.(J),C?.(J),J.defaultPrevented||c?.())},b),pe=m?M===S.length-1:!1,ie=lo(J=>{J.key==="Escape"&&(s?.(J),!J.defaultPrevented&&c&&(J.preventDefault(),c()))});return E.useEffect(()=>{if(pe)return b.addEventListener("keydown",ie,{capture:!0}),()=>b.removeEventListener("keydown",ie,{capture:!0})},[b,pe,ie]),E.useEffect(()=>{if(m)return i&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Kw=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(m)),h.layers.add(m),Fu(),()=>{i&&(h.layersWithOutsidePointerEventsDisabled.delete(m),h.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=Kw))}},[m,b,i,h]),E.useEffect(()=>()=>{m&&(h.layers.delete(m),h.layersWithOutsidePointerEventsDisabled.delete(m),Fu())},[m,h]),E.useEffect(()=>{const J=En(()=>x({}),"handleUpdate");return document.addEventListener(Gu,J),()=>document.removeEventListener(Gu,J)},[]),d.jsx(Yn.div,{...u,ref:y,style:{pointerEvents:k?G?"auto":"none":void 0,...e.style},onFocusCapture:tn(e.onFocusCapture,re.onFocusCapture),onBlurCapture:tn(e.onBlurCapture,re.onBlurCapture),onPointerDownCapture:tn(e.onPointerDownCapture,F.onPointerDownCapture)})},"DismissableLayer"));function y6(){const t=E.useContext(Xw),[e,n]=E.useState(null);return E.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}En(y6,"useDismissableLayerSurface");var b6=En(()=>!0,"IS_TRUE");function Qw(t,e){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:a=b6}=e,l=lo(t),C=E.useRef(!1),c=E.useRef(!1),u=E.useRef(new Map),h=E.useRef(()=>{});return E.useEffect(()=>{function m(){c.current=!1,o.current=!1,u.current.clear()}En(m,"resetOutsideInteraction");function v(){return Array.from(u.current.values()).some(Boolean)}En(v,"isOutsideInteractionIntercepted");function b(O){if(!c.current)return;const M=O.target;M instanceof Node&&[...s].some(G=>G.contains(M))||u.current.set(O.type,!0),O.type==="click"&&window.setTimeout(()=>{c.current&&h.current()},0)}En(b,"handleInteractionCapture");function x(O){c.current&&u.current.set(O.type,!1)}En(x,"handleInteractionBubble");const y=En(O=>{if(O.target&&!C.current){let M=function(){n.removeEventListener("click",h.current);const G=v();m(),G||Vu(p6,l,k,{discrete:!0})};if(En(M,"handleAndDispatchPointerDownOutsideEvent"),!a(O.target)){n.removeEventListener("click",h.current),m(),C.current=!1;return}const k={originalEvent:O};c.current=!0,o.current=i&&O.button===0,u.current.clear(),!i||O.button!==0?M():(n.removeEventListener("click",h.current),h.current=M,n.addEventListener("click",h.current,{once:!0}))}else n.removeEventListener("click",h.current),m();C.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const O of S)n.addEventListener(O,b,!0),n.addEventListener(O,x);const T=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(T),n.removeEventListener("pointerdown",y),n.removeEventListener("click",h.current);for(const O of S)n.removeEventListener(O,b,!0),n.removeEventListener(O,x)}},[n,l,i,o,s,a]),{onPointerDownCapture:En(()=>C.current=!0,"onPointerDownCapture")}}En(Qw,"usePointerDownOutside");function qw(t,e=globalThis?.document){const n=lo(t),i=E.useRef(!1);return E.useEffect(()=>{const o=En(s=>{s.target&&!i.current&&Vu(m6,n,{originalEvent:s},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:En(()=>i.current=!0,"onFocusCapture"),onBlurCapture:En(()=>i.current=!1,"onBlurCapture")}}En(qw,"useFocusOutside");function Fu(){const t=new CustomEvent(Gu);document.dispatchEvent(t)}En(Fu,"dispatchUpdate");function Vu(t,e,n,{discrete:i}){const o=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),i?Tw(o,s):o.dispatchEvent(s)}En(Vu,"handleAndDispatchCustomEvent");var w6=Object.defineProperty,$n=(t,e)=>w6(t,"name",{value:e,configurable:!0}),Uu="focusScope.autoFocusOnMount",Hu="focusScope.autoFocusOnUnmount",Jw={bubbles:!1,cancelable:!0},x6=E.forwardRef($n(function(e,n){const{loop:i=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...l}=e,[C,c]=E.useState(null),u=lo(s),h=lo(a),m=E.useRef(null),v=en(n,c),b=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(o){let y=function(M){if(b.paused||!C)return;const k=M.target;C.contains(k)?m.current=k:Po(m.current,{select:!0})},S=function(M){if(b.paused||!C)return;const k=M.relatedTarget;k!==null&&(C.contains(k)||Po(m.current,{select:!0}))},T=function(M){if(document.activeElement===document.body)for(const G of M)G.removedNodes.length>0&&Po(C)};$n(y,"handleFocusIn"),$n(S,"handleFocusOut"),$n(T,"handleMutations"),document.addEventListener("focusin",y),document.addEventListener("focusout",S);const O=new MutationObserver(T);return C&&O.observe(C,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",S),O.disconnect()}}},[o,C,b.paused]),E.useEffect(()=>{if(C){ox.add(b);const y=document.activeElement;if(!C.contains(y)){const T=new CustomEvent(Uu,Jw);C.addEventListener(Uu,u),C.dispatchEvent(T),T.defaultPrevented||(ex(sx(Yu(C)),{select:!0}),document.activeElement===y&&Po(C))}return()=>{C.removeEventListener(Uu,u),setTimeout(()=>{const T=new CustomEvent(Hu,Jw);C.addEventListener(Hu,h),C.dispatchEvent(T),T.defaultPrevented||Po(y??document.body,{select:!0}),C.removeEventListener(Hu,h),ox.remove(b)},0)}}},[C,u,h,b]);const x=E.useCallback(y=>{if(!i&&!o||b.paused)return;const S=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,T=document.activeElement;if(S&&T){const O=y.currentTarget,[M,k]=tx(O);M&&k?!y.shiftKey&&T===k?(y.preventDefault(),i&&Po(M,{select:!0})):y.shiftKey&&T===M&&(y.preventDefault(),i&&Po(k,{select:!0})):T===O&&y.preventDefault()}},[i,o,b.paused]);return d.jsx(Yn.div,{tabIndex:-1,...l,ref:v,onKeyDown:x})},"FocusScope"));function ex(t,{select:e=!1}={}){const n=document.activeElement;for(const i of t)if(Po(i,{select:e}),document.activeElement!==n)return}$n(ex,"focusFirst");function tx(t){const e=Yu(t),n=$u(e,t),i=$u(e.reverse(),t);return[n,i]}$n(tx,"getTabbableEdges");function Yu(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:$n(i=>{const o=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||o?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}$n(Yu,"getTabbableCandidates");function $u(t,e){const n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(const i of t)if(!(n?!i.checkVisibility({checkVisibilityCSS:!0}):nx(i,{upTo:e})))return i}$n($u,"findVisible");function nx(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}$n(nx,"isHidden");function ix(t){return t instanceof HTMLInputElement&&"select"in t}$n(ix,"isSelectableInput");function Po(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&ix(t)&&e&&t.select()}}$n(Po,"focus");var ox=rx();function rx(){let t=[];return{add(e){const n=t[0];e!==n&&n?.pause(),t=Wu(t,e),t.unshift(e)},remove(e){t=Wu(t,e),t[0]?.resume()}}}$n(rx,"createFocusScopesStack");function Wu(t,e){const n=[...t],i=n.indexOf(e);return i!==-1&&n.splice(i,1),n}$n(Wu,"arrayRemove");function sx(t){return t.filter(e=>e.tagName!=="A")}$n(sx,"removeLinks");var S6=Object.defineProperty,E6=(t,e)=>S6(t,"name",{value:e,configurable:!0}),T6=E.forwardRef(E6(function(e,n){const{container:i,...o}=e,[s,a]=E.useState(!1);Sn(()=>a(!0),[]);const l=i||s&&globalThis?.document?.body;return l?bs.createPortal(d.jsx(Yn.div,{...o,ref:n}),l):null},"Portal")),O6=Object.defineProperty,Ku=(t,e)=>O6(t,"name",{value:e,configurable:!0}),FC=0,Tg=null;function N6(t){return Xu(),t.children}Ku(N6,"FocusGuards");function Xu(){E.useEffect(()=>{Tg||(Tg={start:Qu(),end:Qu()});const{start:t,end:e}=Tg;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),FC++,()=>{FC===1&&(Tg?.start.remove(),Tg?.end.remove(),Tg=null),FC=Math.max(0,FC-1)}},[])}Ku(Xu,"useFocusGuards");function Qu(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}Ku(Qu,"createFocusGuard");var Co=function(){return Co=Object.assign||function(e){for(var n,i=1,o=arguments.length;i"u")return Y6;var e=$6(t),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,i-n+e[2]-e[0])}},K6=Cx(),Og="data-scroll-locked",X6=function(t,e,n,i){var o=t.left,s=t.top,a=t.right,l=t.gap;return n===void 0&&(n="margin"),` .`.concat(R6,` { overflow: hidden `).concat(i,`; padding-right: `).concat(l,"px ").concat(i,`; @@ -109,7 +109,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. `)},Ix=function(){var t=parseInt(document.body.getAttribute(Og)||"0",10);return isFinite(t)?t:0},Q6=function(){E.useEffect(function(){return document.body.setAttribute(Og,(Ix()+1).toString()),function(){var t=Ix()-1;t<=0?document.body.removeAttribute(Og):document.body.setAttribute(Og,t.toString())}},[])},q6=function(t){var e=t.noRelative,n=t.noImportant,i=t.gapMode,o=i===void 0?"margin":i;Q6();var s=E.useMemo(function(){return W6(o)},[o]);return E.createElement(K6,{styles:X6(s,!e,o,n?"":"!important")})},th=!1;if(typeof window<"u")try{var YC=Object.defineProperty({},"passive",{get:function(){return th=!0,!0}});window.addEventListener("test",YC,YC),window.removeEventListener("test",YC,YC)}catch{th=!1}var Ng=th?{passive:!1}:!1,J6=function(t){return t.tagName==="TEXTAREA"},cx=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!J6(t)&&n[e]==="visible")},e8=function(t){return cx(t,"overflowY")},t8=function(t){return cx(t,"overflowX")},dx=function(t,e){var n=e.ownerDocument,i=e;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var o=ux(t,i);if(o){var s=hx(t,i),a=s[1],l=s[2];if(a>l)return!0}i=i.parentNode}while(i&&i!==n.body);return!1},n8=function(t){var e=t.scrollTop,n=t.scrollHeight,i=t.clientHeight;return[e,n,i]},i8=function(t){var e=t.scrollLeft,n=t.scrollWidth,i=t.clientWidth;return[e,n,i]},ux=function(t,e){return t==="v"?e8(e):t8(e)},hx=function(t,e){return t==="v"?n8(e):i8(e)},o8=function(t,e){return t==="h"&&e==="rtl"?-1:1},r8=function(t,e,n,i,o){var s=o8(t,window.getComputedStyle(e).direction),a=s*i,l=n.target,C=e.contains(l),c=!1,u=a>0,h=0,m=0;do{if(!l)break;var v=hx(t,l),b=v[0],x=v[1],y=v[2],S=x-y-s*b;(b||S)&&ux(t,l)&&(h+=S,m+=b);var T=l.parentNode;l=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!C&&l!==document.body||C&&(e.contains(l)||e===l));return(u&&Math.abs(h)<1||!u&&Math.abs(m)<1)&&(c=!0),c},$C=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},fx=function(t){return[t.deltaX,t.deltaY]},px=function(t){return t&&"current"in t?t.current:t},s8=function(t,e){return t[0]===e[0]&&t[1]===e[1]},g8=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},a8=0,Mg=[];function A8(t){var e=E.useRef([]),n=E.useRef([0,0]),i=E.useRef(),o=E.useState(a8++)[0],s=E.useState(Cx)[0],a=E.useRef(t);E.useEffect(function(){a.current=t},[t]),E.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var x=M6([t.lockRef.current],(t.shards||[]).map(px),!0).filter(Boolean);return x.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),x.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=E.useCallback(function(x,y){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!a.current.allowPinchZoom;var S=$C(x),T=n.current,O="deltaX"in x?x.deltaX:T[0]-S[0],M="deltaY"in x?x.deltaY:T[1]-S[1],k,G=x.target,L=Math.abs(O)>Math.abs(M)?"h":"v";if("touches"in x&&L==="h"&&G.type==="range")return!1;var F=window.getSelection(),re=F&&F.anchorNode,pe=re?re===G||re.contains(G):!1;if(pe)return!1;var ie=dx(L,G);if(!ie)return!0;if(ie?k=L:(k=L==="v"?"h":"v",ie=dx(L,G)),!ie)return!1;if(!i.current&&"changedTouches"in x&&(O||M)&&(i.current=k),!k)return!0;var J=i.current||k;return r8(J,y,x,J==="h"?O:M)},[]),C=E.useCallback(function(x){var y=x;if(!(!Mg.length||Mg[Mg.length-1]!==s)){var S="deltaY"in y?fx(y):$C(y),T=e.current.filter(function(k){return k.name===y.type&&(k.target===y.target||y.target===k.shadowParent)&&s8(k.delta,S)})[0];if(T&&T.should){y.cancelable&&y.preventDefault();return}if(!T){var O=(a.current.shards||[]).map(px).filter(Boolean).filter(function(k){return k.contains(y.target)}),M=O.length>0?l(y,O[0]):!a.current.noIsolation;M&&y.cancelable&&y.preventDefault()}}},[]),c=E.useCallback(function(x,y,S,T){var O={name:x,delta:y,target:S,should:T,shadowParent:l8(S)};e.current.push(O),setTimeout(function(){e.current=e.current.filter(function(M){return M!==O})},1)},[]),u=E.useCallback(function(x){n.current=$C(x),i.current=void 0},[]),h=E.useCallback(function(x){c(x.type,fx(x),x.target,l(x,t.lockRef.current))},[]),m=E.useCallback(function(x){c(x.type,$C(x),x.target,l(x,t.lockRef.current))},[]);E.useEffect(function(){return Mg.push(s),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",C,Ng),document.addEventListener("touchmove",C,Ng),document.addEventListener("touchstart",u,Ng),function(){Mg=Mg.filter(function(x){return x!==s}),document.removeEventListener("wheel",C,Ng),document.removeEventListener("touchmove",C,Ng),document.removeEventListener("touchstart",u,Ng)}},[]);var v=t.removeScrollBar,b=t.inert;return E.createElement(E.Fragment,null,b?E.createElement(s,{styles:g8(o)}):null,v?E.createElement(q6,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function l8(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const C8=B6(lx,A8);var mx=E.forwardRef(function(t,e){return E.createElement(HC,Co({},t,{ref:e,sideCar:C8}))});mx.classNames=HC.classNames;var I8=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Rg=new WeakMap,WC=new WeakMap,KC={},nh=0,vx=function(t){return t&&(t.host||vx(t.parentNode))},c8=function(t,e){return e.map(function(n){if(t.contains(n))return n;var i=vx(n);return i&&t.contains(i)?i:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},d8=function(t,e,n,i){var o=c8(e,Array.isArray(t)?t:[t]);KC[n]||(KC[n]=new WeakMap);var s=KC[n],a=[],l=new Set,C=new Set(o),c=function(h){!h||l.has(h)||(l.add(h),c(h.parentNode))};o.forEach(c);var u=function(h){!h||C.has(h)||Array.prototype.forEach.call(h.children,function(m){if(l.has(m))u(m);else try{var v=m.getAttribute(i),b=v!==null&&v!=="false",x=(Rg.get(m)||0)+1,y=(s.get(m)||0)+1;Rg.set(m,x),s.set(m,y),a.push(m),x===1&&b&&WC.set(m,!0),y===1&&m.setAttribute(n,"true"),b||m.setAttribute(i,"true")}catch(S){console.error("aria-hidden: cannot operate on ",m,S)}})};return u(e),l.clear(),nh++,function(){a.forEach(function(h){var m=Rg.get(h)-1,v=s.get(h)-1;Rg.set(h,m),s.set(h,v),m||(WC.has(h)||h.removeAttribute(i),WC.delete(h)),v||h.removeAttribute(n)}),nh--,nh||(Rg=new WeakMap,Rg=new WeakMap,WC=new WeakMap,KC={})}},u8=function(t,e,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(t)?t:[t]),o=I8(t);return o?(i.push.apply(i,Array.from(o.querySelectorAll("[aria-live], script"))),d8(i,o,n,"aria-hidden")):function(){return null}},h8=Object.defineProperty,f8=(t,e)=>h8(t,"name",{value:e,configurable:!0});function yx(t){const[e,n]=E.useState(void 0);return Sn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,l;if("borderBoxSize"in s){const C=s.borderBoxSize,c=Array.isArray(C)?C[0]:C;a=c.inlineSize,l=c.blockSize}else a=t.offsetWidth,l=t.offsetHeight;n({width:a,height:l})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else n(void 0)},[t]),e}f8(yx,"useSize");const p8=["top","right","bottom","left"],br=Math.min,Lo=Math.max,XC=Math.round,QC=Math.floor,Bo=t=>({x:t,y:t}),m8={left:"right",right:"left",bottom:"top",top:"bottom"};function bx(t,e,n){return Lo(t,br(e,n))}function Zo(t,e){return typeof t=="function"?t(e):t}function wr(t){return t.split("-")[0]}function kg(t){return t.split("-")[1]}function ih(t){return t==="x"?"y":"x"}function oh(t){return t==="y"?"height":"width"}function Io(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function rh(t){return ih(Io(t))}function v8(t,e,n){n===void 0&&(n=!1);const i=kg(t),o=rh(t),s=oh(o);let a=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=qC(a)),[a,qC(a)]}function y8(t){const e=qC(t);return[sh(t),e,sh(e)]}function sh(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const wx=["left","right"],xx=["right","left"],b8=["top","bottom"],w8=["bottom","top"];function x8(t,e,n){switch(t){case"top":case"bottom":return n?e?xx:wx:e?wx:xx;case"left":case"right":return e?b8:w8;default:return[]}}function S8(t,e,n,i){const o=kg(t);let s=x8(wr(t),n==="start",i);return o&&(s=s.map(a=>a+"-"+o),e&&(s=s.concat(s.map(sh)))),s}function qC(t){const e=wr(t);return m8[e]+t.slice(e.length)}function E8(t){var e,n,i,o;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(i=t.bottom)!=null?i:0,left:(o=t.left)!=null?o:0}}function Sx(t){return typeof t!="number"?E8(t):{top:t,right:t,bottom:t,left:t}}function JC(t){const{x:e,y:n,width:i,height:o}=t;return{width:i,height:o,top:n,left:e,right:e+i,bottom:n+o,x:e,y:n}}function Ex(t,e,n){let{reference:i,floating:o}=t;const s=Io(e),a=rh(e),l=oh(a),C=wr(e),c=s==="y",u=i.x+i.width/2-o.width/2,h=i.y+i.height/2-o.height/2,m=i[l]/2-o[l]/2;let v;switch(C){case"top":v={x:u,y:i.y-o.height};break;case"bottom":v={x:u,y:i.y+i.height};break;case"right":v={x:i.x+i.width,y:h};break;case"left":v={x:i.x-o.width,y:h};break;default:v={x:i.x,y:i.y}}const b=kg(e);return b&&(v[a]+=m*(b==="end"?1:-1)*(n&&c?-1:1)),v}async function T8(t,e){var n;e===void 0&&(e={});const{x:i,y:o,platform:s,rects:a,elements:l,strategy:C}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:m=!1,padding:v=0}=Zo(e,t),b=Sx(v),y=l[m?h==="floating"?"reference":"floating":h],S=JC(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:C})),T=h==="floating"?{x:i,y:o,width:a.floating.width,height:a.floating.height}:a.reference,O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),M=await(s.isElement==null?void 0:s.isElement(O))&&await(s.getScale==null?void 0:s.getScale(O))||{x:1,y:1},k=JC(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:T,offsetParent:O,strategy:C}):T);return{top:(S.top-k.top+b.top)/M.y,bottom:(k.bottom-S.bottom+b.bottom)/M.y,left:(S.left-k.left+b.left)/M.x,right:(k.right-S.right+b.right)/M.x}}const O8=50,N8=async(t,e,n)=>{const{placement:i="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:T8},C=await(a.isRTL==null?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:h}=Ex(c,i,C),m=i,v=0;const b={};for(let x=0;x({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:o,rects:s,platform:a,elements:l,middlewareData:C}=e,{element:c,padding:u=0}=Zo(t,e)||{};if(c==null)return{};const h=Sx(u),m={x:n,y:i},v=rh(o),b=oh(v),x=await a.getDimensions(c),y=v==="y",S=y?"top":"left",T=y?"bottom":"right",O=y?"clientHeight":"clientWidth",M=s.reference[b]+s.reference[v]-m[v]-s.floating[b],k=m[v]-s.reference[v],G=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let L=G?G[O]:0;(!L||!await(a.isElement==null?void 0:a.isElement(G)))&&(L=l.floating[O]||s.floating[b]);const F=M/2-k/2,re=L/2-x[b]/2-1,pe=br(h[S],re),ie=br(h[T],re),J=L-x[b]-ie,ve=L/2-x[b]/2+F,me=bx(pe,ve,J),ue=!C.arrow&&kg(o)!=null&&ve!==me&&s.reference[b]/2-(veme<=0)){var ie,J;const me=(((ie=s.flip)==null?void 0:ie.index)||0)+1,ue=L[me];if(ue&&(!(h==="alignment"?T!==Io(ue):!1)||pe.every(Q=>Io(Q.placement)===T?Q.overflows[0]>0:!0)))return{data:{index:me,overflows:pe},reset:{placement:ue}};let z=(J=pe.filter(U=>U.overflows[0]<=0).sort((U,Q)=>U.overflows[1]-Q.overflows[1])[0])==null?void 0:J.placement;if(!z)switch(v){case"bestFit":{var ve;const U=(ve=pe.filter(Q=>{if(G){const le=Io(Q.placement);return le===T||le==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(le=>le>0).reduce((le,X)=>le+X,0)]).sort((Q,le)=>Q[1]-le[1])[0])==null?void 0:ve[0];U&&(z=U);break}case"initialPlacement":z=l;break}if(o!==z)return{reset:{placement:z}}}return{}}}};function Tx(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ox(t){return p8.some(e=>t[e]>=0)}const k8=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:i}=e,{strategy:o="referenceHidden",...s}=Zo(t,e);switch(o){case"referenceHidden":{const a=await i.detectOverflow(e,{...s,elementContext:"reference"}),l=Tx(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Ox(l)}}}case"escaped":{const a=await i.detectOverflow(e,{...s,altBoundary:!0}),l=Tx(a,n.floating);return{data:{escapedOffsets:l,escaped:Ox(l)}}}default:return{}}}}},Nx=new Set(["left","top"]);async function D8(t,e){const{placement:n,platform:i,elements:o}=t,s=await(i.isRTL==null?void 0:i.isRTL(o.floating)),a=wr(n),l=kg(n),C=Io(n)==="y",c=Nx.has(a)?-1:1,u=s&&C?-1:1,h=Zo(e,t);let{mainAxis:m,crossAxis:v,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof b=="number"&&(v=l==="end"?b*-1:b),C?{x:v*u,y:m*c}:{x:m*c,y:v*u}}const _8=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:o,y:s,placement:a,middlewareData:l}=e,C=await D8(e,t);return a===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:o+C.x,y:s+C.y,data:{...C,placement:a}}}}},j8=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:o,platform:s}=e,{mainAxis:a=!0,crossAxis:l=!1,limiter:C={fn:T=>{let{x:O,y:M}=T;return{x:O,y:M}}},...c}=Zo(t,e),u={x:n,y:i},h=await s.detectOverflow(e,c),m=Io(o),v=ih(m);let b=u[v],x=u[m];const y=(T,O)=>bx(O+h[T==="y"?"top":"left"],O,O-h[T==="y"?"bottom":"right"]);a&&(b=y(v,b)),l&&(x=y(m,x));const S=C.fn({...e,[v]:b,[m]:x});return{...S,data:{x:S.x-n,y:S.y-i,enabled:{[v]:a,[m]:l}}}}}},z8=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,i;const{x:o,y:s,placement:a,rects:l,middlewareData:C}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=Zo(t,e),m={x:o,y:s},v=Io(a),b=ih(v);let x=m[b],y=m[v];const S=Zo(c,e),T=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:(n=S.mainAxis)!=null?n:0,crossAxis:(i=S.crossAxis)!=null?i:0};if(u){const k=b==="y"?"height":"width",G=l.reference[b]-l.floating[k]+T.mainAxis,L=l.reference[b]+l.reference[k]-T.mainAxis;xL&&(x=L)}if(h){var O,M;const k=b==="y"?"width":"height",G=Nx.has(wr(a)),L=l.reference[v]-l.floating[k]+(G&&((O=C.offset)==null?void 0:O[v])||0)+(G?0:T.crossAxis),F=l.reference[v]+l.reference[k]+(G?0:((M=C.offset)==null?void 0:M[v])||0)-(G?T.crossAxis:0);yF&&(y=F)}return{[b]:x,[v]:y}}}},P8=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:i,platform:o,elements:s}=e,{apply:a=()=>{},...l}=Zo(t,e),C=await o.detectOverflow(e,l),c=wr(n),u=kg(n),h=Io(n)==="y",{width:m,height:v}=i.floating;let b,x;c==="top"||c==="bottom"?(b=c,x=u===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(x=c,b=u==="end"?"top":"bottom");const y=v-C.top-C.bottom,S=m-C.left-C.right,T=br(v-C[b],y),O=br(m-C[x],S),M=e.middlewareData.shift,k=!M;let G=T,L=O;M!=null&&M.enabled.x&&(L=S),M!=null&&M.enabled.y&&(G=y),k&&!u&&(h?L=m-2*Lo(C.left,C.right):G=v-2*Lo(C.top,C.bottom)),await a({...e,availableWidth:L,availableHeight:G});const F=await o.getDimensions(s.floating);return m!==F.width||v!==F.height?{reset:{rects:!0}}:{}}}};function eI(){return typeof window<"u"}function Dg(t){return Mx(t)?(t.nodeName||"").toLowerCase():"#document"}function ri(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Go(t){var e;return(e=(Mx(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Mx(t){return eI()?t instanceof Node||t instanceof ri(t).Node:!1}function co(t){return eI()?t instanceof Element||t instanceof ri(t).Element:!1}function xr(t){return eI()?t instanceof HTMLElement||t instanceof ri(t).HTMLElement:!1}function Rx(t){return!eI()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ri(t).ShadowRoot}function tI(t){const{overflow:e,overflowX:n,overflowY:i,display:o}=uo(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&o!=="inline"&&o!=="contents"}function L8(t){return/^(table|td|th)$/.test(Dg(t))}function nI(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const B8=/transform|translate|scale|rotate|perspective|filter/,Z8=/paint|layout|strict|content/,ws=t=>!!t&&t!=="none";let gh;function ah(t){const e=co(t)?uo(t):t;return ws(e.transform)||ws(e.translate)||ws(e.scale)||ws(e.rotate)||ws(e.perspective)||!Ah()&&(ws(e.backdropFilter)||ws(e.filter))||B8.test(e.willChange||"")||Z8.test(e.contain||"")}function G8(t){let e=xs(t);for(;xr(e)&&!hA(e);){if(ah(e))return e;if(nI(e))return null;e=xs(e)}return null}function Ah(){return gh==null&&(gh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gh}function hA(t){return/^(html|body|#document)$/.test(Dg(t))}function uo(t){return ri(t).getComputedStyle(t)}function iI(t){return co(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function xs(t){if(Dg(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Rx(t)&&t.host||Go(t);return Rx(e)?e.host:e}function kx(t){const e=xs(t);return hA(e)?(t.ownerDocument||t).body:xr(e)&&tI(e)?e:kx(e)}function fA(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=kx(t),s=o===((i=t.ownerDocument)==null?void 0:i.body),a=ri(o);if(s){const l=lh(a);return e.concat(a,a.visualViewport||[],tI(o)?o:[],l&&n?fA(l):[])}else return e.concat(o,fA(o,[],n))}function lh(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Dx(t){const e=uo(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const o=xr(t),s=o?t.offsetWidth:n,a=o?t.offsetHeight:i,l=XC(n)!==s||XC(i)!==a;return l&&(n=s,i=a),{width:n,height:i,$:l}}function Ch(t){return co(t)?t:t.contextElement}function _g(t){const e=Ch(t);if(!xr(e))return Bo(1);const n=e.getBoundingClientRect(),{width:i,height:o,$:s}=Dx(e);let a=(s?XC(n.width):n.width)/i,l=(s?XC(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const F8=Bo(0);function _x(t){const e=ri(t);return!Ah()||!e.visualViewport?F8:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function V8(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===ri(t)}function Ss(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=Ch(t);let a=Bo(1);e&&(i?co(i)&&(a=_g(i)):a=_g(t));const l=V8(s,n,i)?_x(s):Bo(0);let C=(o.left+l.x)/a.x,c=(o.top+l.y)/a.y,u=o.width/a.x,h=o.height/a.y;if(s&&i){const m=ri(s),v=co(i)?ri(i):i;let b=m,x=lh(b);for(;x&&v!==b;){const y=_g(x),S=x.getBoundingClientRect(),T=uo(x),O=S.left+(x.clientLeft+parseFloat(T.paddingLeft))*y.x,M=S.top+(x.clientTop+parseFloat(T.paddingTop))*y.y;C*=y.x,c*=y.y,u*=y.x,h*=y.y,C+=O,c+=M,b=ri(x),x=lh(b)}}return JC({width:u,height:h,x:C,y:c})}function oI(t,e){const n=iI(t).scrollLeft;return e?e.left+n:Ss(Go(t)).left+n}function jx(t,e){const n=t.getBoundingClientRect(),i=n.left+e.scrollLeft-oI(t,n),o=n.top+e.scrollTop;return{x:i,y:o}}function U8(t){let{elements:e,rect:n,offsetParent:i,strategy:o}=t;const s=o==="fixed",a=Go(i),l=e?nI(e.floating):!1;if(i===a||l&&s)return n;let C={scrollLeft:0,scrollTop:0},c=Bo(1);const u=Bo(0),h=xr(i);if((h||!s)&&((Dg(i)!=="body"||tI(a))&&(C=iI(i)),h)){const v=Ss(i);c=_g(i),u.x=v.x+i.clientLeft,u.y=v.y+i.clientTop}const m=a&&!h&&!s?jx(a,C):Bo(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-C.scrollLeft*c.x+u.x+m.x,y:n.y*c.y-C.scrollTop*c.y+u.y+m.y}}function H8(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function Y8(t){const e=iI(t),n=t.ownerDocument.body,i=Lo(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Lo(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-e.scrollLeft+oI(t);const a=-e.scrollTop;return uo(n).direction==="rtl"&&(s+=Lo(t.clientWidth,n.clientWidth)-i),{width:i,height:o,x:s,y:a}}const $8=25;function W8(t,e,n){n===void 0&&(n="viewport");const i=n==="layoutViewport",o=ri(t),s=Go(t),a=o.visualViewport;let l=s.clientWidth,C=s.clientHeight,c=0,u=0;if(a){const m=!Ah()||e==="fixed";i?m||(c=-a.offsetLeft,u=-a.offsetTop):(l=a.width,C=a.height,m&&(c=a.offsetLeft,u=a.offsetTop))}if(oI(s)<=0){const m=s.ownerDocument,v=m.body,b=getComputedStyle(v),x=m.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,y=Math.abs(s.clientWidth-v.clientWidth-x),S=getComputedStyle(s).scrollbarGutter==="stable both-edges"?y/2:y;S<=$8&&(l-=S)}return{width:l,height:C,x:c,y:u}}function K8(t,e){const n=Ss(t,!0,e==="fixed"),i=n.top+t.clientTop,o=n.left+t.clientLeft,s=_g(t),a=t.clientWidth*s.x,l=t.clientHeight*s.y,C=o*s.x,c=i*s.y;return{width:a,height:l,x:C,y:c}}function zx(t,e,n){let i;if(e==="viewport"||e==="layoutViewport")i=W8(t,n,e);else if(e==="document")i=Y8(Go(t));else if(co(e))i=K8(e,n);else{const o=_x(t);i={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return JC(i)}function X8(t,e){const n=e.get(t);if(n)return n;let i=fA(t,[],!1).filter(l=>co(l)&&Dg(l)!=="body"),o=null;const s=uo(t).position==="fixed";let a=s?xs(t):t;for(;co(a)&&!hA(a);){const l=uo(a),C=ah(a),c=o?o.position:s?"fixed":"";!C&&(c==="fixed"||c==="absolute"&&l.position==="static")?i=i.filter(h=>h!==a):o=l,a=xs(a)}return e.set(t,i),i}function Q8(t){let{element:e,boundary:n,rootBoundary:i,strategy:o}=t;const a=[...n==="clippingAncestors"?nI(e)?[]:X8(e,this._c):[].concat(n),i],l=zx(e,a[0],o);let C=l.top,c=l.right,u=l.bottom,h=l.left;for(let m=1;m{l(!1,1e-7)},1e3)}L=!1}try{i=new IntersectionObserver(F,{...G,root:s.ownerDocument})}catch{i=new IntersectionObserver(F,G)}i.observe(t)}const C=ri(t),c=()=>l(n);return C.addEventListener("resize",c),l(!0),()=>{C.removeEventListener("resize",c),a()}}function oG(t,e,n,i){i===void 0&&(i={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:C=!1}=i,c=Ch(t),u=o||s?[...c?fA(c):[],...e?fA(e):[]]:[];u.forEach(S=>{o&&S.addEventListener("scroll",n),s&&S.addEventListener("resize",n)});const h=c&&l?iG(c,n,s):null;let m=-1,v=null;a&&(v=new ResizeObserver(S=>{let[T]=S;T&&T.target===c&&v&&e&&(v.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var O;(O=v)==null||O.observe(e)})),n()}),c&&!C&&v.observe(c),e&&v.observe(e));let b,x=C?Ss(t):null;C&&y();function y(){const S=Ss(t);x&&!Bx(x,S)&&n(),x=S,b=requestAnimationFrame(y)}return n(),()=>{var S;u.forEach(T=>{o&&T.removeEventListener("scroll",n),s&&T.removeEventListener("resize",n)}),h?.(),(S=v)==null||S.disconnect(),v=null,C&&cancelAnimationFrame(b)}}const rG=_8,sG=j8,gG=R8,aG=P8,AG=k8,Zx=M8,lG=z8,CG=(t,e,n)=>{const i=new Map,o=n??{},s={...nG,...o.platform,_c:i};return N8(t,e,{...o,platform:s})};var IG=typeof document<"u",cG=function(){},rI=IG?E.useLayoutEffect:cG;function sI(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,i,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!sI(t[i],e[i]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(e,o[i]))return!1;for(i=n;i--!==0;){const s=o[i];if(!(s==="_owner"&&t.$$typeof)&&!sI(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Gx(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Fx(t,e){const n=Gx(t);return Math.round(e*n)/n}function ch(t){const e=E.useRef(t);return rI(()=>{e.current=t}),e}function dG(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:o,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:C,open:c}=t,[u,h]=E.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,v]=E.useState(i);sI(m,i)||v(i);const[b,x]=E.useState(null),[y,S]=E.useState(null),T=E.useCallback(Q=>{Q!==G.current&&(G.current=Q,x(Q))},[]),O=E.useCallback(Q=>{Q!==L.current&&(L.current=Q,S(Q))},[]),M=s||b,k=a||y,G=E.useRef(null),L=E.useRef(null),F=E.useRef(u),re=C!=null,pe=ch(C),ie=ch(o),J=ch(c),ve=E.useCallback(()=>{if(!G.current||!L.current)return;const Q={placement:e,strategy:n,middleware:m};ie.current&&(Q.platform=ie.current),CG(G.current,L.current,Q).then(le=>{const X={...le,isPositioned:J.current!==!1};me.current&&!sI(F.current,X)&&(F.current=X,bs.flushSync(()=>{h(X)}))})},[m,e,n,ie,J]);rI(()=>{c===!1&&F.current.isPositioned&&(F.current.isPositioned=!1,h(Q=>({...Q,isPositioned:!1})))},[c]);const me=E.useRef(!1);rI(()=>(me.current=!0,()=>{me.current=!1}),[]),rI(()=>{if(M&&(G.current=M),k&&(L.current=k),M&&k){if(pe.current)return pe.current(M,k,ve);ve()}},[M,k,ve,pe,re]);const ue=E.useMemo(()=>({reference:G,floating:L,setReference:T,setFloating:O}),[T,O]),z=E.useMemo(()=>({reference:M,floating:k}),[M,k]),U=E.useMemo(()=>{const Q={position:n,left:0,top:0};if(!z.floating)return Q;const le=Fx(z.floating,u.x),X=Fx(z.floating,u.y);return l?{...Q,transform:"translate("+le+"px, "+X+"px)",...Gx(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:le,top:X}},[n,l,z.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:ve,refs:ue,elements:z,floatingStyles:U}),[u,ve,ue,z,U])}const uG=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:i,padding:o}=typeof t=="function"?t(n):t;return i&&e(i)?i.current!=null?Zx({element:i.current,padding:o}).fn(n):{}:i?Zx({element:i,padding:o}).fn(n):{}}}},hG=(t,e)=>{const n=rG(t);return{name:n.name,fn:n.fn,options:[t,e]}},fG=(t,e)=>{const n=sG(t);return{name:n.name,fn:n.fn,options:[t,e]}},pG=(t,e)=>({fn:lG(t).fn,options:[t,e]}),mG=(t,e)=>{const n=gG(t);return{name:n.name,fn:n.fn,options:[t,e]}},vG=(t,e)=>{const n=aG(t);return{name:n.name,fn:n.fn,options:[t,e]}},yG=(t,e)=>{const n=AG(t);return{name:n.name,fn:n.fn,options:[t,e]}},bG=(t,e)=>{const n=uG(t);return{name:n.name,fn:n.fn,options:[t,e]}};var wG=Object.defineProperty,Sr=(t,e)=>wG(t,"name",{value:e,configurable:!0}),Vx="Popper",[Ux,Hx]=dA(Vx),[xG,Yx]=Ux(Vx),SG=Sr(t=>{const{__scopePopper:e,children:n}=t,[i,o]=E.useState(null),[s,a]=E.useState(void 0);return d.jsx(xG,{scope:e,anchor:i,onAnchorChange:o,placementState:s,setPlacementState:a,children:n})},"Popper"),EG="PopperAnchor",TG=E.forwardRef(Sr(function(e,n){const{__scopePopper:i,virtualRef:o,...s}=e,a=Yx(EG,i),l=E.useRef(null),C=a.onAnchorChange,c=E.useCallback(x=>{l.current=x,x&&C(x)},[C]),u=en(n,c),h=E.useRef(null);E.useEffect(()=>{if(!o)return;const x=h.current;h.current=o.current,x!==h.current&&C(h.current)});const m=a.placementState&&gI(a.placementState),v=m?.[0],b=m?.[1];return o?null:d.jsx(Yn.div,{"data-radix-popper-side":v,"data-radix-popper-align":b,...s,ref:u})},"PopperAnchor")),$x="PopperContent",[OG,Fhe]=Ux($x),NG=E.forwardRef(Sr(function(e,n){const{__scopePopper:i,side:o="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:C=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:h=0,sticky:m="partial",hideWhenDetached:v=!1,updatePositionStrategy:b="optimized",onPlaced:x,...y}=e,S=Yx($x,i),[T,O]=E.useState(null),M=en(n,O),[k,G]=E.useState(null),L=yx(k),F=L?.width??0,re=L?.height??0,pe=o+(a!=="center"?"-"+a:""),ie=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},J=Array.isArray(u)?u:[u],ve=J.length>0,me={padding:ie,boundary:J.filter(Wx),altBoundary:ve},{refs:ue,floatingStyles:z,placement:U,isPositioned:Q,middlewareData:le}=dG({strategy:"fixed",placement:pe,whileElementsMounted:Sr((...ae)=>oG(...ae,{animationFrame:b==="always"}),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[hG({mainAxis:s+re,alignmentAxis:l}),c&&fG({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?pG():void 0,...me}),c&&mG({...me}),vG({...me,apply:Sr(({elements:ae,rects:xe,availableWidth:Me,availableHeight:_})=>{const{width:ce,height:Se}=xe.reference,_e=ae.floating.style;_e.setProperty("--radix-popper-available-width",`${Me}px`),_e.setProperty("--radix-popper-available-height",`${_}px`),_e.setProperty("--radix-popper-anchor-width",`${ce}px`),_e.setProperty("--radix-popper-anchor-height",`${Se}px`)},"apply")}),k&&bG({element:k,padding:C}),MG({arrowWidth:F,arrowHeight:re}),v&&yG({strategy:"referenceHidden",...me,boundary:ve?me.boundary:void 0})]}),X=S.setPlacementState;Sn(()=>(X(U),()=>{X(void 0)}),[U,X]);const[R,D]=gI(U),H=lo(x);Sn(()=>{Q&&H?.()},[Q,H]);const se=le.arrow?.x,de=le.arrow?.y,be=le.arrow?.centerOffset!==0,[Ne,ge]=E.useState();return Sn(()=>{T&&ge(window.getComputedStyle(T).zIndex)},[T]),d.jsx("div",{ref:ue.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ne,"--radix-popper-transform-origin":[le.transformOrigin?.x,le.transformOrigin?.y].join(" "),...le.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(OG,{scope:i,placedSide:R,placedAlign:D,onArrowChange:G,arrowX:se,arrowY:de,shouldHideArrow:be,children:d.jsx(Yn.div,{"data-side":R,"data-align":D,...y,ref:M,style:{...y.style,animation:Q?y.style?.animation:"none"}})})})},"PopperContent"));function Wx(t){return t!==null}Sr(Wx,"isNotNull");var MG=Sr(t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:i,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,l=a?0:t.arrowWidth,C=a?0:t.arrowHeight,[c,u]=gI(n),h={start:"0%",center:"50%",end:"100%"}[u],m=(o.arrow?.x??0)+l/2,v=(o.arrow?.y??0)+C/2;let b="",x="";return c==="bottom"?(b=a?h:`${m}px`,x=`${-C}px`):c==="top"?(b=a?h:`${m}px`,x=`${i.floating.height+C}px`):c==="right"?(b=`${-C}px`,x=a?h:`${v}px`):c==="left"&&(b=`${i.floating.width+C}px`,x=a?h:`${v}px`),{data:{x:b,y:x}}}}),"transformOrigin");function gI(t){const[e,n="center"]=t.split("-");return[e,n]}Sr(gI,"getSideAndAlignFromPlacement");var RG=SG,kG=TG,DG=NG,_G=Object.defineProperty,jG=(t,e)=>_G(t,"name",{value:e,configurable:!0});function Kx(t){const e=E.useRef({value:t,previous:t});return E.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}jG(Kx,"usePrevious");var zG=Object.defineProperty,PG=(t,e)=>zG(t,"name",{value:e,configurable:!0});function dh(t,[e,n]){return Math.min(n,Math.max(e,t))}PG(dh,"clamp");var LG=Object.defineProperty,Ct=(t,e)=>LG(t,"name",{value:e,configurable:!0}),BG=[" ","Enter","ArrowUp","ArrowDown"],ZG=[" ","Enter"],jg="Select",[aI,AI,GG]=Nw(jg),[Es,Vhe]=dA(jg,[GG,Hx]),uh=Hx(),[FG,Er]=Es(jg),[VG,UG]=Es(jg);function Xx(t){const{__scopeSelect:e,children:n,open:i,defaultOpen:o,onOpenChange:s,value:a,defaultValue:l,onValueChange:C,dir:c,name:u,autoComplete:h,disabled:m,required:v,form:b,internal_do_not_use_render:x}=t,y=uh(e),[S,T]=E.useState(null),[O,M]=E.useState(null),[k,G]=E.useState(!1),L=Ww(c),[F,re]=Lu({prop:i,defaultProp:o??!1,onChange:s,caller:jg}),[pe,ie]=Lu({prop:a,defaultProp:l,onChange:C,caller:jg}),J=E.useRef(null),ve=E.useRef(pe);E.useEffect(()=>{const D=b?S?.ownerDocument.getElementById(b):S?.form;if(D instanceof HTMLFormElement){const H=Ct(()=>ie(ve.current),"reset");return D.addEventListener("reset",H),()=>D.removeEventListener("reset",H)}},[b,S,ie]);const me=S?!!b||!!S.closest("form"):!0,[ue,z]=E.useState(new Set),U=Zu(),Q=Array.from(ue).map(D=>D.props.value).join(";"),le=E.useCallback(D=>{z(H=>new Set(H).add(D))},[]),X=E.useCallback(D=>{z(H=>{const se=new Set(H);return se.delete(D),se})},[]),R={required:v,trigger:S,onTriggerChange:T,valueNode:O,onValueNodeChange:M,valueNodeHasChildren:k,onValueNodeHasChildrenChange:G,contentId:U,value:pe,onValueChange:ie,open:F,onOpenChange:re,dir:L,triggerPointerDownPosRef:J,disabled:m,name:u,autoComplete:h,form:b,nativeOptions:ue,nativeSelectKey:Q,isFormControl:me};return d.jsx(RG,{...y,children:d.jsx(FG,{scope:e,...R,children:d.jsx(aI.Provider,{scope:e,children:d.jsx(VG,{scope:e,onNativeOptionAdd:le,onNativeOptionRemove:X,children:o1(x)?x(R):n})})})})}Ct(Xx,"SelectProvider");var HG=Ct(t=>{const{__scopeSelect:e,children:n,...i}=t;return d.jsx(Xx,{__scopeSelect:e,...i,internal_do_not_use_render:({isFormControl:o})=>d.jsxs(d.Fragment,{children:[n,o?d.jsx(fF,{__scopeSelect:e}):null]})})},"Select"),YG="SelectTrigger",$G=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,disabled:o=!1,...s}=e,a=uh(i),l=Er(YG,i),C=l.disabled||o,c=en(n,l.onTriggerChange),u=AI(i),h=E.useRef("touch"),[m,v,b]=ph(y=>{const S=u().filter(M=>!M.disabled),T=S.find(M=>M.value===l.value),O=mh(S,y,T);O!==void 0&&l.onValueChange(O.value)}),x=Ct(y=>{C||(l.onOpenChange(!0),b()),y&&(l.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})},"handleOpen");return d.jsx(kG,{asChild:!0,...a,children:d.jsx(Yn.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:C,"data-disabled":C?"":void 0,"data-placeholder":pA(l.value)?"":void 0,...s,ref:c,onClick:tn(s.onClick,y=>{y.currentTarget.focus(),h.current!=="mouse"&&x(y)}),onPointerDown:tn(s.onPointerDown,y=>{h.current=y.pointerType;const S=y.target;S.hasPointerCapture(y.pointerId)&&S.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(x(y),y.preventDefault())}),onKeyDown:tn(s.onKeyDown,y=>{const S=m.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&v(y.key),!(S&&y.key===" ")&&BG.includes(y.key)&&(x(),y.preventDefault())})})})},"SelectTrigger")),WG="SelectValue",KG=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,className:o,style:s,children:a,placeholder:l="",...C}=e,c=Er(WG,i),{onValueNodeHasChildrenChange:u}=c,h=a!==void 0,m=en(n,c.onValueNodeChange);Sn(()=>{u(h)},[u,h]);const v=pA(c.value);return d.jsx(Yn.span,{...C,asChild:v?!1:C.asChild,ref:m,style:{pointerEvents:"none"},children:d.jsx(E.Fragment,{children:v?l:a},v?"placeholder":"value")})},"SelectValue")),XG=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,children:o,...s}=e;return d.jsx(Yn.span,{"aria-hidden":!0,...s,ref:n,children:o||"▼"})},"SelectIcon")),QG="SelectPortal",[qG,JG]=Es(QG,{forceMount:void 0}),eF=Ct(t=>{const{__scopeSelect:e,forceMount:n,...i}=t;return d.jsx(qG,{scope:t.__scopeSelect,forceMount:n,children:d.jsx(T6,{asChild:!0,...i})})},"SelectPortal"),Ts="SelectContent",tF=E.forwardRef(Ct(function(e,n){const i=JG(Ts,e.__scopeSelect),{forceMount:o=i.forceMount,...s}=e,a=Er(Ts,e.__scopeSelect),[l,C]=E.useState();return Sn(()=>{C(new DocumentFragment)},[]),d.jsx(g6,{present:o||a.open,children:({present:c})=>c?d.jsx(oF,{...s,ref:n}):d.jsx(nF,{...s,fragment:l})})},"SelectContent")),nF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,children:o,fragment:s}=e;return s?bs.createPortal(d.jsx(Qx,{scope:i,children:d.jsx(aI.Slot,{scope:i,children:d.jsx("div",{ref:n,children:o})})}),s):null},"SelectContentFragment")),$i=10,[Qx,Os]=Es(Ts),iF=yr("SelectContent.RemoveScroll"),oF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i}=e,{position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:l,side:C,sideOffset:c,align:u,alignOffset:h,arrowPadding:m,collisionBoundary:v,collisionPadding:b,sticky:x,hideWhenDetached:y,avoidCollisions:S,...T}=e,O=Er(Ts,i),[M,k]=E.useState(null),[G,L]=E.useState(null),F=en(n,k),[re,pe]=E.useState(null),[ie,J]=E.useState(null),ve=AI(i),[me,ue]=E.useState(!1),z=E.useRef(!1);E.useEffect(()=>{if(M)return u8(M)},[M]),Xu();const U=E.useCallback(ge=>{const[ae,...xe]=ve().map(ce=>ce.ref.current),[Me]=xe.slice(-1),_=document.activeElement;for(const ce of ge)if(ce===_||(ce?.scrollIntoView({block:"nearest"}),ce===ae&&G&&(G.scrollTop=0),ce===Me&&G&&(G.scrollTop=G.scrollHeight),ce?.focus(),document.activeElement!==_))return},[ve,G]),Q=E.useCallback(()=>U([re,M]),[U,re,M]);E.useEffect(()=>{me&&Q()},[me,Q]);const{onOpenChange:le,triggerPointerDownPosRef:X}=O;E.useEffect(()=>{if(M){let ge={x:0,y:0};const ae=Ct(Me=>{ge={x:Math.abs(Math.round(Me.pageX)-(X.current?.x??0)),y:Math.abs(Math.round(Me.pageY)-(X.current?.y??0))}},"handlePointerMove"),xe=Ct(Me=>{ge.x<=10&&ge.y<=10?Me.preventDefault():Me.composedPath().includes(M)||le(!1),document.removeEventListener("pointermove",ae),X.current=null},"handlePointerUp");return X.current!==null&&(document.addEventListener("pointermove",ae),document.addEventListener("pointerup",xe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",xe,{capture:!0})}}},[M,le,X]),E.useEffect(()=>{const ge=Ct(()=>le(!1),"close");return window.addEventListener("blur",ge),window.addEventListener("resize",ge),()=>{window.removeEventListener("blur",ge),window.removeEventListener("resize",ge)}},[le]);const[R,D]=ph(ge=>{const ae=ve().filter(_=>!_.disabled),xe=ae.find(_=>_.ref.current===document.activeElement),Me=mh(ae,ge,xe);Me&&setTimeout(()=>Me.ref.current?.focus())}),H=E.useCallback((ge,ae,xe)=>{const Me=!z.current&&!xe;(O.value!==void 0&&O.value===ae||Me)&&(pe(ge),Me&&(z.current=!0))},[O.value]),se=E.useCallback(()=>M?.focus(),[M]),de=E.useCallback((ge,ae,xe)=>{const Me=!z.current&&!xe;(O.value!==void 0&&O.value===ae||Me)&&J(ge)},[O.value]),be=o==="popper"?qx:rF,Ne=be===qx?{side:C,sideOffset:c,align:u,alignOffset:h,arrowPadding:m,collisionBoundary:v,collisionPadding:b,sticky:x,hideWhenDetached:y,avoidCollisions:S}:{};return d.jsx(Qx,{scope:i,content:M,viewport:G,onViewportChange:L,itemRefCallback:H,selectedItem:re,onItemLeave:se,itemTextRefCallback:de,focusSelectedItem:Q,selectedItemText:ie,position:o,isPositioned:me,searchRef:R,children:d.jsx(mx,{as:iF,allowPinchZoom:!0,children:d.jsx(x6,{asChild:!0,trapped:O.open,onMountAutoFocus:ge=>{ge.preventDefault()},onUnmountAutoFocus:tn(s,ge=>{O.trigger?.focus({preventScroll:!0}),ge.preventDefault()}),children:d.jsx(v6,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:ge=>ge.preventDefault(),onDismiss:()=>O.onOpenChange(!1),children:d.jsx(be,{role:"listbox",id:O.contentId,"data-state":O.open?"open":"closed",dir:O.dir,onContextMenu:ge=>ge.preventDefault(),...T,...Ne,onPlaced:()=>ue(!0),ref:F,style:{display:"flex",flexDirection:"column",outline:"none",...T.style},onKeyDown:tn(T.onKeyDown,ge=>{const ae=ge.ctrlKey||ge.altKey||ge.metaKey;if(ge.key==="Tab"&&ge.preventDefault(),!ae&&ge.key.length===1&&D(ge.key),["ArrowUp","ArrowDown","Home","End"].includes(ge.key)){let Me=ve().filter(_=>!_.disabled).map(_=>_.ref.current);if(["ArrowUp","End"].includes(ge.key)&&(Me=Me.slice().reverse()),["ArrowUp","ArrowDown"].includes(ge.key)){const _=ge.target,ce=Me.indexOf(_);Me=Me.slice(ce+1)}setTimeout(()=>U(Me)),ge.preventDefault()}})})})})})})},"SelectContentImpl")),rF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,onPlaced:o,...s}=e,a=Er(Ts,i),l=Os(Ts,i),[C,c]=E.useState(null),[u,h]=E.useState(null),m=en(n,h),v=AI(i),b=E.useRef(!1),x=E.useRef(!0),{viewport:y,selectedItem:S,selectedItemText:T,focusSelectedItem:O}=l,M=E.useCallback(()=>{if(a.trigger&&a.valueNode&&C&&u&&y&&S&&T){const F=a.trigger.getBoundingClientRect(),re=u.getBoundingClientRect(),pe=a.valueNode.getBoundingClientRect(),ie=T.getBoundingClientRect();if(a.dir!=="rtl"){const _=ie.left-re.left,ce=pe.left-_,Se=F.left-ce,_e=F.width+Se,gt=Math.max(_e,re.width),Et=window.innerWidth-$i,ot=dh(ce,[$i,Math.max($i,Et-gt)]);C.style.minWidth=_e+"px",C.style.left=ot+"px"}else{const _=re.right-ie.right,ce=window.innerWidth-pe.right-_,Se=window.innerWidth-F.right-ce,_e=F.width+Se,gt=Math.max(_e,re.width),Et=window.innerWidth-$i,ot=dh(ce,[$i,Math.max($i,Et-gt)]);C.style.minWidth=_e+"px",C.style.right=ot+"px"}const J=v(),ve=window.innerHeight-$i*2,me=y.scrollHeight,ue=window.getComputedStyle(u),z=parseInt(ue.borderTopWidth,10),U=parseInt(ue.paddingTop,10),Q=parseInt(ue.borderBottomWidth,10),le=parseInt(ue.paddingBottom,10),X=z+U+me+le+Q,R=Math.min(S.offsetHeight*5,X),D=window.getComputedStyle(y),H=parseInt(D.paddingTop,10),se=parseInt(D.paddingBottom,10),de=F.top+F.height/2-$i,be=ve-de,Ne=S.offsetHeight/2,ge=S.offsetTop+Ne,ae=z+U+ge,xe=X-ae;if(ae<=de){const _=J.length>0&&S===J[J.length-1].ref.current;C.style.bottom="0px";const ce=u.clientHeight-y.offsetTop-y.offsetHeight,Se=Math.max(be,Ne+(_?se:0)+ce+Q),_e=ae+Se;C.style.height=_e+"px"}else{const _=J.length>0&&S===J[0].ref.current;C.style.top="0px";const Se=Math.max(de,z+y.offsetTop+(_?H:0)+Ne)+xe;C.style.height=Se+"px",y.scrollTop=ae-de+y.offsetTop}C.style.margin=`${$i}px 0`,C.style.minHeight=R+"px",C.style.maxHeight=ve+"px",o?.(),requestAnimationFrame(()=>b.current=!0)}},[v,a.trigger,a.valueNode,C,u,y,S,T,a.dir,o]);Sn(()=>M(),[M]);const[k,G]=E.useState();Sn(()=>{u&&G(window.getComputedStyle(u).zIndex)},[u]);const L=E.useCallback(F=>{F&&x.current===!0&&(M(),O?.(),x.current=!1)},[M,O]);return d.jsx(sF,{scope:i,contentWrapper:C,shouldExpandOnScrollRef:b,onScrollButtonChange:L,children:d.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:d.jsx(Yn.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})},"SelectItemAlignedPosition")),qx=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,align:o="start",collisionPadding:s=$i,...a}=e,l=uh(i);return d.jsx(DG,{...l,...a,ref:n,align:o,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[sF,hh]=Es(Ts,{}),Jx="SelectViewport",gF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,nonce:o,...s}=e,a=Os(Jx,i),l=hh(Jx,i),C=en(n,a.onViewportChange),c=E.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(aI.Slot,{scope:i,children:d.jsx(Yn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:C,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:tn(s.onScroll,u=>{const h=u.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:v}=l;if(v?.current&&m){const b=Math.abs(c.current-h.scrollTop);if(b>0){const x=window.innerHeight-$i*2,y=parseFloat(m.style.minHeight),S=parseFloat(m.style.height),T=Math.max(y,S);if(T0?k:0,m.style.justifyContent="flex-end")}}}c.current=h.scrollTop})})})]})},"SelectViewport")),aF="SelectGroup",[Uhe,Hhe]=Es(aF),fh="SelectItem",[AF,e1]=Es(fh),lF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,value:o,disabled:s=!1,textValue:a,...l}=e,C=Er(fh,i),c=Os(fh,i),u=C.value===o,[h,m]=E.useState(a??""),[v,b]=E.useState(!1),x=lo(M=>c.itemRefCallback?.(M,o,s)),y=en(n,x),S=Zu(),T=E.useRef("touch"),O=Ct(()=>{s||(C.onValueChange(o),C.onOpenChange(!1))},"handleSelect");return d.jsx(AF,{scope:i,value:o,disabled:s,textId:S,isSelected:u,onItemTextChange:E.useCallback(M=>{m(k=>k||(M?.textContent??"").trim())},[]),children:d.jsx(aI.ItemSlot,{scope:i,value:o,disabled:s,textValue:h,children:d.jsx(Yn.div,{role:"option","aria-labelledby":S,"data-highlighted":v?"":void 0,"aria-selected":u&&v,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:y,onFocus:tn(l.onFocus,()=>b(!0)),onBlur:tn(l.onBlur,()=>b(!1)),onClick:tn(l.onClick,()=>{T.current!=="mouse"&&O()}),onPointerUp:tn(l.onPointerUp,()=>{T.current==="mouse"&&O()}),onPointerDown:tn(l.onPointerDown,M=>{T.current=M.pointerType}),onPointerMove:tn(l.onPointerMove,M=>{T.current=M.pointerType,s?c.onItemLeave?.():T.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tn(l.onPointerLeave,M=>{M.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:tn(l.onKeyDown,M=>{s||M.target!==M.currentTarget||c.searchRef?.current!==""&&M.key===" "||(ZG.includes(M.key)&&O(),M.key===" "&&M.preventDefault())})})})})},"SelectItem")),lI="SelectItemText",CF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,className:o,style:s,...a}=e,l=Er(lI,i),C=Os(lI,i),c=e1(lI,i),u=UG(lI,i),[h,m]=E.useState(null),v=lo(O=>C.itemTextRefCallback?.(O,c.value,c.disabled)),b=en(n,m,c.onItemTextChange,v),x=h?.textContent,y=E.useMemo(()=>d.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:S,onNativeOptionRemove:T}=u;return Sn(()=>(S(y),()=>T(y)),[S,T,y]),d.jsxs(d.Fragment,{children:[d.jsx(Yn.span,{id:c.textId,...a,ref:b}),c.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!pA(l.value)?bs.createPortal(a.children,l.valueNode):null]})},"SelectItemText")),IF="SelectItemIndicator",cF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,...o}=e;return e1(IF,i).isSelected?d.jsx(Yn.span,{"aria-hidden":!0,...o,ref:n}):null},"SelectItemIndicator")),t1="SelectScrollUpButton",dF=E.forwardRef(Ct(function(e,n){const i=Os(t1,e.__scopeSelect),o=hh(t1,e.__scopeSelect),[s,a]=E.useState(!1),l=en(n,o.onScrollButtonChange);return Sn(()=>{if(i.viewport&&i.isPositioned){let C=function(){const u=c.scrollTop>0;a(u)};Ct(C,"handleScroll");const c=i.viewport;return C(),c.addEventListener("scroll",C),()=>c.removeEventListener("scroll",C)}},[i.viewport,i.isPositioned]),s?d.jsx(i1,{...e,ref:l,onAutoScroll:()=>{const{viewport:C,selectedItem:c}=i;C&&c&&(C.scrollTop=C.scrollTop-c.offsetHeight)}}):null},"SelectScrollUpButton")),n1="SelectScrollDownButton",uF=E.forwardRef(Ct(function(e,n){const i=Os(n1,e.__scopeSelect),o=hh(n1,e.__scopeSelect),[s,a]=E.useState(!1),l=en(n,o.onScrollButtonChange);return Sn(()=>{if(i.viewport&&i.isPositioned){let C=function(){const u=c.scrollHeight-c.clientHeight,h=Math.ceil(c.scrollTop)c.removeEventListener("scroll",C)}},[i.viewport,i.isPositioned]),s?d.jsx(i1,{...e,ref:l,onAutoScroll:()=>{const{viewport:C,selectedItem:c}=i;C&&c&&(C.scrollTop=C.scrollTop+c.offsetHeight)}}):null},"SelectScrollDownButton")),i1=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,onAutoScroll:o,...s}=e,a=Os("SelectScrollButton",i),l=E.useRef(null),C=AI(i),c=E.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return E.useEffect(()=>()=>c(),[c]),Sn(()=>{C().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[C]),d.jsx(Yn.div,{"aria-hidden":!0,...s,ref:n,style:{flexShrink:0,...s.style},onPointerDown:tn(s.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(o,50))}),onPointerMove:tn(s.onPointerMove,()=>{a.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(o,50))}),onPointerLeave:tn(s.onPointerLeave,()=>{c()})})},"SelectScrollButtonImpl")),hF="SelectBubbleInput",fF=E.forwardRef(Ct(function({__scopeSelect:e,...n},i){const o=Er(hF,e),{value:s,onValueChange:a,required:l,disabled:C,name:c,autoComplete:u,form:h}=o,{nativeOptions:m,nativeSelectKey:v}=o,b=E.useRef(null),x=en(i,b),y=s??"",S=Kx(y),T=Array.from(m).some(O=>(O.props.value??"")==="");return E.useEffect(()=>{const O=b.current;if(!O)return;const M=window.HTMLSelectElement.prototype,G=Object.getOwnPropertyDescriptor(M,"value").set;if(S!==y&&G){const L=new Event("change",{bubbles:!0});G.call(O,y),O.dispatchEvent(L)}},[S,y]),d.jsxs(Yn.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:c,autoComplete:u,disabled:C,form:h,onChange:O=>a(O.target.value),...n,style:{...WZ,...n.style},ref:x,defaultValue:y,children:[pA(s)&&!T?d.jsx("option",{value:""}):null,Array.from(m)]},v)},"SelectBubbleInput"));function o1(t){return typeof t=="function"}Ct(o1,"isFunction");function pA(t){return t===""||t===void 0}Ct(pA,"shouldShowPlaceholder");function ph(t){const e=lo(t),n=E.useRef(""),i=E.useRef(0),o=E.useCallback(a=>{const l=n.current+a;e(l),Ct((function C(c){n.current=c,window.clearTimeout(i.current),c!==""&&(i.current=window.setTimeout(()=>C(""),1e3))}),"updateSearch")(l)},[e]),s=E.useCallback(()=>{n.current="",window.clearTimeout(i.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(i.current),[]),[n,o,s]}Ct(ph,"useTypeaheadSearch");function mh(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let a=r1(t,Math.max(s,0));o.length===1&&(a=a.filter(c=>c!==n));const C=a.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return C!==n?C:void 0}Ct(mh,"findNextItem");function r1(t,e){return t.map((n,i)=>t[(e+i)%t.length])}Ct(r1,"wrapArray");const CI=[{value:"automatic",label:"Automatic",Icon:kC},{value:"circle",label:"Circle",Icon:E4},{value:"concentric",label:"Concentric",Icon:iB},{value:"spiral",label:"Spiral",Icon:X4},{value:"grid",label:"Square grid",Icon:k4}];function pF({value:t,onChange:e,onOpen:n}){const i=CI.find(o=>o.value===t)??CI[0];return d.jsxs(HG,{value:t,onValueChange:o=>{const s=CI.find(a=>a.value===o);s&&e(s.value)},onOpenChange:o=>{o&&n()},children:[d.jsxs($G,{className:"compass-layout-picker","aria-label":"Graph layout",children:[d.jsx(i.Icon,{"aria-hidden":"true"}),d.jsx(KG,{children:i.label}),d.jsx(XG,{asChild:!0,children:d.jsx(hu,{"aria-hidden":"true"})})]}),d.jsx(eF,{children:d.jsxs(tF,{className:"compass-layout-menu",position:"popper",align:"start",sideOffset:6,collisionPadding:12,"aria-label":"Graph layout",children:[d.jsx(dF,{className:"compass-layout-menu-scroll",children:d.jsx(w4,{"aria-hidden":"true"})}),d.jsx(gF,{children:CI.map(({value:o,label:s,Icon:a})=>d.jsxs(lF,{value:o,className:"compass-layout-option",children:[d.jsx(a,{"aria-hidden":"true"}),d.jsx(CF,{children:s}),d.jsx(cF,{className:"compass-layout-check",children:d.jsx(y4,{"aria-hidden":"true"})})]},o))}),d.jsx(uF,{className:"compass-layout-menu-scroll",children:d.jsx(hu,{"aria-hidden":"true"})})]})})]})}function mF(t){return t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")}function vF({status:t,physicsRunning:e,layoutStyle:n,forceLabels:i,showEdgeLabels:o,hasSelection:s,isolateSelection:a,neighborhoodDepth:l,edgeDirection:C,layoutSpacing:c,showMinimap:u,scopeControls:h,leadingControls:m,leadingPanel:v,leadingPanelOpen:b,onLeadingPanelClose:x,onTogglePhysics:y,onLayoutChange:S,onZoomOut:T,onResetZoom:O,onZoomIn:M,onFit:k,onFitSelection:G,onReset:L,onToggleLabels:F,onToggleEdgeLabels:re,onToggleIsolation:pe,onNeighborhoodDepthChange:ie,onEdgeDirectionChange:J,onLayoutSpacingChange:ve,onToggleMinimap:me,onBack:ue,canvasControls:z=!0,variantControls:U,themeControls:Q}){const[le,X]=E.useState(!1),R=E.useId(),[D,H]=E.useState(!1),se=z||!!Q,de=E.useRef(null),be=E.useRef(null),Ne=E.useRef(null),ge=E.useRef(!1);return E.useEffect(()=>{b&&X(!1)},[b]),E.useEffect(()=>{le||!ge.current||(ge.current=!1,Ne.current?.focus())},[le]),E.useEffect(()=>{const ae=Me=>{if(se){if(Me.key==="Escape"){le&&(ge.current=!0,X(!1));return}Me.key!=="?"||mF(Me.target)||(Me.preventDefault(),x?.(),X(!0),H(!0))}},xe=Me=>{be.current?.contains(Me.target)||de.current?.contains(Me.target)||X(!1)};return document.addEventListener("keydown",ae),document.addEventListener("pointerdown",xe),()=>{document.removeEventListener("keydown",ae),document.removeEventListener("pointerdown",xe)}},[se,x,le]),E.useLayoutEffect(()=>{if(!le)return;const ae=()=>{const Me=Ne.current,_=de.current;if(!Me||!_)return;const ce=Me.getBoundingClientRect(),Se=Math.min(330,window.innerWidth-24),_e=Math.min(ce.bottom+8,window.innerHeight-24);_.style.width=`${Se}px`,_.style.left=`${Math.max(12,Math.min(ce.right-Se,window.innerWidth-Se-12))}px`,_.style.top=`${_e}px`,_.style.maxHeight=`${Math.max(0,window.innerHeight-_e-12)}px`};ae();const xe=typeof ResizeObserver>"u"?void 0:new ResizeObserver(ae);return be.current&&xe?.observe(be.current),window.addEventListener("resize",ae),document.addEventListener("scroll",ae,!0),()=>{xe?.disconnect(),window.removeEventListener("resize",ae),document.removeEventListener("scroll",ae,!0)}},[le]),d.jsxs("div",{ref:be,className:"compass-graph-toolbar compass-glass-panel",role:"toolbar","aria-label":"Graph controls",children:[d.jsxs("div",{className:"compass-viewer-status","data-state":e?"running":"paused",role:"status","aria-live":"polite",title:t,children:[d.jsx("span",{className:"compass-viewer-status-dot","aria-hidden":"true"}),d.jsx("span",{className:"compass-viewer-status-text",children:t})]}),d.jsxs("div",{className:"compass-toolbar-actions",children:[ue&&d.jsxs("button",{className:"compass-tool-button",type:"button","aria-label":"Back to community overview",onClick:ue,children:[d.jsx(h4,{}),d.jsx("span",{children:"Overview"})]}),m?d.jsx("div",{className:"compass-toolbar-leading",children:m}):null,h,h&&U?d.jsx("span",{className:"compass-toolbar-separator","aria-hidden":"true"}):null,U,z?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"compass-toolbar-group",role:"group","aria-label":"Graph arrangement",children:[d.jsx(pF,{value:n,onChange:S,onOpen:()=>{X(!1),x?.()}}),d.jsxs("button",{className:"compass-tool-button compass-physics-button",type:"button","aria-label":e?"Stop layout":n==="automatic"?"Run layout":"Fixed layout","aria-pressed":e,disabled:n!=="automatic",title:n==="automatic"?e?"Stop layout":"Run layout":"Physics is available in Automatic layout",onClick:y,children:[e?d.jsx(d0,{}):n==="automatic"?d.jsx(H4,{}):d.jsx(d0,{}),d.jsx("span",{children:e?"Stop":n==="automatic"?"Layout":"Fixed"})]})]}),d.jsx("span",{className:"compass-toolbar-separator","aria-hidden":"true"}),d.jsxs("div",{className:"compass-toolbar-group",role:"group","aria-label":"Graph camera",children:[d.jsxs("div",{className:"compass-zoom-controls",role:"group","aria-label":"Zoom controls",children:[d.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Zoom out",title:"Zoom out",onClick:T,children:d.jsx(rB,{})}),d.jsx("button",{className:"compass-tool-button compass-zoom-reset",type:"button","aria-label":"Reset zoom to 100%",title:"Reset zoom to 100%",onClick:O,children:"100%"}),d.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Zoom in",title:"Zoom in",onClick:M,children:d.jsx(oB,{})})]}),d.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Fit graph in view",title:"Fit graph in view",onClick:k,children:d.jsx(I0,{})})]})]}):null,se?d.jsx("button",{ref:Ne,className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Graph settings","aria-expanded":le,"aria-controls":R,title:"Graph settings (?)",onClick:()=>X(ae=>{const xe=!ae;return xe&&x?.(),xe}),children:d.jsx(K4,{})}):null]}),v,le&&se?bs.createPortal(d.jsxs("div",{ref:de,id:R,className:"compass-explore-panel compass-glass-panel",role:"region","aria-label":"Graph exploration controls",children:[d.jsxs("div",{className:"compass-explore-heading",children:[d.jsxs("div",{children:[d.jsx("strong",{children:"Graph settings"}),d.jsx("span",{children:"Customize the view and explore connections"})]}),d.jsx("kbd",{children:"?"})]}),d.jsxs("section",{className:"compass-settings-section","aria-label":"Appearance",children:[d.jsx("h3",{children:"Appearance"}),Q?d.jsxs("div",{className:"compass-settings-theme",children:[d.jsx("span",{children:"Theme"}),Q]}):null,z?d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":i?"Hide labels":"Show labels","aria-pressed":i,onClick:F,children:[d.jsx(nB,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Show node labels"}),d.jsx("small",{children:"Label every symbol, not only the ranked set"})]}),d.jsx("i",{"aria-hidden":"true"})]}),d.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":o?"Hide relationship labels":"Show relationship labels","aria-pressed":o,onClick:re,children:[d.jsx(f0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Show relationship labels"}),d.jsx("small",{children:"Print the relationship kind on every edge"})]}),d.jsx("i",{"aria-hidden":"true"})]})]}):null]}),z?d.jsxs(d.Fragment,{children:[d.jsxs("section",{className:"compass-settings-section","aria-label":"Layout and view",children:[d.jsx("h3",{children:"Layout & view"}),d.jsxs("label",{className:"compass-explore-select",children:[d.jsx("span",{children:"Layout spacing"}),d.jsxs("select",{"aria-label":"Layout spacing",value:c,onChange:ae=>ve(Number(ae.target.value)),children:[d.jsx("option",{value:2.25,children:"Compact · 75%"}),d.jsx("option",{value:3,children:"Default · 100%"}),d.jsx("option",{value:4.5,children:"Airy · 150%"}),d.jsx("option",{value:6,children:"Wide · 200%"}),d.jsx("option",{value:9,children:"Extra wide · 300%"})]})]}),d.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":"Show minimap","aria-pressed":u,onClick:me,children:[d.jsx(P4,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Show minimap"}),d.jsx("small",{children:"Track and reposition the visible viewport"})]}),d.jsx("i",{"aria-hidden":"true"})]}),d.jsxs("button",{className:"compass-explore-toggle compass-explore-action",type:"button","aria-label":"Reset graph view",onClick:L,children:[d.jsx(h0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Reset graph view"}),d.jsx("small",{children:"Return to the opening camera and clear selection"})]}),d.jsx(cu,{"aria-hidden":"true"})]})]}),d.jsxs("section",{className:"compass-settings-section","aria-label":"Selection and neighborhood",children:[d.jsx("h3",{children:"Selection & neighborhood"}),s?null:d.jsxs("div",{className:"compass-selection-prompt",role:"note",children:[d.jsx(p0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Select a node to isolate it"}),d.jsx("small",{children:"Use the canvas or node search. Depth and direction can be set now."})]})]}),d.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":"Isolate selection","aria-pressed":a,disabled:!s,onClick:pe,children:[d.jsx(p0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Isolate selection"}),d.jsx("small",{children:"Hide everything outside the traversal"})]}),d.jsx("i",{"aria-hidden":"true"})]}),d.jsxs("fieldset",{className:"compass-explore-field",children:[d.jsx("legend",{children:"Neighborhood depth"}),d.jsx("div",{className:"compass-segmented-control","aria-label":"Neighborhood depth",children:[1,2,3,4].map(ae=>d.jsx("button",{type:"button","aria-label":`${ae} hop${ae===1?"":"s"}`,"aria-pressed":l===ae,onClick:()=>ie(ae),children:ae},ae))})]}),d.jsxs("fieldset",{className:"compass-explore-field",children:[d.jsx("legend",{children:"Edge direction"}),d.jsx("div",{className:"compass-segmented-control","aria-label":"Edge direction",children:[["both","Both"],["outgoing","Out"],["incoming","In"]].map(([ae,xe])=>d.jsx("button",{type:"button","aria-label":`${xe==="Both"?"Both directions":xe==="Out"?"Outgoing edges":"Incoming edges"}`,"aria-pressed":C===ae,onClick:()=>J(ae),children:xe},ae))})]}),d.jsxs("button",{className:"compass-explore-toggle compass-explore-action",type:"button","aria-label":"Fit selected neighborhood",title:s?`Fit the selected node and its ${l}-hop neighborhood`:"Select a node to fit its neighborhood",disabled:!s,onClick:G,children:[d.jsx(R4,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Fit selection"}),d.jsx("small",{children:"Zoom to the selected node and its neighborhood"})]}),d.jsx(cu,{"aria-hidden":"true"})]})]}),d.jsxs("details",{className:"compass-shortcut-guide","aria-label":"Graph keyboard shortcuts",open:D,onToggle:ae=>H(ae.currentTarget.open),children:[d.jsxs("summary",{className:"compass-shortcut-title",children:[d.jsx(_4,{"aria-hidden":"true"}),d.jsx("strong",{children:"Keyboard shortcuts"}),d.jsx(hu,{"aria-hidden":"true"})]}),d.jsxs("dl",{children:[d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"F"})}),d.jsx("dd",{children:"Fit graph"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"⇧ F"})}),d.jsx("dd",{children:"Fit selection"})]}),d.jsxs("div",{children:[d.jsxs("dt",{children:[d.jsx("kbd",{children:"+"})," ",d.jsx("kbd",{children:"−"})]}),d.jsx("dd",{children:"Zoom"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"0"})}),d.jsx("dd",{children:"100% zoom"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"I"})}),d.jsx("dd",{children:"Isolate"})]}),d.jsxs("div",{children:[d.jsxs("dt",{children:[d.jsx("kbd",{children:"["})," ",d.jsx("kbd",{children:"]"})]}),d.jsx("dd",{children:"Depth"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"D"})}),d.jsx("dd",{children:"Direction"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"M"})}),d.jsx("dd",{children:"Minimap"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"L"})}),d.jsx("dd",{children:"Labels"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"⇧ L"})}),d.jsx("dd",{children:"Relationship labels"})]}),ue?d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"Esc"})}),d.jsx("dd",{children:"Back to overview"})]}):null]})]})]}):null]}),document.body):null]})}const s1=E.createContext(null);function yF(){return E.useContext(s1)}const bF={callable:"Callable",type:"Type",module:"Module / file",boundary:"Boundary / data",other:"Other"},wF={execution:"Execution",dependency:"Dependency",structure:"Structure",flow:"Data / event flow",other:"Other"};function xF({model:t}){const e=E.useMemo(()=>{const i=new Map;for(const o of t.nodes){const s=yg(o.kind);i.set(s,(i.get(s)??0)+1)}return i},[t.nodes]),n=E.useMemo(()=>{const i=new Map;for(const o of t.edges){const s=bg(o.relation);i.set(s,(i.get(s)??0)+1)}return i},[t.edges]);return d.jsxs("aside",{className:"compass-semantic-legend compass-glass-panel","aria-label":"Graph visual legend",children:[d.jsxs("section",{"aria-label":"Node categories",children:[d.jsx("strong",{children:"Nodes"}),cB.filter(i=>(e.get(i)??0)>0).map(i=>d.jsxs("span",{className:"compass-semantic-legend-item",children:[d.jsx("i",{"data-node-category":i,"aria-hidden":"true"}),bF[i],d.jsx("small",{children:e.get(i)})]},i))]}),t.edges.length>0?d.jsxs("section",{"aria-label":"Relationship categories",children:[d.jsx("strong",{children:"Edges"}),S0.filter(i=>(n.get(i)??0)>0).map(i=>d.jsxs("span",{className:"compass-semantic-legend-item",children:[d.jsx("i",{"data-edge-category":i,"aria-hidden":"true"}),wF[i],d.jsx("small",{children:n.get(i)})]},i))]}):null]})}const g1=280,a1=560,A1=24,vh={width:340,collapsed:!1};function mA(t){return Number.isFinite(t)?Math.min(a1,Math.max(g1,Math.round(t))):vh.width}function l1(t){return{width:mA(t?.width??vh.width),collapsed:t?.collapsed??vh.collapsed}}function SF(t,e){return mA(t-e)}function EF(t,e){return mA(e==="ArrowLeft"?t+A1:e==="ArrowRight"?t-A1:t)}function TF({width:t,onResize:e}){const n=E.useRef(!1),i=o=>{n.current=!1,o.currentTarget.hasPointerCapture(o.pointerId)&&o.currentTarget.releasePointerCapture(o.pointerId)};return d.jsx("div",{className:"compass-inspector-resizer",role:"separator","aria-label":"Resize graph inspector","aria-orientation":"vertical","aria-valuemin":g1,"aria-valuemax":a1,"aria-valuenow":t,tabIndex:0,onPointerDown:o=>{n.current=!0,o.currentTarget.setPointerCapture(o.pointerId)},onPointerMove:o=>{if(!n.current)return;const s=o.currentTarget.parentElement;s&&e(SF(s.getBoundingClientRect().right,o.clientX))},onPointerUp:i,onPointerCancel:i,onKeyDown:o=>{o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),e(EF(t,o.key)))},children:d.jsx("span",{"aria-hidden":"true"})})}function C1(t,e,n){if(n===void 0&&t.stats.aggregated&&e.memberCount!==void 0&&e.detailAvailable!==!1)return{type:"community",communityId:e.community};const i=Iw(e);return i?{type:"source",source:i}:{type:"none"}}function OF(t){const e=t.source?.startLine,n=t.source?.endLine;if(e!==void 0)return n!==void 0&&n!==e?`${e}–${n}`:String(e)}function NF({node:t,hover:e,activation:n}){const i={"--compass-hover-x":`${e.x+18}px`,"--compass-hover-y":`${e.y-42}px`},o=OF(t);return d.jsxs("div",{className:"compass-node-hover-card",role:"tooltip",style:i,children:[d.jsxs("div",{className:"compass-hover-heading",children:[d.jsx("strong",{children:t.label}),d.jsx("span",{children:(t.kind??"symbol").toLocaleUpperCase()})]}),t.change&&d.jsx("span",{className:"compass-change-badge","data-change":t.change,children:t.change==="unchanged"?"Context":`${t.change[0]?.toLocaleUpperCase()}${t.change.slice(1)}`}),t.groundingStatus==="GROUNDED"&&d.jsx("span",{className:"compass-change-badge","data-grounding":"grounded",children:"GROUNDED · agent-authored"}),t.agentSummary&&d.jsx("p",{children:t.agentSummary}),t.challenge&&d.jsxs("p",{children:["Challenge (",t.challenge.effect,"): ",t.challenge.summary]}),t.challenged&&!t.challenge&&d.jsx("p",{children:"Challenge: this Base Graph fact is disputed."}),t.memberCount!==void 0?d.jsxs("p",{children:[t.memberCount.toLocaleString()," symbols"]}):d.jsxs(d.Fragment,{children:[t.language&&d.jsxs("p",{children:["Language: ",t.language]}),t.source?.file&&d.jsx("p",{className:"compass-hover-source",children:t.source.file}),o&&d.jsxs("p",{children:["Lines: ",o]}),t.signature&&d.jsx("code",{children:t.signature})]}),n.type!=="none"&&d.jsxs("p",{className:"compass-hover-hint",children:[n.type==="community"?d.jsx(kC,{"aria-hidden":"true"}):d.jsx(N4,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Double-click"})," ",n.type==="community"?"to open community subgraph":"to open source code"]})]})]})}const MF={routes_to:"routes to",publishes:"publishes",subscribes:"subscribes",produces:"produces",consumes:"consumes",schedules:"schedules",triggers:"triggers",handles:"handles",registers:"registers",reads:"reads",writes:"writes",maps_to:"maps to",depends_on:"depends on",renders:"renders"};function RF(t){const e=t.relation.trim(),n=MF[e]??e,i=t.details?.type==="route"?t.details.data:void 0,o=i?`${i.stage}${i.position===null||i.position===void 0?"":` ${i.position+1}`}`:void 0;return[n,o,i?.operation].filter(s=>s!==void 0&&s!=="").join(" · ")}function kF(t){if(!t?.file.trim())return"";const e=t.startLine,n=t.endLine;if(e!==void 0){const i=n!==void 0&&n!==e?`${e}–${n}`:String(e);return`${t.file}:${i}`}return t.startByte!==void 0?`${t.file}:byte ${t.startByte}`:t.file}function DF(t){const e=t.confidence;return e?`${e[0]?.toLocaleUpperCase()}${e.slice(1)}`:"Unspecified"}function _F(t){if(t)return t==="unchanged"?"Context":`${t[0]?.toLocaleUpperCase()}${t.slice(1)}`}function jF({edge:t,sourceNode:e,targetNode:n,hover:i}){const o={"--compass-hover-x":`${i.x+18}px`,"--compass-hover-y":`${i.y-52}px`},s=kF(t.relationshipSite),a=t.codeEvidence?.[0],l=_F(t.change),C=cw(t)!==void 0;return d.jsxs("div",{className:"compass-edge-hover-card",role:"tooltip",style:o,children:[d.jsxs("div",{className:"compass-edge-hover-heading",children:[d.jsxs("span",{className:"compass-edge-hover-eyebrow",children:[d.jsx(l0,{"aria-hidden":"true"}),"Relationship"]}),d.jsx("span",{className:"compass-edge-confidence","data-confidence":t.confidence??"unspecified",children:DF(t)})]}),d.jsxs("div",{className:"compass-edge-trace","aria-label":`${e.label} to ${n.label}`,children:[d.jsx("strong",{children:e.label}),d.jsx("span",{"aria-hidden":"true",children:d.jsx(cu,{})}),d.jsx("strong",{children:n.label})]}),d.jsxs("div",{className:"compass-edge-relation-row",children:[d.jsx("strong",{children:RF(t)||"Relationship"}),l&&d.jsx("span",{className:"compass-change-badge","data-change":t.change,children:l}),t.groundingStatus==="GROUNDED"&&d.jsx("span",{className:"compass-change-badge","data-grounding":"grounded",children:"GROUNDED · agent-authored"})]}),t.agentSummary&&d.jsx("p",{children:t.agentSummary}),t.challenge&&d.jsxs("p",{children:["Challenge (",t.challenge.effect,"): ",t.challenge.summary]}),t.challenged&&!t.challenge&&d.jsx("p",{children:"Challenge: this Base Graph relationship is disputed."}),(a||s)&&d.jsxs("div",{className:"compass-edge-metadata",children:[a&&d.jsxs("p",{children:[d.jsx("span",{children:"Evidence"}),d.jsx("code",{children:a.rule??a.origin})]}),s&&d.jsxs("p",{children:[d.jsx("span",{children:"Source"}),d.jsx("code",{children:s})]})]}),C&&d.jsxs("p",{className:"compass-hover-hint",children:[d.jsx(l0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Double-click"})," to open relationship source"]})]})]})}var yh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function He(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var II=function(t){return t&&t.Math===Math&&t},$t=II(typeof globalThis=="object"&&globalThis)||II(typeof window=="object"&&window)||II(typeof self=="object"&&self)||II(typeof yh=="object"&&yh)||(function(){return this})()||yh||Function("return this")(),ht=function(t){try{return!!t()}catch{return!0}},zF=ht,vA=!zF(function(){var t=(function(){}).bind();return typeof t!="function"||t.hasOwnProperty("prototype")}),PF=vA,I1=Function.prototype,c1=I1.apply,d1=I1.call,cI=typeof Reflect=="object"&&Reflect.apply||(PF?d1.bind(c1):function(){return d1.apply(c1,arguments)}),u1=vA,h1=Function.prototype,bh=h1.call,LF=u1&&h1.bind.bind(bh,bh),ft=u1?LF:function(t){return function(){return bh.apply(t,arguments)}},f1=ft,BF=f1({}.toString),ZF=f1("".slice),Fo=function(t){return ZF(BF(t),8,-1)},GF=Fo,FF=ft,wh=function(t){if(GF(t)==="Function")return FF(t)},xh=typeof document=="object"&&document.all,VF=typeof xh>"u"&&xh!==void 0,p1={all:xh,IS_HTMLDDA:VF},m1=p1,UF=m1.all,kn=m1.IS_HTMLDDA?function(t){return typeof t=="function"||t===UF}:function(t){return typeof t=="function"},yA={},HF=ht,vn=!HF(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),YF=vA,dI=Function.prototype.call,Wi=YF?dI.bind(dI):function(){return dI.apply(dI,arguments)},bA={},v1={}.propertyIsEnumerable,y1=Object.getOwnPropertyDescriptor,$F=y1&&!v1.call({1:2},1);bA.f=$F?function(e){var n=y1(this,e);return!!n&&n.enumerable}:v1;var wA=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}},WF=ft,KF=ht,XF=Fo,Sh=Object,QF=WF("".split),uI=KF(function(){return!Sh("z").propertyIsEnumerable(0)})?function(t){return XF(t)==="String"?QF(t,""):Sh(t)}:Sh,zg=function(t){return t==null},qF=zg,JF=TypeError,xA=function(t){if(qF(t))throw new JF("Can't call method on "+t);return t},e9=uI,t9=xA,Ki=function(t){return e9(t9(t))},b1=kn,w1=p1,n9=w1.all,Vn=w1.IS_HTMLDDA?function(t){return typeof t=="object"?t!==null:b1(t)||t===n9}:function(t){return typeof t=="object"?t!==null:b1(t)},vt={},Eh=vt,Th=$t,i9=kn,x1=function(t){return i9(t)?t:void 0},Xi=function(t,e){return arguments.length<2?x1(Eh[t])||x1(Th[t]):Eh[t]&&Eh[t][e]||Th[t]&&Th[t][e]},o9=ft,Wt=o9({}.isPrototypeOf),SA=typeof navigator<"u"&&String(navigator.userAgent)||"",S1=$t,Oh=SA,E1=S1.process,T1=S1.Deno,O1=E1&&E1.versions||T1&&T1.version,N1=O1&&O1.v8,Qi,hI;N1&&(Qi=N1.split("."),hI=Qi[0]>0&&Qi[0]<4?1:+(Qi[0]+Qi[1])),!hI&&Oh&&(Qi=Oh.match(/Edge\/(\d+)/),(!Qi||Qi[1]>=74)&&(Qi=Oh.match(/Chrome\/(\d+)/),Qi&&(hI=+Qi[1])));var EA=hI,M1=EA,r9=ht,s9=$t,g9=s9.String,Pg=!!Object.getOwnPropertySymbols&&!r9(function(){var t=Symbol("symbol detection");return!g9(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&M1&&M1<41}),a9=Pg,R1=a9&&!Symbol.sham&&typeof Symbol.iterator=="symbol",A9=Xi,l9=kn,C9=Wt,I9=R1,c9=Object,TA=I9?function(t){return typeof t=="symbol"}:function(t){var e=A9("Symbol");return l9(e)&&C9(e.prototype,c9(t))},d9=String,OA=function(t){try{return d9(t)}catch{return"Object"}},u9=kn,h9=OA,f9=TypeError,Ns=function(t){if(u9(t))return t;throw new f9(h9(t)+" is not a function")},p9=Ns,m9=zg,Nh=function(t,e){var n=t[e];return m9(n)?void 0:p9(n)},Mh=Wi,Rh=kn,kh=Vn,v9=TypeError,y9=function(t,e){var n,i;if(e==="string"&&Rh(n=t.toString)&&!kh(i=Mh(n,t))||Rh(n=t.valueOf)&&!kh(i=Mh(n,t))||e!=="string"&&Rh(n=t.toString)&&!kh(i=Mh(n,t)))return i;throw new v9("Can't convert object to primitive value")},k1={exports:{}},D1=$t,b9=Object.defineProperty,w9=function(t,e){try{b9(D1,t,{value:e,configurable:!0,writable:!0})}catch{D1[t]=e}return e},x9=$t,S9=w9,_1="__core-js_shared__",E9=x9[_1]||S9(_1,{}),Dh=E9,j1=Dh;(k1.exports=function(t,e){return j1[t]||(j1[t]=e!==void 0?e:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Lg=k1.exports,T9=xA,O9=Object,fi=function(t){return O9(T9(t))},N9=ft,M9=fi,R9=N9({}.hasOwnProperty),yn=Object.hasOwn||function(e,n){return R9(M9(e),n)},k9=ft,D9=0,_9=Math.random(),j9=k9(1 .toString),fI=function(t){return"Symbol("+(t===void 0?"":t)+")_"+j9(++D9+_9,36)},z9=$t,P9=Lg,z1=yn,L9=fI,B9=Pg,Z9=R1,Bg=z9.Symbol,_h=P9("wks"),G9=Z9?Bg.for||Bg:Bg&&Bg.withoutSetter||L9,nn=function(t){return z1(_h,t)||(_h[t]=B9&&z1(Bg,t)?Bg[t]:G9("Symbol."+t)),_h[t]},F9=Wi,P1=Vn,L1=TA,V9=Nh,U9=y9,H9=nn,Y9=TypeError,$9=H9("toPrimitive"),W9=function(t,e){if(!P1(t)||L1(t))return t;var n=V9(t,$9),i;if(n){if(e===void 0&&(e="default"),i=F9(n,t,e),!P1(i)||L1(i))return i;throw new Y9("Can't convert object to primitive value")}return e===void 0&&(e="number"),U9(t,e)},K9=W9,X9=TA,pI=function(t){var e=K9(t,"string");return X9(e)?e:e+""},Q9=$t,B1=Vn,jh=Q9.document,q9=B1(jh)&&B1(jh.createElement),Z1=function(t){return q9?jh.createElement(t):{}},J9=vn,eV=ht,tV=Z1,G1=!J9&&!eV(function(){return Object.defineProperty(tV("div"),"a",{get:function(){return 7}}).a!==7}),nV=vn,iV=Wi,oV=bA,rV=wA,sV=Ki,gV=pI,aV=yn,AV=G1,F1=Object.getOwnPropertyDescriptor;yA.f=nV?F1:function(e,n){if(e=sV(e),n=gV(n),AV)try{return F1(e,n)}catch{}if(aV(e,n))return rV(!iV(oV.f,e,n),e[n])};var lV=ht,CV=kn,IV=/#|\.prototype\./,NA=function(t,e){var n=dV[cV(t)];return n===hV?!0:n===uV?!1:CV(e)?lV(e):!!e},cV=NA.normalize=function(t){return String(t).replace(IV,".").toLowerCase()},dV=NA.data={},uV=NA.NATIVE="N",hV=NA.POLYFILL="P",fV=NA,V1=wh,pV=Ns,mV=vA,vV=V1(V1.bind),MA=function(t,e){return pV(t),e===void 0?t:mV?vV(t,e):function(){return t.apply(e,arguments)}},pi={},yV=vn,bV=ht,U1=yV&&bV(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),wV=Vn,xV=String,SV=TypeError,Vo=function(t){if(wV(t))return t;throw new SV(xV(t)+" is not an object")},EV=vn,TV=G1,OV=U1,mI=Vo,H1=pI,NV=TypeError,zh=Object.defineProperty,MV=Object.getOwnPropertyDescriptor,Ph="enumerable",Lh="configurable",Bh="writable";pi.f=EV?OV?function(e,n,i){if(mI(e),n=H1(n),mI(i),typeof e=="function"&&n==="prototype"&&"value"in i&&Bh in i&&!i[Bh]){var o=MV(e,n);o&&o[Bh]&&(e[n]=i.value,i={configurable:Lh in i?i[Lh]:o[Lh],enumerable:Ph in i?i[Ph]:o[Ph],writable:!1})}return zh(e,n,i)}:zh:function(e,n,i){if(mI(e),n=H1(n),mI(i),TV)try{return zh(e,n,i)}catch{}if("get"in i||"set"in i)throw new NV("Accessors not supported");return"value"in i&&(e[n]=i.value),e};var RV=vn,kV=pi,DV=wA,Zg=RV?function(t,e,n){return kV.f(t,e,DV(1,n))}:function(t,e,n){return t[e]=n,t},vI=$t,_V=cI,jV=wh,zV=kn,PV=yA.f,LV=fV,Gg=vt,BV=MA,Fg=Zg,Y1=yn,ZV=function(t){var e=function(n,i,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,i)}return new t(n,i,o)}return _V(t,this,arguments)};return e.prototype=t.prototype,e},We=function(t,e){var n=t.target,i=t.global,o=t.stat,s=t.proto,a=i?vI:o?vI[n]:(vI[n]||{}).prototype,l=i?Gg:Gg[n]||Fg(Gg,n,{})[n],C=l.prototype,c,u,h,m,v,b,x,y,S;for(m in e)c=LV(i?m:n+(o?".":"#")+m,t.forced),u=!c&&a&&Y1(a,m),b=l[m],u&&(t.dontCallGetSet?(S=PV(a,m),x=S&&S.value):x=a[m]),v=u&&x?x:e[m],!(u&&typeof b==typeof v)&&(t.bind&&u?y=BV(v,vI):t.wrap&&u?y=ZV(v):s&&zV(v)?y=jV(v):y=v,(t.sham||v&&v.sham||b&&b.sham)&&Fg(y,"sham",!0),Fg(l,m,y),s&&(h=n+"Prototype",Y1(Gg,h)||Fg(Gg,h,{}),Fg(Gg[h],m,v),t.real&&C&&(c||!C[m])&&Fg(C,m,v)))},GV=Math.ceil,FV=Math.floor,VV=Math.trunc||function(e){var n=+e;return(n>0?FV:GV)(n)},UV=VV,yI=function(t){var e=+t;return e!==e||e===0?0:UV(e)},HV=yI,YV=Math.max,$V=Math.min,RA=function(t,e){var n=HV(t);return n<0?YV(n+e,0):$V(n,e)},WV=yI,KV=Math.min,XV=function(t){return t>0?KV(WV(t),9007199254740991):0},QV=XV,Mi=function(t){return QV(t.length)},qV=Ki,JV=RA,eU=Mi,$1=function(t){return function(e,n,i){var o=qV(e),s=eU(o),a=JV(i,s),l;if(t&&n!==n){for(;s>a;)if(l=o[a++],l!==l)return!0}else for(;s>a;a++)if((t||a in o)&&o[a]===n)return t||a||0;return!t&&-1}},Zh={includes:$1(!0),indexOf:$1(!1)},kA={},tU=ft,Gh=yn,nU=Ki,iU=Zh.indexOf,oU=kA,W1=tU([].push),K1=function(t,e){var n=nU(t),i=0,o=[],s;for(s in n)!Gh(oU,s)&&Gh(n,s)&&W1(o,s);for(;e.length>i;)Gh(n,s=e[i++])&&(~iU(o,s)||W1(o,s));return o},Fh=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],rU=K1,sU=Fh,DA=Object.keys||function(e){return rU(e,sU)},_A={};_A.f=Object.getOwnPropertySymbols;var X1=vn,gU=ft,aU=Wi,AU=ht,Vh=DA,lU=_A,CU=bA,IU=fi,cU=uI,Vg=Object.assign,Q1=Object.defineProperty,dU=gU([].concat),uU=!Vg||AU(function(){if(X1&&Vg({b:1},Vg(Q1({},"a",{enumerable:!0,get:function(){Q1(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var t={},e={},n=Symbol("assign detection"),i="abcdefghijklmnopqrst";return t[n]=7,i.split("").forEach(function(o){e[o]=o}),Vg({},t)[n]!==7||Vh(Vg({},e)).join("")!==i})?function(e,n){for(var i=IU(e),o=arguments.length,s=1,a=lU.f,l=CU.f;o>s;)for(var C=cU(arguments[s++]),c=a?dU(Vh(C),a(C)):Vh(C),u=c.length,h=0,m;u>h;)m=c[h++],(!X1||aU(l,C,m))&&(i[m]=C[m]);return i}:Vg,hU=We,q1=uU;hU({target:"Object",stat:!0,forced:Object.assign!==q1},{assign:q1});var fU=vt,pU=fU.Object.assign,mU=pU,vU=mU,yU=vU,on=He(yU),bU=ft,bI=bU([].slice),J1=ft,wU=Ns,xU=Vn,SU=yn,eS=bI,EU=vA,tS=Function,TU=J1([].concat),OU=J1([].join),Uh={},NU=function(t,e,n){if(!SU(Uh,e)){for(var i=[],o=0;o=.1;)b=+s[h++%a],b>u&&(b=u),v=Math.sqrt(b*b/(1+c*c)),v=l<0?-v:v,e+=v,n+=c*v,m===!0?t.lineTo(e,n):t.moveTo(e,n),u-=b,m=!m}function YU(t,e,n,i){t.beginPath();const o=6,s=Math.PI*2/o;t.moveTo(e+i,n);for(let a=1;a1?n-1:0),o=1;o"u")){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}var WU=`.vis-overlay { +`)},a8=0,Mg=[];function A8(t){var e=E.useRef([]),n=E.useRef([0,0]),i=E.useRef(),o=E.useState(a8++)[0],s=E.useState(Cx)[0],a=E.useRef(t);E.useEffect(function(){a.current=t},[t]),E.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var x=M6([t.lockRef.current],(t.shards||[]).map(px),!0).filter(Boolean);return x.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),x.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=E.useCallback(function(x,y){if("touches"in x&&x.touches.length===2||x.type==="wheel"&&x.ctrlKey)return!a.current.allowPinchZoom;var S=$C(x),T=n.current,O="deltaX"in x?x.deltaX:T[0]-S[0],M="deltaY"in x?x.deltaY:T[1]-S[1],k,G=x.target,L=Math.abs(O)>Math.abs(M)?"h":"v";if("touches"in x&&L==="h"&&G.type==="range")return!1;var F=window.getSelection(),re=F&&F.anchorNode,pe=re?re===G||re.contains(G):!1;if(pe)return!1;var ie=dx(L,G);if(!ie)return!0;if(ie?k=L:(k=L==="v"?"h":"v",ie=dx(L,G)),!ie)return!1;if(!i.current&&"changedTouches"in x&&(O||M)&&(i.current=k),!k)return!0;var J=i.current||k;return r8(J,y,x,J==="h"?O:M)},[]),C=E.useCallback(function(x){var y=x;if(!(!Mg.length||Mg[Mg.length-1]!==s)){var S="deltaY"in y?fx(y):$C(y),T=e.current.filter(function(k){return k.name===y.type&&(k.target===y.target||y.target===k.shadowParent)&&s8(k.delta,S)})[0];if(T&&T.should){y.cancelable&&y.preventDefault();return}if(!T){var O=(a.current.shards||[]).map(px).filter(Boolean).filter(function(k){return k.contains(y.target)}),M=O.length>0?l(y,O[0]):!a.current.noIsolation;M&&y.cancelable&&y.preventDefault()}}},[]),c=E.useCallback(function(x,y,S,T){var O={name:x,delta:y,target:S,should:T,shadowParent:l8(S)};e.current.push(O),setTimeout(function(){e.current=e.current.filter(function(M){return M!==O})},1)},[]),u=E.useCallback(function(x){n.current=$C(x),i.current=void 0},[]),h=E.useCallback(function(x){c(x.type,fx(x),x.target,l(x,t.lockRef.current))},[]),m=E.useCallback(function(x){c(x.type,$C(x),x.target,l(x,t.lockRef.current))},[]);E.useEffect(function(){return Mg.push(s),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",C,Ng),document.addEventListener("touchmove",C,Ng),document.addEventListener("touchstart",u,Ng),function(){Mg=Mg.filter(function(x){return x!==s}),document.removeEventListener("wheel",C,Ng),document.removeEventListener("touchmove",C,Ng),document.removeEventListener("touchstart",u,Ng)}},[]);var v=t.removeScrollBar,b=t.inert;return E.createElement(E.Fragment,null,b?E.createElement(s,{styles:g8(o)}):null,v?E.createElement(q6,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function l8(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const C8=B6(lx,A8);var mx=E.forwardRef(function(t,e){return E.createElement(HC,Co({},t,{ref:e,sideCar:C8}))});mx.classNames=HC.classNames;var I8=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Rg=new WeakMap,WC=new WeakMap,KC={},nh=0,vx=function(t){return t&&(t.host||vx(t.parentNode))},c8=function(t,e){return e.map(function(n){if(t.contains(n))return n;var i=vx(n);return i&&t.contains(i)?i:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},d8=function(t,e,n,i){var o=c8(e,Array.isArray(t)?t:[t]);KC[n]||(KC[n]=new WeakMap);var s=KC[n],a=[],l=new Set,C=new Set(o),c=function(h){!h||l.has(h)||(l.add(h),c(h.parentNode))};o.forEach(c);var u=function(h){!h||C.has(h)||Array.prototype.forEach.call(h.children,function(m){if(l.has(m))u(m);else try{var v=m.getAttribute(i),b=v!==null&&v!=="false",x=(Rg.get(m)||0)+1,y=(s.get(m)||0)+1;Rg.set(m,x),s.set(m,y),a.push(m),x===1&&b&&WC.set(m,!0),y===1&&m.setAttribute(n,"true"),b||m.setAttribute(i,"true")}catch(S){console.error("aria-hidden: cannot operate on ",m,S)}})};return u(e),l.clear(),nh++,function(){a.forEach(function(h){var m=Rg.get(h)-1,v=s.get(h)-1;Rg.set(h,m),s.set(h,v),m||(WC.has(h)||h.removeAttribute(i),WC.delete(h)),v||h.removeAttribute(n)}),nh--,nh||(Rg=new WeakMap,Rg=new WeakMap,WC=new WeakMap,KC={})}},u8=function(t,e,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(t)?t:[t]),o=I8(t);return o?(i.push.apply(i,Array.from(o.querySelectorAll("[aria-live], script"))),d8(i,o,n,"aria-hidden")):function(){return null}},h8=Object.defineProperty,f8=(t,e)=>h8(t,"name",{value:e,configurable:!0});function yx(t){const[e,n]=E.useState(void 0);return Sn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let a,l;if("borderBoxSize"in s){const C=s.borderBoxSize,c=Array.isArray(C)?C[0]:C;a=c.inlineSize,l=c.blockSize}else a=t.offsetWidth,l=t.offsetHeight;n({width:a,height:l})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else n(void 0)},[t]),e}f8(yx,"useSize");const p8=["top","right","bottom","left"],br=Math.min,Lo=Math.max,XC=Math.round,QC=Math.floor,Bo=t=>({x:t,y:t}),m8={left:"right",right:"left",bottom:"top",top:"bottom"};function bx(t,e,n){return Lo(t,br(e,n))}function Zo(t,e){return typeof t=="function"?t(e):t}function wr(t){return t.split("-")[0]}function kg(t){return t.split("-")[1]}function ih(t){return t==="x"?"y":"x"}function oh(t){return t==="y"?"height":"width"}function Io(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function rh(t){return ih(Io(t))}function v8(t,e,n){n===void 0&&(n=!1);const i=kg(t),o=rh(t),s=oh(o);let a=o==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=qC(a)),[a,qC(a)]}function y8(t){const e=qC(t);return[sh(t),e,sh(e)]}function sh(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const wx=["left","right"],xx=["right","left"],b8=["top","bottom"],w8=["bottom","top"];function x8(t,e,n){switch(t){case"top":case"bottom":return n?e?xx:wx:e?wx:xx;case"left":case"right":return e?b8:w8;default:return[]}}function S8(t,e,n,i){const o=kg(t);let s=x8(wr(t),n==="start",i);return o&&(s=s.map(a=>a+"-"+o),e&&(s=s.concat(s.map(sh)))),s}function qC(t){const e=wr(t);return m8[e]+t.slice(e.length)}function E8(t){var e,n,i,o;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(i=t.bottom)!=null?i:0,left:(o=t.left)!=null?o:0}}function Sx(t){return typeof t!="number"?E8(t):{top:t,right:t,bottom:t,left:t}}function JC(t){const{x:e,y:n,width:i,height:o}=t;return{width:i,height:o,top:n,left:e,right:e+i,bottom:n+o,x:e,y:n}}function Ex(t,e,n){let{reference:i,floating:o}=t;const s=Io(e),a=rh(e),l=oh(a),C=wr(e),c=s==="y",u=i.x+i.width/2-o.width/2,h=i.y+i.height/2-o.height/2,m=i[l]/2-o[l]/2;let v;switch(C){case"top":v={x:u,y:i.y-o.height};break;case"bottom":v={x:u,y:i.y+i.height};break;case"right":v={x:i.x+i.width,y:h};break;case"left":v={x:i.x-o.width,y:h};break;default:v={x:i.x,y:i.y}}const b=kg(e);return b&&(v[a]+=m*(b==="end"?1:-1)*(n&&c?-1:1)),v}async function T8(t,e){var n;e===void 0&&(e={});const{x:i,y:o,platform:s,rects:a,elements:l,strategy:C}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:m=!1,padding:v=0}=Zo(e,t),b=Sx(v),y=l[m?h==="floating"?"reference":"floating":h],S=JC(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:C})),T=h==="floating"?{x:i,y:o,width:a.floating.width,height:a.floating.height}:a.reference,O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),M=await(s.isElement==null?void 0:s.isElement(O))&&await(s.getScale==null?void 0:s.getScale(O))||{x:1,y:1},k=JC(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:T,offsetParent:O,strategy:C}):T);return{top:(S.top-k.top+b.top)/M.y,bottom:(k.bottom-S.bottom+b.bottom)/M.y,left:(S.left-k.left+b.left)/M.x,right:(k.right-S.right+b.right)/M.x}}const O8=50,N8=async(t,e,n)=>{const{placement:i="bottom",strategy:o="absolute",middleware:s=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:T8},C=await(a.isRTL==null?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:h}=Ex(c,i,C),m=i,v=0;const b={};for(let x=0;x({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:o,rects:s,platform:a,elements:l,middlewareData:C}=e,{element:c,padding:u=0}=Zo(t,e)||{};if(c==null)return{};const h=Sx(u),m={x:n,y:i},v=rh(o),b=oh(v),x=await a.getDimensions(c),y=v==="y",S=y?"top":"left",T=y?"bottom":"right",O=y?"clientHeight":"clientWidth",M=s.reference[b]+s.reference[v]-m[v]-s.floating[b],k=m[v]-s.reference[v],G=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let L=G?G[O]:0;(!L||!await(a.isElement==null?void 0:a.isElement(G)))&&(L=l.floating[O]||s.floating[b]);const F=M/2-k/2,re=L/2-x[b]/2-1,pe=br(h[S],re),ie=br(h[T],re),J=L-x[b]-ie,ve=L/2-x[b]/2+F,me=bx(pe,ve,J),ue=!C.arrow&&kg(o)!=null&&ve!==me&&s.reference[b]/2-(veme<=0)){var ie,J;const me=(((ie=s.flip)==null?void 0:ie.index)||0)+1,ue=L[me];if(ue&&(!(h==="alignment"?T!==Io(ue):!1)||pe.every(Q=>Io(Q.placement)===T?Q.overflows[0]>0:!0)))return{data:{index:me,overflows:pe},reset:{placement:ue}};let z=(J=pe.filter(U=>U.overflows[0]<=0).sort((U,Q)=>U.overflows[1]-Q.overflows[1])[0])==null?void 0:J.placement;if(!z)switch(v){case"bestFit":{var ve;const U=(ve=pe.filter(Q=>{if(G){const le=Io(Q.placement);return le===T||le==="y"}return!0}).map(Q=>[Q.placement,Q.overflows.filter(le=>le>0).reduce((le,X)=>le+X,0)]).sort((Q,le)=>Q[1]-le[1])[0])==null?void 0:ve[0];U&&(z=U);break}case"initialPlacement":z=l;break}if(o!==z)return{reset:{placement:z}}}return{}}}};function Tx(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ox(t){return p8.some(e=>t[e]>=0)}const k8=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:i}=e,{strategy:o="referenceHidden",...s}=Zo(t,e);switch(o){case"referenceHidden":{const a=await i.detectOverflow(e,{...s,elementContext:"reference"}),l=Tx(a,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Ox(l)}}}case"escaped":{const a=await i.detectOverflow(e,{...s,altBoundary:!0}),l=Tx(a,n.floating);return{data:{escapedOffsets:l,escaped:Ox(l)}}}default:return{}}}}},Nx=new Set(["left","top"]);async function D8(t,e){const{placement:n,platform:i,elements:o}=t,s=await(i.isRTL==null?void 0:i.isRTL(o.floating)),a=wr(n),l=kg(n),C=Io(n)==="y",c=Nx.has(a)?-1:1,u=s&&C?-1:1,h=Zo(e,t);let{mainAxis:m,crossAxis:v,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof b=="number"&&(v=l==="end"?b*-1:b),C?{x:v*u,y:m*c}:{x:m*c,y:v*u}}const _8=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:o,y:s,placement:a,middlewareData:l}=e,C=await D8(e,t);return a===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:o+C.x,y:s+C.y,data:{...C,placement:a}}}}},j8=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:o,platform:s}=e,{mainAxis:a=!0,crossAxis:l=!1,limiter:C={fn:T=>{let{x:O,y:M}=T;return{x:O,y:M}}},...c}=Zo(t,e),u={x:n,y:i},h=await s.detectOverflow(e,c),m=Io(o),v=ih(m);let b=u[v],x=u[m];const y=(T,O)=>bx(O+h[T==="y"?"top":"left"],O,O-h[T==="y"?"bottom":"right"]);a&&(b=y(v,b)),l&&(x=y(m,x));const S=C.fn({...e,[v]:b,[m]:x});return{...S,data:{x:S.x-n,y:S.y-i,enabled:{[v]:a,[m]:l}}}}}},z8=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,i;const{x:o,y:s,placement:a,rects:l,middlewareData:C}=e,{offset:c=0,mainAxis:u=!0,crossAxis:h=!0}=Zo(t,e),m={x:o,y:s},v=Io(a),b=ih(v);let x=m[b],y=m[v];const S=Zo(c,e),T=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:(n=S.mainAxis)!=null?n:0,crossAxis:(i=S.crossAxis)!=null?i:0};if(u){const k=b==="y"?"height":"width",G=l.reference[b]-l.floating[k]+T.mainAxis,L=l.reference[b]+l.reference[k]-T.mainAxis;xL&&(x=L)}if(h){var O,M;const k=b==="y"?"width":"height",G=Nx.has(wr(a)),L=l.reference[v]-l.floating[k]+(G&&((O=C.offset)==null?void 0:O[v])||0)+(G?0:T.crossAxis),F=l.reference[v]+l.reference[k]+(G?0:((M=C.offset)==null?void 0:M[v])||0)-(G?T.crossAxis:0);yF&&(y=F)}return{[b]:x,[v]:y}}}},P8=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){const{placement:n,rects:i,platform:o,elements:s}=e,{apply:a=()=>{},...l}=Zo(t,e),C=await o.detectOverflow(e,l),c=wr(n),u=kg(n),h=Io(n)==="y",{width:m,height:v}=i.floating;let b,x;c==="top"||c==="bottom"?(b=c,x=u===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(x=c,b=u==="end"?"top":"bottom");const y=v-C.top-C.bottom,S=m-C.left-C.right,T=br(v-C[b],y),O=br(m-C[x],S),M=e.middlewareData.shift,k=!M;let G=T,L=O;M!=null&&M.enabled.x&&(L=S),M!=null&&M.enabled.y&&(G=y),k&&!u&&(h?L=m-2*Lo(C.left,C.right):G=v-2*Lo(C.top,C.bottom)),await a({...e,availableWidth:L,availableHeight:G});const F=await o.getDimensions(s.floating);return m!==F.width||v!==F.height?{reset:{rects:!0}}:{}}}};function eI(){return typeof window<"u"}function Dg(t){return Mx(t)?(t.nodeName||"").toLowerCase():"#document"}function ri(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Go(t){var e;return(e=(Mx(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Mx(t){return eI()?t instanceof Node||t instanceof ri(t).Node:!1}function co(t){return eI()?t instanceof Element||t instanceof ri(t).Element:!1}function xr(t){return eI()?t instanceof HTMLElement||t instanceof ri(t).HTMLElement:!1}function Rx(t){return!eI()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ri(t).ShadowRoot}function tI(t){const{overflow:e,overflowX:n,overflowY:i,display:o}=uo(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&o!=="inline"&&o!=="contents"}function L8(t){return/^(table|td|th)$/.test(Dg(t))}function nI(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const B8=/transform|translate|scale|rotate|perspective|filter/,Z8=/paint|layout|strict|content/,ws=t=>!!t&&t!=="none";let gh;function ah(t){const e=co(t)?uo(t):t;return ws(e.transform)||ws(e.translate)||ws(e.scale)||ws(e.rotate)||ws(e.perspective)||!Ah()&&(ws(e.backdropFilter)||ws(e.filter))||B8.test(e.willChange||"")||Z8.test(e.contain||"")}function G8(t){let e=xs(t);for(;xr(e)&&!hA(e);){if(ah(e))return e;if(nI(e))return null;e=xs(e)}return null}function Ah(){return gh==null&&(gh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),gh}function hA(t){return/^(html|body|#document)$/.test(Dg(t))}function uo(t){return ri(t).getComputedStyle(t)}function iI(t){return co(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function xs(t){if(Dg(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Rx(t)&&t.host||Go(t);return Rx(e)?e.host:e}function kx(t){const e=xs(t);return hA(e)?(t.ownerDocument||t).body:xr(e)&&tI(e)?e:kx(e)}function fA(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=kx(t),s=o===((i=t.ownerDocument)==null?void 0:i.body),a=ri(o);if(s){const l=lh(a);return e.concat(a,a.visualViewport||[],tI(o)?o:[],l&&n?fA(l):[])}else return e.concat(o,fA(o,[],n))}function lh(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Dx(t){const e=uo(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const o=xr(t),s=o?t.offsetWidth:n,a=o?t.offsetHeight:i,l=XC(n)!==s||XC(i)!==a;return l&&(n=s,i=a),{width:n,height:i,$:l}}function Ch(t){return co(t)?t:t.contextElement}function _g(t){const e=Ch(t);if(!xr(e))return Bo(1);const n=e.getBoundingClientRect(),{width:i,height:o,$:s}=Dx(e);let a=(s?XC(n.width):n.width)/i,l=(s?XC(n.height):n.height)/o;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const F8=Bo(0);function _x(t){const e=ri(t);return!Ah()||!e.visualViewport?F8:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function V8(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===ri(t)}function Ss(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),s=Ch(t);let a=Bo(1);e&&(i?co(i)&&(a=_g(i)):a=_g(t));const l=V8(s,n,i)?_x(s):Bo(0);let C=(o.left+l.x)/a.x,c=(o.top+l.y)/a.y,u=o.width/a.x,h=o.height/a.y;if(s&&i){const m=ri(s),v=co(i)?ri(i):i;let b=m,x=lh(b);for(;x&&v!==b;){const y=_g(x),S=x.getBoundingClientRect(),T=uo(x),O=S.left+(x.clientLeft+parseFloat(T.paddingLeft))*y.x,M=S.top+(x.clientTop+parseFloat(T.paddingTop))*y.y;C*=y.x,c*=y.y,u*=y.x,h*=y.y,C+=O,c+=M,b=ri(x),x=lh(b)}}return JC({width:u,height:h,x:C,y:c})}function oI(t,e){const n=iI(t).scrollLeft;return e?e.left+n:Ss(Go(t)).left+n}function jx(t,e){const n=t.getBoundingClientRect(),i=n.left+e.scrollLeft-oI(t,n),o=n.top+e.scrollTop;return{x:i,y:o}}function U8(t){let{elements:e,rect:n,offsetParent:i,strategy:o}=t;const s=o==="fixed",a=Go(i),l=e?nI(e.floating):!1;if(i===a||l&&s)return n;let C={scrollLeft:0,scrollTop:0},c=Bo(1);const u=Bo(0),h=xr(i);if((h||!s)&&((Dg(i)!=="body"||tI(a))&&(C=iI(i)),h)){const v=Ss(i);c=_g(i),u.x=v.x+i.clientLeft,u.y=v.y+i.clientTop}const m=a&&!h&&!s?jx(a,C):Bo(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-C.scrollLeft*c.x+u.x+m.x,y:n.y*c.y-C.scrollTop*c.y+u.y+m.y}}function H8(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function Y8(t){const e=iI(t),n=t.ownerDocument.body,i=Lo(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Lo(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let s=-e.scrollLeft+oI(t);const a=-e.scrollTop;return uo(n).direction==="rtl"&&(s+=Lo(t.clientWidth,n.clientWidth)-i),{width:i,height:o,x:s,y:a}}const $8=25;function W8(t,e,n){n===void 0&&(n="viewport");const i=n==="layoutViewport",o=ri(t),s=Go(t),a=o.visualViewport;let l=s.clientWidth,C=s.clientHeight,c=0,u=0;if(a){const m=!Ah()||e==="fixed";i?m||(c=-a.offsetLeft,u=-a.offsetTop):(l=a.width,C=a.height,m&&(c=a.offsetLeft,u=a.offsetTop))}if(oI(s)<=0){const m=s.ownerDocument,v=m.body,b=getComputedStyle(v),x=m.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,y=Math.abs(s.clientWidth-v.clientWidth-x),S=getComputedStyle(s).scrollbarGutter==="stable both-edges"?y/2:y;S<=$8&&(l-=S)}return{width:l,height:C,x:c,y:u}}function K8(t,e){const n=Ss(t,!0,e==="fixed"),i=n.top+t.clientTop,o=n.left+t.clientLeft,s=_g(t),a=t.clientWidth*s.x,l=t.clientHeight*s.y,C=o*s.x,c=i*s.y;return{width:a,height:l,x:C,y:c}}function zx(t,e,n){let i;if(e==="viewport"||e==="layoutViewport")i=W8(t,n,e);else if(e==="document")i=Y8(Go(t));else if(co(e))i=K8(e,n);else{const o=_x(t);i={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return JC(i)}function X8(t,e){const n=e.get(t);if(n)return n;let i=fA(t,[],!1).filter(l=>co(l)&&Dg(l)!=="body"),o=null;const s=uo(t).position==="fixed";let a=s?xs(t):t;for(;co(a)&&!hA(a);){const l=uo(a),C=ah(a),c=o?o.position:s?"fixed":"";!C&&(c==="fixed"||c==="absolute"&&l.position==="static")?i=i.filter(h=>h!==a):o=l,a=xs(a)}return e.set(t,i),i}function Q8(t){let{element:e,boundary:n,rootBoundary:i,strategy:o}=t;const a=[...n==="clippingAncestors"?nI(e)?[]:X8(e,this._c):[].concat(n),i],l=zx(e,a[0],o);let C=l.top,c=l.right,u=l.bottom,h=l.left;for(let m=1;m{l(!1,1e-7)},1e3)}L=!1}try{i=new IntersectionObserver(F,{...G,root:s.ownerDocument})}catch{i=new IntersectionObserver(F,G)}i.observe(t)}const C=ri(t),c=()=>l(n);return C.addEventListener("resize",c),l(!0),()=>{C.removeEventListener("resize",c),a()}}function oG(t,e,n,i){i===void 0&&(i={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:C=!1}=i,c=Ch(t),u=o||s?[...c?fA(c):[],...e?fA(e):[]]:[];u.forEach(S=>{o&&S.addEventListener("scroll",n),s&&S.addEventListener("resize",n)});const h=c&&l?iG(c,n,s):null;let m=-1,v=null;a&&(v=new ResizeObserver(S=>{let[T]=S;T&&T.target===c&&v&&e&&(v.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var O;(O=v)==null||O.observe(e)})),n()}),c&&!C&&v.observe(c),e&&v.observe(e));let b,x=C?Ss(t):null;C&&y();function y(){const S=Ss(t);x&&!Bx(x,S)&&n(),x=S,b=requestAnimationFrame(y)}return n(),()=>{var S;u.forEach(T=>{o&&T.removeEventListener("scroll",n),s&&T.removeEventListener("resize",n)}),h?.(),(S=v)==null||S.disconnect(),v=null,C&&cancelAnimationFrame(b)}}const rG=_8,sG=j8,gG=R8,aG=P8,AG=k8,Zx=M8,lG=z8,CG=(t,e,n)=>{const i=new Map,o=n??{},s={...nG,...o.platform,_c:i};return N8(t,e,{...o,platform:s})};var IG=typeof document<"u",cG=function(){},rI=IG?E.useLayoutEffect:cG;function sI(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,i,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!sI(t[i],e[i]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(e,o[i]))return!1;for(i=n;i--!==0;){const s=o[i];if(!(s==="_owner"&&t.$$typeof)&&!sI(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Gx(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Fx(t,e){const n=Gx(t);return Math.round(e*n)/n}function ch(t){const e=E.useRef(t);return rI(()=>{e.current=t}),e}function dG(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:o,elements:{reference:s,floating:a}={},transform:l=!0,whileElementsMounted:C,open:c}=t,[u,h]=E.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,v]=E.useState(i);sI(m,i)||v(i);const[b,x]=E.useState(null),[y,S]=E.useState(null),T=E.useCallback(Q=>{Q!==G.current&&(G.current=Q,x(Q))},[]),O=E.useCallback(Q=>{Q!==L.current&&(L.current=Q,S(Q))},[]),M=s||b,k=a||y,G=E.useRef(null),L=E.useRef(null),F=E.useRef(u),re=C!=null,pe=ch(C),ie=ch(o),J=ch(c),ve=E.useCallback(()=>{if(!G.current||!L.current)return;const Q={placement:e,strategy:n,middleware:m};ie.current&&(Q.platform=ie.current),CG(G.current,L.current,Q).then(le=>{const X={...le,isPositioned:J.current!==!1};me.current&&!sI(F.current,X)&&(F.current=X,bs.flushSync(()=>{h(X)}))})},[m,e,n,ie,J]);rI(()=>{c===!1&&F.current.isPositioned&&(F.current.isPositioned=!1,h(Q=>({...Q,isPositioned:!1})))},[c]);const me=E.useRef(!1);rI(()=>(me.current=!0,()=>{me.current=!1}),[]),rI(()=>{if(M&&(G.current=M),k&&(L.current=k),M&&k){if(pe.current)return pe.current(M,k,ve);ve()}},[M,k,ve,pe,re]);const ue=E.useMemo(()=>({reference:G,floating:L,setReference:T,setFloating:O}),[T,O]),z=E.useMemo(()=>({reference:M,floating:k}),[M,k]),U=E.useMemo(()=>{const Q={position:n,left:0,top:0};if(!z.floating)return Q;const le=Fx(z.floating,u.x),X=Fx(z.floating,u.y);return l?{...Q,transform:"translate("+le+"px, "+X+"px)",...Gx(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:le,top:X}},[n,l,z.floating,u.x,u.y]);return E.useMemo(()=>({...u,update:ve,refs:ue,elements:z,floatingStyles:U}),[u,ve,ue,z,U])}const uG=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:i,padding:o}=typeof t=="function"?t(n):t;return i&&e(i)?i.current!=null?Zx({element:i.current,padding:o}).fn(n):{}:i?Zx({element:i,padding:o}).fn(n):{}}}},hG=(t,e)=>{const n=rG(t);return{name:n.name,fn:n.fn,options:[t,e]}},fG=(t,e)=>{const n=sG(t);return{name:n.name,fn:n.fn,options:[t,e]}},pG=(t,e)=>({fn:lG(t).fn,options:[t,e]}),mG=(t,e)=>{const n=gG(t);return{name:n.name,fn:n.fn,options:[t,e]}},vG=(t,e)=>{const n=aG(t);return{name:n.name,fn:n.fn,options:[t,e]}},yG=(t,e)=>{const n=AG(t);return{name:n.name,fn:n.fn,options:[t,e]}},bG=(t,e)=>{const n=uG(t);return{name:n.name,fn:n.fn,options:[t,e]}};var wG=Object.defineProperty,Sr=(t,e)=>wG(t,"name",{value:e,configurable:!0}),Vx="Popper",[Ux,Hx]=dA(Vx),[xG,Yx]=Ux(Vx),SG=Sr(t=>{const{__scopePopper:e,children:n}=t,[i,o]=E.useState(null),[s,a]=E.useState(void 0);return d.jsx(xG,{scope:e,anchor:i,onAnchorChange:o,placementState:s,setPlacementState:a,children:n})},"Popper"),EG="PopperAnchor",TG=E.forwardRef(Sr(function(e,n){const{__scopePopper:i,virtualRef:o,...s}=e,a=Yx(EG,i),l=E.useRef(null),C=a.onAnchorChange,c=E.useCallback(x=>{l.current=x,x&&C(x)},[C]),u=en(n,c),h=E.useRef(null);E.useEffect(()=>{if(!o)return;const x=h.current;h.current=o.current,x!==h.current&&C(h.current)});const m=a.placementState&&gI(a.placementState),v=m?.[0],b=m?.[1];return o?null:d.jsx(Yn.div,{"data-radix-popper-side":v,"data-radix-popper-align":b,...s,ref:u})},"PopperAnchor")),$x="PopperContent",[OG,Fhe]=Ux($x),NG=E.forwardRef(Sr(function(e,n){const{__scopePopper:i,side:o="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:C=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:h=0,sticky:m="partial",hideWhenDetached:v=!1,updatePositionStrategy:b="optimized",onPlaced:x,...y}=e,S=Yx($x,i),[T,O]=E.useState(null),M=en(n,O),[k,G]=E.useState(null),L=yx(k),F=L?.width??0,re=L?.height??0,pe=o+(a!=="center"?"-"+a:""),ie=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},J=Array.isArray(u)?u:[u],ve=J.length>0,me={padding:ie,boundary:J.filter(Wx),altBoundary:ve},{refs:ue,floatingStyles:z,placement:U,isPositioned:Q,middlewareData:le}=dG({strategy:"fixed",placement:pe,whileElementsMounted:Sr((...ae)=>oG(...ae,{animationFrame:b==="always"}),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[hG({mainAxis:s+re,alignmentAxis:l}),c&&fG({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?pG():void 0,...me}),c&&mG({...me}),vG({...me,apply:Sr(({elements:ae,rects:xe,availableWidth:Re,availableHeight:j})=>{const{width:ce,height:Se}=xe.reference,_e=ae.floating.style;_e.setProperty("--radix-popper-available-width",`${Re}px`),_e.setProperty("--radix-popper-available-height",`${j}px`),_e.setProperty("--radix-popper-anchor-width",`${ce}px`),_e.setProperty("--radix-popper-anchor-height",`${Se}px`)},"apply")}),k&&bG({element:k,padding:C}),MG({arrowWidth:F,arrowHeight:re}),v&&yG({strategy:"referenceHidden",...me,boundary:ve?me.boundary:void 0})]}),X=S.setPlacementState;Sn(()=>(X(U),()=>{X(void 0)}),[U,X]);const[R,D]=gI(U),H=lo(x);Sn(()=>{Q&&H?.()},[Q,H]);const se=le.arrow?.x,de=le.arrow?.y,be=le.arrow?.centerOffset!==0,[Me,ge]=E.useState();return Sn(()=>{T&&ge(window.getComputedStyle(T).zIndex)},[T]),d.jsx("div",{ref:ue.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:Q?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Me,"--radix-popper-transform-origin":[le.transformOrigin?.x,le.transformOrigin?.y].join(" "),...le.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(OG,{scope:i,placedSide:R,placedAlign:D,onArrowChange:G,arrowX:se,arrowY:de,shouldHideArrow:be,children:d.jsx(Yn.div,{"data-side":R,"data-align":D,...y,ref:M,style:{...y.style,animation:Q?y.style?.animation:"none"}})})})},"PopperContent"));function Wx(t){return t!==null}Sr(Wx,"isNotNull");var MG=Sr(t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:i,middlewareData:o}=e,a=o.arrow?.centerOffset!==0,l=a?0:t.arrowWidth,C=a?0:t.arrowHeight,[c,u]=gI(n),h={start:"0%",center:"50%",end:"100%"}[u],m=(o.arrow?.x??0)+l/2,v=(o.arrow?.y??0)+C/2;let b="",x="";return c==="bottom"?(b=a?h:`${m}px`,x=`${-C}px`):c==="top"?(b=a?h:`${m}px`,x=`${i.floating.height+C}px`):c==="right"?(b=`${-C}px`,x=a?h:`${v}px`):c==="left"&&(b=`${i.floating.width+C}px`,x=a?h:`${v}px`),{data:{x:b,y:x}}}}),"transformOrigin");function gI(t){const[e,n="center"]=t.split("-");return[e,n]}Sr(gI,"getSideAndAlignFromPlacement");var RG=SG,kG=TG,DG=NG,_G=Object.defineProperty,jG=(t,e)=>_G(t,"name",{value:e,configurable:!0});function Kx(t){const e=E.useRef({value:t,previous:t});return E.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}jG(Kx,"usePrevious");var zG=Object.defineProperty,PG=(t,e)=>zG(t,"name",{value:e,configurable:!0});function dh(t,[e,n]){return Math.min(n,Math.max(e,t))}PG(dh,"clamp");var LG=Object.defineProperty,Ct=(t,e)=>LG(t,"name",{value:e,configurable:!0}),BG=[" ","Enter","ArrowUp","ArrowDown"],ZG=[" ","Enter"],jg="Select",[aI,AI,GG]=Nw(jg),[Es,Vhe]=dA(jg,[GG,Hx]),uh=Hx(),[FG,Er]=Es(jg),[VG,UG]=Es(jg);function Xx(t){const{__scopeSelect:e,children:n,open:i,defaultOpen:o,onOpenChange:s,value:a,defaultValue:l,onValueChange:C,dir:c,name:u,autoComplete:h,disabled:m,required:v,form:b,internal_do_not_use_render:x}=t,y=uh(e),[S,T]=E.useState(null),[O,M]=E.useState(null),[k,G]=E.useState(!1),L=Ww(c),[F,re]=Lu({prop:i,defaultProp:o??!1,onChange:s,caller:jg}),[pe,ie]=Lu({prop:a,defaultProp:l,onChange:C,caller:jg}),J=E.useRef(null),ve=E.useRef(pe);E.useEffect(()=>{const D=b?S?.ownerDocument.getElementById(b):S?.form;if(D instanceof HTMLFormElement){const H=Ct(()=>ie(ve.current),"reset");return D.addEventListener("reset",H),()=>D.removeEventListener("reset",H)}},[b,S,ie]);const me=S?!!b||!!S.closest("form"):!0,[ue,z]=E.useState(new Set),U=Zu(),Q=Array.from(ue).map(D=>D.props.value).join(";"),le=E.useCallback(D=>{z(H=>new Set(H).add(D))},[]),X=E.useCallback(D=>{z(H=>{const se=new Set(H);return se.delete(D),se})},[]),R={required:v,trigger:S,onTriggerChange:T,valueNode:O,onValueNodeChange:M,valueNodeHasChildren:k,onValueNodeHasChildrenChange:G,contentId:U,value:pe,onValueChange:ie,open:F,onOpenChange:re,dir:L,triggerPointerDownPosRef:J,disabled:m,name:u,autoComplete:h,form:b,nativeOptions:ue,nativeSelectKey:Q,isFormControl:me};return d.jsx(RG,{...y,children:d.jsx(FG,{scope:e,...R,children:d.jsx(aI.Provider,{scope:e,children:d.jsx(VG,{scope:e,onNativeOptionAdd:le,onNativeOptionRemove:X,children:o1(x)?x(R):n})})})})}Ct(Xx,"SelectProvider");var HG=Ct(t=>{const{__scopeSelect:e,children:n,...i}=t;return d.jsx(Xx,{__scopeSelect:e,...i,internal_do_not_use_render:({isFormControl:o})=>d.jsxs(d.Fragment,{children:[n,o?d.jsx(fF,{__scopeSelect:e}):null]})})},"Select"),YG="SelectTrigger",$G=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,disabled:o=!1,...s}=e,a=uh(i),l=Er(YG,i),C=l.disabled||o,c=en(n,l.onTriggerChange),u=AI(i),h=E.useRef("touch"),[m,v,b]=ph(y=>{const S=u().filter(M=>!M.disabled),T=S.find(M=>M.value===l.value),O=mh(S,y,T);O!==void 0&&l.onValueChange(O.value)}),x=Ct(y=>{C||(l.onOpenChange(!0),b()),y&&(l.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)})},"handleOpen");return d.jsx(kG,{asChild:!0,...a,children:d.jsx(Yn.button,{type:"button",role:"combobox","aria-controls":l.open?l.contentId:void 0,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:C,"data-disabled":C?"":void 0,"data-placeholder":pA(l.value)?"":void 0,...s,ref:c,onClick:tn(s.onClick,y=>{y.currentTarget.focus(),h.current!=="mouse"&&x(y)}),onPointerDown:tn(s.onPointerDown,y=>{h.current=y.pointerType;const S=y.target;S.hasPointerCapture(y.pointerId)&&S.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&y.pointerType==="mouse"&&(x(y),y.preventDefault())}),onKeyDown:tn(s.onKeyDown,y=>{const S=m.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&v(y.key),!(S&&y.key===" ")&&BG.includes(y.key)&&(x(),y.preventDefault())})})})},"SelectTrigger")),WG="SelectValue",KG=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,className:o,style:s,children:a,placeholder:l="",...C}=e,c=Er(WG,i),{onValueNodeHasChildrenChange:u}=c,h=a!==void 0,m=en(n,c.onValueNodeChange);Sn(()=>{u(h)},[u,h]);const v=pA(c.value);return d.jsx(Yn.span,{...C,asChild:v?!1:C.asChild,ref:m,style:{pointerEvents:"none"},children:d.jsx(E.Fragment,{children:v?l:a},v?"placeholder":"value")})},"SelectValue")),XG=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,children:o,...s}=e;return d.jsx(Yn.span,{"aria-hidden":!0,...s,ref:n,children:o||"▼"})},"SelectIcon")),QG="SelectPortal",[qG,JG]=Es(QG,{forceMount:void 0}),eF=Ct(t=>{const{__scopeSelect:e,forceMount:n,...i}=t;return d.jsx(qG,{scope:t.__scopeSelect,forceMount:n,children:d.jsx(T6,{asChild:!0,...i})})},"SelectPortal"),Ts="SelectContent",tF=E.forwardRef(Ct(function(e,n){const i=JG(Ts,e.__scopeSelect),{forceMount:o=i.forceMount,...s}=e,a=Er(Ts,e.__scopeSelect),[l,C]=E.useState();return Sn(()=>{C(new DocumentFragment)},[]),d.jsx(g6,{present:o||a.open,children:({present:c})=>c?d.jsx(oF,{...s,ref:n}):d.jsx(nF,{...s,fragment:l})})},"SelectContent")),nF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,children:o,fragment:s}=e;return s?bs.createPortal(d.jsx(Qx,{scope:i,children:d.jsx(aI.Slot,{scope:i,children:d.jsx("div",{ref:n,children:o})})}),s):null},"SelectContentFragment")),$i=10,[Qx,Os]=Es(Ts),iF=yr("SelectContent.RemoveScroll"),oF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i}=e,{position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:l,side:C,sideOffset:c,align:u,alignOffset:h,arrowPadding:m,collisionBoundary:v,collisionPadding:b,sticky:x,hideWhenDetached:y,avoidCollisions:S,...T}=e,O=Er(Ts,i),[M,k]=E.useState(null),[G,L]=E.useState(null),F=en(n,k),[re,pe]=E.useState(null),[ie,J]=E.useState(null),ve=AI(i),[me,ue]=E.useState(!1),z=E.useRef(!1);E.useEffect(()=>{if(M)return u8(M)},[M]),Xu();const U=E.useCallback(ge=>{const[ae,...xe]=ve().map(ce=>ce.ref.current),[Re]=xe.slice(-1),j=document.activeElement;for(const ce of ge)if(ce===j||(ce?.scrollIntoView({block:"nearest"}),ce===ae&&G&&(G.scrollTop=0),ce===Re&&G&&(G.scrollTop=G.scrollHeight),ce?.focus(),document.activeElement!==j))return},[ve,G]),Q=E.useCallback(()=>U([re,M]),[U,re,M]);E.useEffect(()=>{me&&Q()},[me,Q]);const{onOpenChange:le,triggerPointerDownPosRef:X}=O;E.useEffect(()=>{if(M){let ge={x:0,y:0};const ae=Ct(Re=>{ge={x:Math.abs(Math.round(Re.pageX)-(X.current?.x??0)),y:Math.abs(Math.round(Re.pageY)-(X.current?.y??0))}},"handlePointerMove"),xe=Ct(Re=>{ge.x<=10&&ge.y<=10?Re.preventDefault():Re.composedPath().includes(M)||le(!1),document.removeEventListener("pointermove",ae),X.current=null},"handlePointerUp");return X.current!==null&&(document.addEventListener("pointermove",ae),document.addEventListener("pointerup",xe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ae),document.removeEventListener("pointerup",xe,{capture:!0})}}},[M,le,X]),E.useEffect(()=>{const ge=Ct(()=>le(!1),"close");return window.addEventListener("blur",ge),window.addEventListener("resize",ge),()=>{window.removeEventListener("blur",ge),window.removeEventListener("resize",ge)}},[le]);const[R,D]=ph(ge=>{const ae=ve().filter(j=>!j.disabled),xe=ae.find(j=>j.ref.current===document.activeElement),Re=mh(ae,ge,xe);Re&&setTimeout(()=>Re.ref.current?.focus())}),H=E.useCallback((ge,ae,xe)=>{const Re=!z.current&&!xe;(O.value!==void 0&&O.value===ae||Re)&&(pe(ge),Re&&(z.current=!0))},[O.value]),se=E.useCallback(()=>M?.focus(),[M]),de=E.useCallback((ge,ae,xe)=>{const Re=!z.current&&!xe;(O.value!==void 0&&O.value===ae||Re)&&J(ge)},[O.value]),be=o==="popper"?qx:rF,Me=be===qx?{side:C,sideOffset:c,align:u,alignOffset:h,arrowPadding:m,collisionBoundary:v,collisionPadding:b,sticky:x,hideWhenDetached:y,avoidCollisions:S}:{};return d.jsx(Qx,{scope:i,content:M,viewport:G,onViewportChange:L,itemRefCallback:H,selectedItem:re,onItemLeave:se,itemTextRefCallback:de,focusSelectedItem:Q,selectedItemText:ie,position:o,isPositioned:me,searchRef:R,children:d.jsx(mx,{as:iF,allowPinchZoom:!0,children:d.jsx(x6,{asChild:!0,trapped:O.open,onMountAutoFocus:ge=>{ge.preventDefault()},onUnmountAutoFocus:tn(s,ge=>{O.trigger?.focus({preventScroll:!0}),ge.preventDefault()}),children:d.jsx(v6,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:ge=>ge.preventDefault(),onDismiss:()=>O.onOpenChange(!1),children:d.jsx(be,{role:"listbox",id:O.contentId,"data-state":O.open?"open":"closed",dir:O.dir,onContextMenu:ge=>ge.preventDefault(),...T,...Me,onPlaced:()=>ue(!0),ref:F,style:{display:"flex",flexDirection:"column",outline:"none",...T.style},onKeyDown:tn(T.onKeyDown,ge=>{const ae=ge.ctrlKey||ge.altKey||ge.metaKey;if(ge.key==="Tab"&&ge.preventDefault(),!ae&&ge.key.length===1&&D(ge.key),["ArrowUp","ArrowDown","Home","End"].includes(ge.key)){let Re=ve().filter(j=>!j.disabled).map(j=>j.ref.current);if(["ArrowUp","End"].includes(ge.key)&&(Re=Re.slice().reverse()),["ArrowUp","ArrowDown"].includes(ge.key)){const j=ge.target,ce=Re.indexOf(j);Re=Re.slice(ce+1)}setTimeout(()=>U(Re)),ge.preventDefault()}})})})})})})},"SelectContentImpl")),rF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,onPlaced:o,...s}=e,a=Er(Ts,i),l=Os(Ts,i),[C,c]=E.useState(null),[u,h]=E.useState(null),m=en(n,h),v=AI(i),b=E.useRef(!1),x=E.useRef(!0),{viewport:y,selectedItem:S,selectedItemText:T,focusSelectedItem:O}=l,M=E.useCallback(()=>{if(a.trigger&&a.valueNode&&C&&u&&y&&S&&T){const F=a.trigger.getBoundingClientRect(),re=u.getBoundingClientRect(),pe=a.valueNode.getBoundingClientRect(),ie=T.getBoundingClientRect();if(a.dir!=="rtl"){const j=ie.left-re.left,ce=pe.left-j,Se=F.left-ce,_e=F.width+Se,gt=Math.max(_e,re.width),Et=window.innerWidth-$i,ot=dh(ce,[$i,Math.max($i,Et-gt)]);C.style.minWidth=_e+"px",C.style.left=ot+"px"}else{const j=re.right-ie.right,ce=window.innerWidth-pe.right-j,Se=window.innerWidth-F.right-ce,_e=F.width+Se,gt=Math.max(_e,re.width),Et=window.innerWidth-$i,ot=dh(ce,[$i,Math.max($i,Et-gt)]);C.style.minWidth=_e+"px",C.style.right=ot+"px"}const J=v(),ve=window.innerHeight-$i*2,me=y.scrollHeight,ue=window.getComputedStyle(u),z=parseInt(ue.borderTopWidth,10),U=parseInt(ue.paddingTop,10),Q=parseInt(ue.borderBottomWidth,10),le=parseInt(ue.paddingBottom,10),X=z+U+me+le+Q,R=Math.min(S.offsetHeight*5,X),D=window.getComputedStyle(y),H=parseInt(D.paddingTop,10),se=parseInt(D.paddingBottom,10),de=F.top+F.height/2-$i,be=ve-de,Me=S.offsetHeight/2,ge=S.offsetTop+Me,ae=z+U+ge,xe=X-ae;if(ae<=de){const j=J.length>0&&S===J[J.length-1].ref.current;C.style.bottom="0px";const ce=u.clientHeight-y.offsetTop-y.offsetHeight,Se=Math.max(be,Me+(j?se:0)+ce+Q),_e=ae+Se;C.style.height=_e+"px"}else{const j=J.length>0&&S===J[0].ref.current;C.style.top="0px";const Se=Math.max(de,z+y.offsetTop+(j?H:0)+Me)+xe;C.style.height=Se+"px",y.scrollTop=ae-de+y.offsetTop}C.style.margin=`${$i}px 0`,C.style.minHeight=R+"px",C.style.maxHeight=ve+"px",o?.(),requestAnimationFrame(()=>b.current=!0)}},[v,a.trigger,a.valueNode,C,u,y,S,T,a.dir,o]);Sn(()=>M(),[M]);const[k,G]=E.useState();Sn(()=>{u&&G(window.getComputedStyle(u).zIndex)},[u]);const L=E.useCallback(F=>{F&&x.current===!0&&(M(),O?.(),x.current=!1)},[M,O]);return d.jsx(sF,{scope:i,contentWrapper:C,shouldExpandOnScrollRef:b,onScrollButtonChange:L,children:d.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:d.jsx(Yn.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})},"SelectItemAlignedPosition")),qx=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,align:o="start",collisionPadding:s=$i,...a}=e,l=uh(i);return d.jsx(DG,{...l,...a,ref:n,align:o,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})},"SelectPopperPosition")),[sF,hh]=Es(Ts,{}),Jx="SelectViewport",gF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,nonce:o,...s}=e,a=Os(Jx,i),l=hh(Jx,i),C=en(n,a.onViewportChange),c=E.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(aI.Slot,{scope:i,children:d.jsx(Yn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:C,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:tn(s.onScroll,u=>{const h=u.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:v}=l;if(v?.current&&m){const b=Math.abs(c.current-h.scrollTop);if(b>0){const x=window.innerHeight-$i*2,y=parseFloat(m.style.minHeight),S=parseFloat(m.style.height),T=Math.max(y,S);if(T0?k:0,m.style.justifyContent="flex-end")}}}c.current=h.scrollTop})})})]})},"SelectViewport")),aF="SelectGroup",[Uhe,Hhe]=Es(aF),fh="SelectItem",[AF,e1]=Es(fh),lF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,value:o,disabled:s=!1,textValue:a,...l}=e,C=Er(fh,i),c=Os(fh,i),u=C.value===o,[h,m]=E.useState(a??""),[v,b]=E.useState(!1),x=lo(M=>c.itemRefCallback?.(M,o,s)),y=en(n,x),S=Zu(),T=E.useRef("touch"),O=Ct(()=>{s||(C.onValueChange(o),C.onOpenChange(!1))},"handleSelect");return d.jsx(AF,{scope:i,value:o,disabled:s,textId:S,isSelected:u,onItemTextChange:E.useCallback(M=>{m(k=>k||(M?.textContent??"").trim())},[]),children:d.jsx(aI.ItemSlot,{scope:i,value:o,disabled:s,textValue:h,children:d.jsx(Yn.div,{role:"option","aria-labelledby":S,"data-highlighted":v?"":void 0,"aria-selected":u&&v,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...l,ref:y,onFocus:tn(l.onFocus,()=>b(!0)),onBlur:tn(l.onBlur,()=>b(!1)),onClick:tn(l.onClick,()=>{T.current!=="mouse"&&O()}),onPointerUp:tn(l.onPointerUp,()=>{T.current==="mouse"&&O()}),onPointerDown:tn(l.onPointerDown,M=>{T.current=M.pointerType}),onPointerMove:tn(l.onPointerMove,M=>{T.current=M.pointerType,s?c.onItemLeave?.():T.current==="mouse"&&M.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tn(l.onPointerLeave,M=>{M.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:tn(l.onKeyDown,M=>{s||M.target!==M.currentTarget||c.searchRef?.current!==""&&M.key===" "||(ZG.includes(M.key)&&O(),M.key===" "&&M.preventDefault())})})})})},"SelectItem")),lI="SelectItemText",CF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,className:o,style:s,...a}=e,l=Er(lI,i),C=Os(lI,i),c=e1(lI,i),u=UG(lI,i),[h,m]=E.useState(null),v=lo(O=>C.itemTextRefCallback?.(O,c.value,c.disabled)),b=en(n,m,c.onItemTextChange,v),x=h?.textContent,y=E.useMemo(()=>d.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:S,onNativeOptionRemove:T}=u;return Sn(()=>(S(y),()=>T(y)),[S,T,y]),d.jsxs(d.Fragment,{children:[d.jsx(Yn.span,{id:c.textId,...a,ref:b}),c.isSelected&&l.valueNode&&!l.valueNodeHasChildren&&!pA(l.value)?bs.createPortal(a.children,l.valueNode):null]})},"SelectItemText")),IF="SelectItemIndicator",cF=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,...o}=e;return e1(IF,i).isSelected?d.jsx(Yn.span,{"aria-hidden":!0,...o,ref:n}):null},"SelectItemIndicator")),t1="SelectScrollUpButton",dF=E.forwardRef(Ct(function(e,n){const i=Os(t1,e.__scopeSelect),o=hh(t1,e.__scopeSelect),[s,a]=E.useState(!1),l=en(n,o.onScrollButtonChange);return Sn(()=>{if(i.viewport&&i.isPositioned){let C=function(){const u=c.scrollTop>0;a(u)};Ct(C,"handleScroll");const c=i.viewport;return C(),c.addEventListener("scroll",C),()=>c.removeEventListener("scroll",C)}},[i.viewport,i.isPositioned]),s?d.jsx(i1,{...e,ref:l,onAutoScroll:()=>{const{viewport:C,selectedItem:c}=i;C&&c&&(C.scrollTop=C.scrollTop-c.offsetHeight)}}):null},"SelectScrollUpButton")),n1="SelectScrollDownButton",uF=E.forwardRef(Ct(function(e,n){const i=Os(n1,e.__scopeSelect),o=hh(n1,e.__scopeSelect),[s,a]=E.useState(!1),l=en(n,o.onScrollButtonChange);return Sn(()=>{if(i.viewport&&i.isPositioned){let C=function(){const u=c.scrollHeight-c.clientHeight,h=Math.ceil(c.scrollTop)c.removeEventListener("scroll",C)}},[i.viewport,i.isPositioned]),s?d.jsx(i1,{...e,ref:l,onAutoScroll:()=>{const{viewport:C,selectedItem:c}=i;C&&c&&(C.scrollTop=C.scrollTop+c.offsetHeight)}}):null},"SelectScrollDownButton")),i1=E.forwardRef(Ct(function(e,n){const{__scopeSelect:i,onAutoScroll:o,...s}=e,a=Os("SelectScrollButton",i),l=E.useRef(null),C=AI(i),c=E.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return E.useEffect(()=>()=>c(),[c]),Sn(()=>{C().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[C]),d.jsx(Yn.div,{"aria-hidden":!0,...s,ref:n,style:{flexShrink:0,...s.style},onPointerDown:tn(s.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(o,50))}),onPointerMove:tn(s.onPointerMove,()=>{a.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(o,50))}),onPointerLeave:tn(s.onPointerLeave,()=>{c()})})},"SelectScrollButtonImpl")),hF="SelectBubbleInput",fF=E.forwardRef(Ct(function({__scopeSelect:e,...n},i){const o=Er(hF,e),{value:s,onValueChange:a,required:l,disabled:C,name:c,autoComplete:u,form:h}=o,{nativeOptions:m,nativeSelectKey:v}=o,b=E.useRef(null),x=en(i,b),y=s??"",S=Kx(y),T=Array.from(m).some(O=>(O.props.value??"")==="");return E.useEffect(()=>{const O=b.current;if(!O)return;const M=window.HTMLSelectElement.prototype,G=Object.getOwnPropertyDescriptor(M,"value").set;if(S!==y&&G){const L=new Event("change",{bubbles:!0});G.call(O,y),O.dispatchEvent(L)}},[S,y]),d.jsxs(Yn.select,{"aria-hidden":!0,required:l,tabIndex:-1,name:c,autoComplete:u,disabled:C,form:h,onChange:O=>a(O.target.value),...n,style:{...WZ,...n.style},ref:x,defaultValue:y,children:[pA(s)&&!T?d.jsx("option",{value:""}):null,Array.from(m)]},v)},"SelectBubbleInput"));function o1(t){return typeof t=="function"}Ct(o1,"isFunction");function pA(t){return t===""||t===void 0}Ct(pA,"shouldShowPlaceholder");function ph(t){const e=lo(t),n=E.useRef(""),i=E.useRef(0),o=E.useCallback(a=>{const l=n.current+a;e(l),Ct((function C(c){n.current=c,window.clearTimeout(i.current),c!==""&&(i.current=window.setTimeout(()=>C(""),1e3))}),"updateSearch")(l)},[e]),s=E.useCallback(()=>{n.current="",window.clearTimeout(i.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(i.current),[]),[n,o,s]}Ct(ph,"useTypeaheadSearch");function mh(t,e,n){const o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let a=r1(t,Math.max(s,0));o.length===1&&(a=a.filter(c=>c!==n));const C=a.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return C!==n?C:void 0}Ct(mh,"findNextItem");function r1(t,e){return t.map((n,i)=>t[(e+i)%t.length])}Ct(r1,"wrapArray");const CI=[{value:"automatic",label:"Automatic",Icon:kC},{value:"circle",label:"Circle",Icon:E4},{value:"concentric",label:"Concentric",Icon:iB},{value:"spiral",label:"Spiral",Icon:X4},{value:"grid",label:"Square grid",Icon:k4}];function pF({value:t,onChange:e,onOpen:n}){const i=CI.find(o=>o.value===t)??CI[0];return d.jsxs(HG,{value:t,onValueChange:o=>{const s=CI.find(a=>a.value===o);s&&e(s.value)},onOpenChange:o=>{o&&n()},children:[d.jsxs($G,{className:"compass-layout-picker","aria-label":"Graph layout",children:[d.jsx(i.Icon,{"aria-hidden":"true"}),d.jsx(KG,{children:i.label}),d.jsx(XG,{asChild:!0,children:d.jsx(hu,{"aria-hidden":"true"})})]}),d.jsx(eF,{children:d.jsxs(tF,{className:"compass-layout-menu",position:"popper",align:"start",sideOffset:6,collisionPadding:12,"aria-label":"Graph layout",children:[d.jsx(dF,{className:"compass-layout-menu-scroll",children:d.jsx(w4,{"aria-hidden":"true"})}),d.jsx(gF,{children:CI.map(({value:o,label:s,Icon:a})=>d.jsxs(lF,{value:o,className:"compass-layout-option",children:[d.jsx(a,{"aria-hidden":"true"}),d.jsx(CF,{children:s}),d.jsx(cF,{className:"compass-layout-check",children:d.jsx(y4,{"aria-hidden":"true"})})]},o))}),d.jsx(uF,{className:"compass-layout-menu-scroll",children:d.jsx(hu,{"aria-hidden":"true"})})]})})]})}function mF(t){return t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")}function vF({status:t,physicsRunning:e,layoutStyle:n,forceLabels:i,showEdgeLabels:o,hasSelection:s,isolateSelection:a,neighborhoodDepth:l,edgeDirection:C,layoutSpacing:c,showMinimap:u,scopeControls:h,leadingControls:m,leadingPanel:v,leadingPanelOpen:b,onLeadingPanelClose:x,onTogglePhysics:y,onLayoutChange:S,onZoomOut:T,onResetZoom:O,onZoomIn:M,onFit:k,onFitSelection:G,onReset:L,onToggleLabels:F,onToggleEdgeLabels:re,onToggleIsolation:pe,onNeighborhoodDepthChange:ie,onEdgeDirectionChange:J,onLayoutSpacingChange:ve,onToggleMinimap:me,onBack:ue,canvasControls:z=!0,variantControls:U,themeControls:Q}){const[le,X]=E.useState(!1),R=E.useId(),[D,H]=E.useState(!1),se=z||!!Q,de=E.useRef(null),be=E.useRef(null),Me=E.useRef(null),ge=E.useRef(!1);return E.useEffect(()=>{b&&X(!1)},[b]),E.useEffect(()=>{le||!ge.current||(ge.current=!1,Me.current?.focus())},[le]),E.useEffect(()=>{const ae=Re=>{if(se){if(Re.key==="Escape"){le&&(ge.current=!0,X(!1));return}Re.key!=="?"||mF(Re.target)||(Re.preventDefault(),x?.(),X(!0),H(!0))}},xe=Re=>{be.current?.contains(Re.target)||de.current?.contains(Re.target)||X(!1)};return document.addEventListener("keydown",ae),document.addEventListener("pointerdown",xe),()=>{document.removeEventListener("keydown",ae),document.removeEventListener("pointerdown",xe)}},[se,x,le]),E.useLayoutEffect(()=>{if(!le)return;const ae=()=>{const Re=Me.current,j=de.current;if(!Re||!j)return;const ce=Re.getBoundingClientRect(),Se=Math.min(330,window.innerWidth-24),_e=Math.min(ce.bottom+8,window.innerHeight-24);j.style.width=`${Se}px`,j.style.left=`${Math.max(12,Math.min(ce.right-Se,window.innerWidth-Se-12))}px`,j.style.top=`${_e}px`,j.style.maxHeight=`${Math.max(0,window.innerHeight-_e-12)}px`};ae();const xe=typeof ResizeObserver>"u"?void 0:new ResizeObserver(ae);return be.current&&xe?.observe(be.current),window.addEventListener("resize",ae),document.addEventListener("scroll",ae,!0),()=>{xe?.disconnect(),window.removeEventListener("resize",ae),document.removeEventListener("scroll",ae,!0)}},[le]),d.jsxs("div",{ref:be,className:"compass-graph-toolbar compass-glass-panel",role:"toolbar","aria-label":"Graph controls",children:[d.jsxs("div",{className:"compass-viewer-status","data-state":e?"running":"paused",role:"status","aria-live":"polite",title:t,children:[d.jsx("span",{className:"compass-viewer-status-dot","aria-hidden":"true"}),d.jsx("span",{className:"compass-viewer-status-text",children:t})]}),d.jsxs("div",{className:"compass-toolbar-actions",children:[ue&&d.jsxs("button",{className:"compass-tool-button",type:"button","aria-label":"Back to community overview",onClick:ue,children:[d.jsx(h4,{}),d.jsx("span",{children:"Overview"})]}),m?d.jsx("div",{className:"compass-toolbar-leading",children:m}):null,h,h&&U?d.jsx("span",{className:"compass-toolbar-separator","aria-hidden":"true"}):null,U,z?d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"compass-toolbar-group",role:"group","aria-label":"Graph arrangement",children:[d.jsx(pF,{value:n,onChange:S,onOpen:()=>{X(!1),x?.()}}),d.jsxs("button",{className:"compass-tool-button compass-physics-button",type:"button","aria-label":e?"Stop layout":n==="automatic"?"Run layout":"Fixed layout","aria-pressed":e,disabled:n!=="automatic",title:n==="automatic"?e?"Stop layout":"Run layout":"Physics is available in Automatic layout",onClick:y,children:[e?d.jsx(d0,{}):n==="automatic"?d.jsx(H4,{}):d.jsx(d0,{}),d.jsx("span",{children:e?"Stop":n==="automatic"?"Layout":"Fixed"})]})]}),d.jsx("span",{className:"compass-toolbar-separator","aria-hidden":"true"}),d.jsxs("div",{className:"compass-toolbar-group",role:"group","aria-label":"Graph camera",children:[d.jsxs("div",{className:"compass-zoom-controls",role:"group","aria-label":"Zoom controls",children:[d.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Zoom out",title:"Zoom out",onClick:T,children:d.jsx(rB,{})}),d.jsx("button",{className:"compass-tool-button compass-zoom-reset",type:"button","aria-label":"Reset zoom to 100%",title:"Reset zoom to 100%",onClick:O,children:"100%"}),d.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Zoom in",title:"Zoom in",onClick:M,children:d.jsx(oB,{})})]}),d.jsx("button",{className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Fit graph in view",title:"Fit graph in view",onClick:k,children:d.jsx(I0,{})})]})]}):null,se?d.jsx("button",{ref:Me,className:"compass-tool-button compass-tool-icon-button",type:"button","aria-label":"Graph settings","aria-expanded":le,"aria-controls":R,title:"Graph settings (?)",onClick:()=>X(ae=>{const xe=!ae;return xe&&x?.(),xe}),children:d.jsx(K4,{})}):null]}),v,le&&se?bs.createPortal(d.jsxs("div",{ref:de,id:R,className:"compass-explore-panel compass-glass-panel",role:"region","aria-label":"Graph exploration controls",children:[d.jsxs("div",{className:"compass-explore-heading",children:[d.jsxs("div",{children:[d.jsx("strong",{children:"Graph settings"}),d.jsx("span",{children:"Customize the view and explore connections"})]}),d.jsx("kbd",{children:"?"})]}),d.jsxs("section",{className:"compass-settings-section","aria-label":"Appearance",children:[d.jsx("h3",{children:"Appearance"}),Q?d.jsxs("div",{className:"compass-settings-theme",children:[d.jsx("span",{children:"Theme"}),Q]}):null,z?d.jsxs(d.Fragment,{children:[d.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":i?"Hide labels":"Show labels","aria-pressed":i,onClick:F,children:[d.jsx(nB,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Show node labels"}),d.jsx("small",{children:"Label every symbol, not only the ranked set"})]}),d.jsx("i",{"aria-hidden":"true"})]}),d.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":o?"Hide relationship labels":"Show relationship labels","aria-pressed":o,onClick:re,children:[d.jsx(f0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Show relationship labels"}),d.jsx("small",{children:"Print the relationship kind on every edge"})]}),d.jsx("i",{"aria-hidden":"true"})]})]}):null]}),z?d.jsxs(d.Fragment,{children:[d.jsxs("section",{className:"compass-settings-section","aria-label":"Layout and view",children:[d.jsx("h3",{children:"Layout & view"}),d.jsxs("label",{className:"compass-explore-select",children:[d.jsx("span",{children:"Layout spacing"}),d.jsxs("select",{"aria-label":"Layout spacing",value:c,onChange:ae=>ve(Number(ae.target.value)),children:[d.jsx("option",{value:2.25,children:"Compact · 75%"}),d.jsx("option",{value:3,children:"Default · 100%"}),d.jsx("option",{value:4.5,children:"Airy · 150%"}),d.jsx("option",{value:6,children:"Wide · 200%"}),d.jsx("option",{value:9,children:"Extra wide · 300%"})]})]}),d.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":"Show minimap","aria-pressed":u,onClick:me,children:[d.jsx(P4,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Show minimap"}),d.jsx("small",{children:"Track and reposition the visible viewport"})]}),d.jsx("i",{"aria-hidden":"true"})]}),d.jsxs("button",{className:"compass-explore-toggle compass-explore-action",type:"button","aria-label":"Reset graph view",onClick:L,children:[d.jsx(h0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Reset graph view"}),d.jsx("small",{children:"Return to the opening camera and clear selection"})]}),d.jsx(cu,{"aria-hidden":"true"})]})]}),d.jsxs("section",{className:"compass-settings-section","aria-label":"Selection and neighborhood",children:[d.jsx("h3",{children:"Selection & neighborhood"}),s?null:d.jsxs("div",{className:"compass-selection-prompt",role:"note",children:[d.jsx(p0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Select a node to isolate it"}),d.jsx("small",{children:"Use the canvas or node search. Depth and direction can be set now."})]})]}),d.jsxs("button",{className:"compass-explore-toggle",type:"button","aria-label":"Isolate selection","aria-pressed":a,disabled:!s,onClick:pe,children:[d.jsx(p0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Isolate selection"}),d.jsx("small",{children:"Hide everything outside the traversal"})]}),d.jsx("i",{"aria-hidden":"true"})]}),d.jsxs("fieldset",{className:"compass-explore-field",children:[d.jsx("legend",{children:"Neighborhood depth"}),d.jsx("div",{className:"compass-segmented-control","aria-label":"Neighborhood depth",children:[1,2,3,4].map(ae=>d.jsx("button",{type:"button","aria-label":`${ae} hop${ae===1?"":"s"}`,"aria-pressed":l===ae,onClick:()=>ie(ae),children:ae},ae))})]}),d.jsxs("fieldset",{className:"compass-explore-field",children:[d.jsx("legend",{children:"Edge direction"}),d.jsx("div",{className:"compass-segmented-control","aria-label":"Edge direction",children:[["both","Both"],["outgoing","Out"],["incoming","In"]].map(([ae,xe])=>d.jsx("button",{type:"button","aria-label":`${xe==="Both"?"Both directions":xe==="Out"?"Outgoing edges":"Incoming edges"}`,"aria-pressed":C===ae,onClick:()=>J(ae),children:xe},ae))})]}),d.jsxs("button",{className:"compass-explore-toggle compass-explore-action",type:"button","aria-label":"Fit selected neighborhood",title:s?`Fit the selected node and its ${l}-hop neighborhood`:"Select a node to fit its neighborhood",disabled:!s,onClick:G,children:[d.jsx(R4,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Fit selection"}),d.jsx("small",{children:"Zoom to the selected node and its neighborhood"})]}),d.jsx(cu,{"aria-hidden":"true"})]})]}),d.jsxs("details",{className:"compass-shortcut-guide","aria-label":"Graph keyboard shortcuts",open:D,onToggle:ae=>H(ae.currentTarget.open),children:[d.jsxs("summary",{className:"compass-shortcut-title",children:[d.jsx(_4,{"aria-hidden":"true"}),d.jsx("strong",{children:"Keyboard shortcuts"}),d.jsx(hu,{"aria-hidden":"true"})]}),d.jsxs("dl",{children:[d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"F"})}),d.jsx("dd",{children:"Fit graph"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"⇧ F"})}),d.jsx("dd",{children:"Fit selection"})]}),d.jsxs("div",{children:[d.jsxs("dt",{children:[d.jsx("kbd",{children:"+"})," ",d.jsx("kbd",{children:"−"})]}),d.jsx("dd",{children:"Zoom"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"0"})}),d.jsx("dd",{children:"100% zoom"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"I"})}),d.jsx("dd",{children:"Isolate"})]}),d.jsxs("div",{children:[d.jsxs("dt",{children:[d.jsx("kbd",{children:"["})," ",d.jsx("kbd",{children:"]"})]}),d.jsx("dd",{children:"Depth"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"D"})}),d.jsx("dd",{children:"Direction"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"M"})}),d.jsx("dd",{children:"Minimap"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"L"})}),d.jsx("dd",{children:"Labels"})]}),d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"⇧ L"})}),d.jsx("dd",{children:"Relationship labels"})]}),ue?d.jsxs("div",{children:[d.jsx("dt",{children:d.jsx("kbd",{children:"Esc"})}),d.jsx("dd",{children:"Back to overview"})]}):null]})]})]}):null]}),document.body):null]})}const s1=E.createContext(null);function yF(){return E.useContext(s1)}const bF={callable:"Callable",type:"Type",module:"Module / file",boundary:"Boundary / data",other:"Other"},wF={execution:"Execution",dependency:"Dependency",structure:"Structure",flow:"Data / event flow",other:"Other"};function xF({model:t}){const e=E.useMemo(()=>{const i=new Map;for(const o of t.nodes){const s=yg(o.kind);i.set(s,(i.get(s)??0)+1)}return i},[t.nodes]),n=E.useMemo(()=>{const i=new Map;for(const o of t.edges){const s=bg(o.relation);i.set(s,(i.get(s)??0)+1)}return i},[t.edges]);return d.jsxs("aside",{className:"compass-semantic-legend compass-glass-panel","aria-label":"Graph visual legend",children:[d.jsxs("section",{"aria-label":"Node categories",children:[d.jsx("strong",{children:"Nodes"}),cB.filter(i=>(e.get(i)??0)>0).map(i=>d.jsxs("span",{className:"compass-semantic-legend-item",children:[d.jsx("i",{"data-node-category":i,"aria-hidden":"true"}),bF[i],d.jsx("small",{children:e.get(i)})]},i))]}),t.edges.length>0?d.jsxs("section",{"aria-label":"Relationship categories",children:[d.jsx("strong",{children:"Edges"}),S0.filter(i=>(n.get(i)??0)>0).map(i=>d.jsxs("span",{className:"compass-semantic-legend-item",children:[d.jsx("i",{"data-edge-category":i,"aria-hidden":"true"}),wF[i],d.jsx("small",{children:n.get(i)})]},i))]}):null]})}const g1=280,a1=560,A1=24,vh={width:340,collapsed:!1};function mA(t){return Number.isFinite(t)?Math.min(a1,Math.max(g1,Math.round(t))):vh.width}function l1(t){return{width:mA(t?.width??vh.width),collapsed:t?.collapsed??vh.collapsed}}function SF(t,e){return mA(t-e)}function EF(t,e){return mA(e==="ArrowLeft"?t+A1:e==="ArrowRight"?t-A1:t)}function TF({width:t,onResize:e}){const n=E.useRef(!1),i=o=>{n.current=!1,o.currentTarget.hasPointerCapture(o.pointerId)&&o.currentTarget.releasePointerCapture(o.pointerId)};return d.jsx("div",{className:"compass-inspector-resizer",role:"separator","aria-label":"Resize graph inspector","aria-orientation":"vertical","aria-valuemin":g1,"aria-valuemax":a1,"aria-valuenow":t,tabIndex:0,onPointerDown:o=>{n.current=!0,o.currentTarget.setPointerCapture(o.pointerId)},onPointerMove:o=>{if(!n.current)return;const s=o.currentTarget.parentElement;s&&e(SF(s.getBoundingClientRect().right,o.clientX))},onPointerUp:i,onPointerCancel:i,onKeyDown:o=>{o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),e(EF(t,o.key)))},children:d.jsx("span",{"aria-hidden":"true"})})}function C1(t,e,n){if(n===void 0&&t.stats.aggregated&&e.memberCount!==void 0&&e.detailAvailable!==!1)return{type:"community",communityId:e.community};const i=Iw(e);return i?{type:"source",source:i}:{type:"none"}}function OF(t){const e=t.source?.startLine,n=t.source?.endLine;if(e!==void 0)return n!==void 0&&n!==e?`${e}–${n}`:String(e)}function NF({node:t,hover:e,activation:n}){const i={"--compass-hover-x":`${e.x+18}px`,"--compass-hover-y":`${e.y-42}px`},o=OF(t);return d.jsxs("div",{className:"compass-node-hover-card",role:"tooltip",style:i,children:[d.jsxs("div",{className:"compass-hover-heading",children:[d.jsx("strong",{children:t.label}),d.jsx("span",{children:(t.kind??"symbol").toLocaleUpperCase()})]}),t.change&&d.jsx("span",{className:"compass-change-badge","data-change":t.change,children:t.change==="unchanged"?"Context":`${t.change[0]?.toLocaleUpperCase()}${t.change.slice(1)}`}),t.groundingStatus==="GROUNDED"&&d.jsx("span",{className:"compass-change-badge","data-grounding":"grounded",children:"GROUNDED · agent-authored"}),t.agentSummary&&d.jsx("p",{children:t.agentSummary}),t.challenge&&d.jsxs("p",{children:["Challenge (",t.challenge.effect,"): ",t.challenge.summary]}),t.challenged&&!t.challenge&&d.jsx("p",{children:"Challenge: this Base Graph fact is disputed."}),t.memberCount!==void 0?d.jsxs("p",{children:[t.memberCount.toLocaleString()," symbols"]}):d.jsxs(d.Fragment,{children:[t.language&&d.jsxs("p",{children:["Language: ",t.language]}),t.source?.file&&d.jsx("p",{className:"compass-hover-source",children:t.source.file}),o&&d.jsxs("p",{children:["Lines: ",o]}),t.signature&&d.jsx("code",{children:t.signature})]}),n.type!=="none"&&d.jsxs("p",{className:"compass-hover-hint",children:[n.type==="community"?d.jsx(kC,{"aria-hidden":"true"}):d.jsx(N4,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Double-click"})," ",n.type==="community"?"to open community subgraph":"to open source code"]})]})]})}const MF={routes_to:"routes to",publishes:"publishes",subscribes:"subscribes",produces:"produces",consumes:"consumes",schedules:"schedules",triggers:"triggers",handles:"handles",registers:"registers",reads:"reads",writes:"writes",maps_to:"maps to",depends_on:"depends on",renders:"renders"};function RF(t){const e=t.relation.trim(),n=MF[e]??e,i=t.details?.type==="route"?t.details.data:void 0,o=i?`${i.stage}${i.position===null||i.position===void 0?"":` ${i.position+1}`}`:void 0;return[n,o,i?.operation].filter(s=>s!==void 0&&s!=="").join(" · ")}function kF(t){if(!t?.file.trim())return"";const e=t.startLine,n=t.endLine;if(e!==void 0){const i=n!==void 0&&n!==e?`${e}–${n}`:String(e);return`${t.file}:${i}`}return t.startByte!==void 0?`${t.file}:byte ${t.startByte}`:t.file}function DF(t){const e=t.confidence;return e?`${e[0]?.toLocaleUpperCase()}${e.slice(1)}`:"Unspecified"}function _F(t){if(t)return t==="unchanged"?"Context":`${t[0]?.toLocaleUpperCase()}${t.slice(1)}`}function jF({edge:t,sourceNode:e,targetNode:n,hover:i}){const o={"--compass-hover-x":`${i.x+18}px`,"--compass-hover-y":`${i.y-52}px`},s=kF(t.relationshipSite),a=t.codeEvidence?.[0],l=_F(t.change),C=cw(t)!==void 0;return d.jsxs("div",{className:"compass-edge-hover-card",role:"tooltip",style:o,children:[d.jsxs("div",{className:"compass-edge-hover-heading",children:[d.jsxs("span",{className:"compass-edge-hover-eyebrow",children:[d.jsx(l0,{"aria-hidden":"true"}),"Relationship"]}),d.jsx("span",{className:"compass-edge-confidence","data-confidence":t.confidence??"unspecified",children:DF(t)})]}),d.jsxs("div",{className:"compass-edge-trace","aria-label":`${e.label} to ${n.label}`,children:[d.jsx("strong",{children:e.label}),d.jsx("span",{"aria-hidden":"true",children:d.jsx(cu,{})}),d.jsx("strong",{children:n.label})]}),d.jsxs("div",{className:"compass-edge-relation-row",children:[d.jsx("strong",{children:RF(t)||"Relationship"}),l&&d.jsx("span",{className:"compass-change-badge","data-change":t.change,children:l}),t.groundingStatus==="GROUNDED"&&d.jsx("span",{className:"compass-change-badge","data-grounding":"grounded",children:"GROUNDED · agent-authored"})]}),t.agentSummary&&d.jsx("p",{children:t.agentSummary}),t.challenge&&d.jsxs("p",{children:["Challenge (",t.challenge.effect,"): ",t.challenge.summary]}),t.challenged&&!t.challenge&&d.jsx("p",{children:"Challenge: this Base Graph relationship is disputed."}),(a||s)&&d.jsxs("div",{className:"compass-edge-metadata",children:[a&&d.jsxs("p",{children:[d.jsx("span",{children:"Evidence"}),d.jsx("code",{children:a.rule??a.origin})]}),s&&d.jsxs("p",{children:[d.jsx("span",{children:"Source"}),d.jsx("code",{children:s})]})]}),C&&d.jsxs("p",{className:"compass-hover-hint",children:[d.jsx(l0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsx("strong",{children:"Double-click"})," to open relationship source"]})]})]})}var yh=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function He(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var II=function(t){return t&&t.Math===Math&&t},$t=II(typeof globalThis=="object"&&globalThis)||II(typeof window=="object"&&window)||II(typeof self=="object"&&self)||II(typeof yh=="object"&&yh)||(function(){return this})()||yh||Function("return this")(),ht=function(t){try{return!!t()}catch{return!0}},zF=ht,vA=!zF(function(){var t=(function(){}).bind();return typeof t!="function"||t.hasOwnProperty("prototype")}),PF=vA,I1=Function.prototype,c1=I1.apply,d1=I1.call,cI=typeof Reflect=="object"&&Reflect.apply||(PF?d1.bind(c1):function(){return d1.apply(c1,arguments)}),u1=vA,h1=Function.prototype,bh=h1.call,LF=u1&&h1.bind.bind(bh,bh),ft=u1?LF:function(t){return function(){return bh.apply(t,arguments)}},f1=ft,BF=f1({}.toString),ZF=f1("".slice),Fo=function(t){return ZF(BF(t),8,-1)},GF=Fo,FF=ft,wh=function(t){if(GF(t)==="Function")return FF(t)},xh=typeof document=="object"&&document.all,VF=typeof xh>"u"&&xh!==void 0,p1={all:xh,IS_HTMLDDA:VF},m1=p1,UF=m1.all,kn=m1.IS_HTMLDDA?function(t){return typeof t=="function"||t===UF}:function(t){return typeof t=="function"},yA={},HF=ht,vn=!HF(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7}),YF=vA,dI=Function.prototype.call,Wi=YF?dI.bind(dI):function(){return dI.apply(dI,arguments)},bA={},v1={}.propertyIsEnumerable,y1=Object.getOwnPropertyDescriptor,$F=y1&&!v1.call({1:2},1);bA.f=$F?function(e){var n=y1(this,e);return!!n&&n.enumerable}:v1;var wA=function(t,e){return{enumerable:!(t&1),configurable:!(t&2),writable:!(t&4),value:e}},WF=ft,KF=ht,XF=Fo,Sh=Object,QF=WF("".split),uI=KF(function(){return!Sh("z").propertyIsEnumerable(0)})?function(t){return XF(t)==="String"?QF(t,""):Sh(t)}:Sh,zg=function(t){return t==null},qF=zg,JF=TypeError,xA=function(t){if(qF(t))throw new JF("Can't call method on "+t);return t},e9=uI,t9=xA,Ki=function(t){return e9(t9(t))},b1=kn,w1=p1,n9=w1.all,Vn=w1.IS_HTMLDDA?function(t){return typeof t=="object"?t!==null:b1(t)||t===n9}:function(t){return typeof t=="object"?t!==null:b1(t)},vt={},Eh=vt,Th=$t,i9=kn,x1=function(t){return i9(t)?t:void 0},Xi=function(t,e){return arguments.length<2?x1(Eh[t])||x1(Th[t]):Eh[t]&&Eh[t][e]||Th[t]&&Th[t][e]},o9=ft,Wt=o9({}.isPrototypeOf),SA=typeof navigator<"u"&&String(navigator.userAgent)||"",S1=$t,Oh=SA,E1=S1.process,T1=S1.Deno,O1=E1&&E1.versions||T1&&T1.version,N1=O1&&O1.v8,Qi,hI;N1&&(Qi=N1.split("."),hI=Qi[0]>0&&Qi[0]<4?1:+(Qi[0]+Qi[1])),!hI&&Oh&&(Qi=Oh.match(/Edge\/(\d+)/),(!Qi||Qi[1]>=74)&&(Qi=Oh.match(/Chrome\/(\d+)/),Qi&&(hI=+Qi[1])));var EA=hI,M1=EA,r9=ht,s9=$t,g9=s9.String,Pg=!!Object.getOwnPropertySymbols&&!r9(function(){var t=Symbol("symbol detection");return!g9(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&M1&&M1<41}),a9=Pg,R1=a9&&!Symbol.sham&&typeof Symbol.iterator=="symbol",A9=Xi,l9=kn,C9=Wt,I9=R1,c9=Object,TA=I9?function(t){return typeof t=="symbol"}:function(t){var e=A9("Symbol");return l9(e)&&C9(e.prototype,c9(t))},d9=String,OA=function(t){try{return d9(t)}catch{return"Object"}},u9=kn,h9=OA,f9=TypeError,Ns=function(t){if(u9(t))return t;throw new f9(h9(t)+" is not a function")},p9=Ns,m9=zg,Nh=function(t,e){var n=t[e];return m9(n)?void 0:p9(n)},Mh=Wi,Rh=kn,kh=Vn,v9=TypeError,y9=function(t,e){var n,i;if(e==="string"&&Rh(n=t.toString)&&!kh(i=Mh(n,t))||Rh(n=t.valueOf)&&!kh(i=Mh(n,t))||e!=="string"&&Rh(n=t.toString)&&!kh(i=Mh(n,t)))return i;throw new v9("Can't convert object to primitive value")},k1={exports:{}},D1=$t,b9=Object.defineProperty,w9=function(t,e){try{b9(D1,t,{value:e,configurable:!0,writable:!0})}catch{D1[t]=e}return e},x9=$t,S9=w9,_1="__core-js_shared__",E9=x9[_1]||S9(_1,{}),Dh=E9,j1=Dh;(k1.exports=function(t,e){return j1[t]||(j1[t]=e!==void 0?e:{})})("versions",[]).push({version:"3.33.0",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.33.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Lg=k1.exports,T9=xA,O9=Object,fi=function(t){return O9(T9(t))},N9=ft,M9=fi,R9=N9({}.hasOwnProperty),yn=Object.hasOwn||function(e,n){return R9(M9(e),n)},k9=ft,D9=0,_9=Math.random(),j9=k9(1 .toString),fI=function(t){return"Symbol("+(t===void 0?"":t)+")_"+j9(++D9+_9,36)},z9=$t,P9=Lg,z1=yn,L9=fI,B9=Pg,Z9=R1,Bg=z9.Symbol,_h=P9("wks"),G9=Z9?Bg.for||Bg:Bg&&Bg.withoutSetter||L9,nn=function(t){return z1(_h,t)||(_h[t]=B9&&z1(Bg,t)?Bg[t]:G9("Symbol."+t)),_h[t]},F9=Wi,P1=Vn,L1=TA,V9=Nh,U9=y9,H9=nn,Y9=TypeError,$9=H9("toPrimitive"),W9=function(t,e){if(!P1(t)||L1(t))return t;var n=V9(t,$9),i;if(n){if(e===void 0&&(e="default"),i=F9(n,t,e),!P1(i)||L1(i))return i;throw new Y9("Can't convert object to primitive value")}return e===void 0&&(e="number"),U9(t,e)},K9=W9,X9=TA,pI=function(t){var e=K9(t,"string");return X9(e)?e:e+""},Q9=$t,B1=Vn,jh=Q9.document,q9=B1(jh)&&B1(jh.createElement),Z1=function(t){return q9?jh.createElement(t):{}},J9=vn,eV=ht,tV=Z1,G1=!J9&&!eV(function(){return Object.defineProperty(tV("div"),"a",{get:function(){return 7}}).a!==7}),nV=vn,iV=Wi,oV=bA,rV=wA,sV=Ki,gV=pI,aV=yn,AV=G1,F1=Object.getOwnPropertyDescriptor;yA.f=nV?F1:function(e,n){if(e=sV(e),n=gV(n),AV)try{return F1(e,n)}catch{}if(aV(e,n))return rV(!iV(oV.f,e,n),e[n])};var lV=ht,CV=kn,IV=/#|\.prototype\./,NA=function(t,e){var n=dV[cV(t)];return n===hV?!0:n===uV?!1:CV(e)?lV(e):!!e},cV=NA.normalize=function(t){return String(t).replace(IV,".").toLowerCase()},dV=NA.data={},uV=NA.NATIVE="N",hV=NA.POLYFILL="P",fV=NA,V1=wh,pV=Ns,mV=vA,vV=V1(V1.bind),MA=function(t,e){return pV(t),e===void 0?t:mV?vV(t,e):function(){return t.apply(e,arguments)}},pi={},yV=vn,bV=ht,U1=yV&&bV(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42}),wV=Vn,xV=String,SV=TypeError,Vo=function(t){if(wV(t))return t;throw new SV(xV(t)+" is not an object")},EV=vn,TV=G1,OV=U1,mI=Vo,H1=pI,NV=TypeError,zh=Object.defineProperty,MV=Object.getOwnPropertyDescriptor,Ph="enumerable",Lh="configurable",Bh="writable";pi.f=EV?OV?function(e,n,i){if(mI(e),n=H1(n),mI(i),typeof e=="function"&&n==="prototype"&&"value"in i&&Bh in i&&!i[Bh]){var o=MV(e,n);o&&o[Bh]&&(e[n]=i.value,i={configurable:Lh in i?i[Lh]:o[Lh],enumerable:Ph in i?i[Ph]:o[Ph],writable:!1})}return zh(e,n,i)}:zh:function(e,n,i){if(mI(e),n=H1(n),mI(i),TV)try{return zh(e,n,i)}catch{}if("get"in i||"set"in i)throw new NV("Accessors not supported");return"value"in i&&(e[n]=i.value),e};var RV=vn,kV=pi,DV=wA,Zg=RV?function(t,e,n){return kV.f(t,e,DV(1,n))}:function(t,e,n){return t[e]=n,t},vI=$t,_V=cI,jV=wh,zV=kn,PV=yA.f,LV=fV,Gg=vt,BV=MA,Fg=Zg,Y1=yn,ZV=function(t){var e=function(n,i,o){if(this instanceof e){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,i)}return new t(n,i,o)}return _V(t,this,arguments)};return e.prototype=t.prototype,e},We=function(t,e){var n=t.target,i=t.global,o=t.stat,s=t.proto,a=i?vI:o?vI[n]:(vI[n]||{}).prototype,l=i?Gg:Gg[n]||Fg(Gg,n,{})[n],C=l.prototype,c,u,h,m,v,b,x,y,S;for(m in e)c=LV(i?m:n+(o?".":"#")+m,t.forced),u=!c&&a&&Y1(a,m),b=l[m],u&&(t.dontCallGetSet?(S=PV(a,m),x=S&&S.value):x=a[m]),v=u&&x?x:e[m],!(u&&typeof b==typeof v)&&(t.bind&&u?y=BV(v,vI):t.wrap&&u?y=ZV(v):s&&zV(v)?y=jV(v):y=v,(t.sham||v&&v.sham||b&&b.sham)&&Fg(y,"sham",!0),Fg(l,m,y),s&&(h=n+"Prototype",Y1(Gg,h)||Fg(Gg,h,{}),Fg(Gg[h],m,v),t.real&&C&&(c||!C[m])&&Fg(C,m,v)))},GV=Math.ceil,FV=Math.floor,VV=Math.trunc||function(e){var n=+e;return(n>0?FV:GV)(n)},UV=VV,yI=function(t){var e=+t;return e!==e||e===0?0:UV(e)},HV=yI,YV=Math.max,$V=Math.min,RA=function(t,e){var n=HV(t);return n<0?YV(n+e,0):$V(n,e)},WV=yI,KV=Math.min,XV=function(t){return t>0?KV(WV(t),9007199254740991):0},QV=XV,Mi=function(t){return QV(t.length)},qV=Ki,JV=RA,eU=Mi,$1=function(t){return function(e,n,i){var o=qV(e),s=eU(o),a=JV(i,s),l;if(t&&n!==n){for(;s>a;)if(l=o[a++],l!==l)return!0}else for(;s>a;a++)if((t||a in o)&&o[a]===n)return t||a||0;return!t&&-1}},Zh={includes:$1(!0),indexOf:$1(!1)},kA={},tU=ft,Gh=yn,nU=Ki,iU=Zh.indexOf,oU=kA,W1=tU([].push),K1=function(t,e){var n=nU(t),i=0,o=[],s;for(s in n)!Gh(oU,s)&&Gh(n,s)&&W1(o,s);for(;e.length>i;)Gh(n,s=e[i++])&&(~iU(o,s)||W1(o,s));return o},Fh=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],rU=K1,sU=Fh,DA=Object.keys||function(e){return rU(e,sU)},_A={};_A.f=Object.getOwnPropertySymbols;var X1=vn,gU=ft,aU=Wi,AU=ht,Vh=DA,lU=_A,CU=bA,IU=fi,cU=uI,Vg=Object.assign,Q1=Object.defineProperty,dU=gU([].concat),uU=!Vg||AU(function(){if(X1&&Vg({b:1},Vg(Q1({},"a",{enumerable:!0,get:function(){Q1(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var t={},e={},n=Symbol("assign detection"),i="abcdefghijklmnopqrst";return t[n]=7,i.split("").forEach(function(o){e[o]=o}),Vg({},t)[n]!==7||Vh(Vg({},e)).join("")!==i})?function(e,n){for(var i=IU(e),o=arguments.length,s=1,a=lU.f,l=CU.f;o>s;)for(var C=cU(arguments[s++]),c=a?dU(Vh(C),a(C)):Vh(C),u=c.length,h=0,m;u>h;)m=c[h++],(!X1||aU(l,C,m))&&(i[m]=C[m]);return i}:Vg,hU=We,q1=uU;hU({target:"Object",stat:!0,forced:Object.assign!==q1},{assign:q1});var fU=vt,pU=fU.Object.assign,mU=pU,vU=mU,yU=vU,on=He(yU),bU=ft,bI=bU([].slice),J1=ft,wU=Ns,xU=Vn,SU=yn,eS=bI,EU=vA,tS=Function,TU=J1([].concat),OU=J1([].join),Uh={},NU=function(t,e,n){if(!SU(Uh,e)){for(var i=[],o=0;o=.1;)b=+s[h++%a],b>u&&(b=u),v=Math.sqrt(b*b/(1+c*c)),v=l<0?-v:v,e+=v,n+=c*v,m===!0?t.lineTo(e,n):t.moveTo(e,n),u-=b,m=!m}function YU(t,e,n,i){t.beginPath();const o=6,s=Math.PI*2/o;t.moveTo(e+i,n);for(let a=1;a1?n-1:0),o=1;o"u")){var i=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&i.firstChild?i.insertBefore(o,i.firstChild):i.appendChild(o),o.styleSheet?o.styleSheet.cssText=t:o.appendChild(document.createTextNode(t))}}var WU=`.vis-overlay { position: absolute; top: 0px; right: 0px; @@ -1017,5 +1017,5 @@ div.network-navigation_wrapper { } */ `;Ms(Ale);class lle{constructor(e,n,i,o){var s,a;this.body=e,this.canvas=n,this.selectionHandler=i,this.interactionHandler=o,this.editMode=!1,this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0,this._domEventListenerCleanupQueue=[],this.temporaryUIFunctions={},this.temporaryEventFunctions=[],this.touchTime=0,this.temporaryIds={nodes:[],edges:[]},this.guiEnabled=!1,this.inMode=!1,this.selectedControlNode=void 0,this.options={},this.defaultOptions={enabled:!1,initiallyActive:!1,addNode:!0,addEdge:!0,editNode:void 0,editEdge:!0,deleteNode:!0,deleteEdge:!0,controlNodeStyle:{shape:"dot",size:6,color:{background:"#ff0000",border:"#3c3c3c",highlight:{background:"#07f968",border:"#3c3c3c"}},borderWidth:2,borderWidthSelected:2}},on(this.options,this.defaultOptions),this.body.emitter.on("destroy",()=>{this._clean()}),this.body.emitter.on("_dataChanged",he(s=this._restore).call(s,this)),this.body.emitter.on("_resetData",he(a=this._restore).call(a,this))}_restore(){this.inMode!==!1&&(this.options.initiallyActive===!0?this.enableEditMode():this.disableEditMode())}setOptions(e,n,i){n!==void 0&&(n.locale!==void 0?this.options.locale=n.locale:this.options.locale=i.locale,n.locales!==void 0?this.options.locales=n.locales:this.options.locales=i.locales),e!==void 0&&(typeof e=="boolean"?this.options.enabled=e:(this.options.enabled=!0,Dt(this.options,e)),this.options.initiallyActive===!0&&(this.editMode=!0),this._setup())}toggleEditMode(){this.editMode===!0?this.disableEditMode():this.enableEditMode()}enableEditMode(){this.editMode=!0,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="block",this.closeDiv.style.display="block",this.editModeDiv.style.display="none",this.showManipulatorToolbar())}disableEditMode(){this.editMode=!1,this._clean(),this.guiEnabled===!0&&(this.manipulationDiv.style.display="none",this.closeDiv.style.display="none",this.editModeDiv.style.display="block",this._createEditButton())}showManipulatorToolbar(){if(this._clean(),this.manipulationDOM={},this.guiEnabled===!0){var e,n;this.editMode=!0,this.manipulationDiv.style.display="block",this.closeDiv.style.display="block";const i=this.selectionHandler.getSelectedNodeCount(),o=this.selectionHandler.getSelectedEdgeCount(),s=i+o,a=this.options.locales[this.options.locale];let l=!1;this.options.addNode!==!1&&(this._createAddNodeButton(a),l=!0),this.options.addEdge!==!1&&(l===!0?this._createSeperator(1):l=!0,this._createAddEdgeButton(a)),i===1&&typeof this.options.editNode=="function"?(l===!0?this._createSeperator(2):l=!0,this._createEditNodeButton(a)):o===1&&i===0&&this.options.editEdge!==!1&&(l===!0?this._createSeperator(3):l=!0,this._createEditEdgeButton(a)),s!==0&&(i>0&&this.options.deleteNode!==!1?(l===!0&&this._createSeperator(4),this._createDeleteButton(a)):i===0&&this.options.deleteEdge!==!1&&(l===!0&&this._createSeperator(4),this._createDeleteButton(a))),this._bindElementEvents(this.closeDiv,he(e=this.toggleEditMode).call(e,this)),this._temporaryBindEvent("select",he(n=this.showManipulatorToolbar).call(n,this))}this.body.emitter.emit("_redraw")}addNodeMode(){var e;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addNode",this.guiEnabled===!0){var n;const i=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(i),this._createSeperator(),this._createDescription(i.addDescription||this.options.locales.en.addDescription),this._bindElementEvents(this.closeDiv,he(n=this.toggleEditMode).call(n,this))}this._temporaryBindEvent("click",he(e=this._performAddNode).call(e,this))}editNode(){this.editMode!==!0&&this.enableEditMode(),this._clean();const e=this.selectionHandler.getSelectedNodes()[0];if(e!==void 0)if(this.inMode="editNode",typeof this.options.editNode=="function")if(e.isCluster!==!0){const n=Dt({},e.options,!1);if(n.x=e.x,n.y=e.y,this.options.editNode.length===2)this.options.editNode(n,i=>{i!=null&&this.inMode==="editNode"&&this.body.data.nodes.getDataSet().update(i),this.showManipulatorToolbar()});else throw new Error("The function for edit does not support two arguments (data, callback)")}else alert(this.options.locales[this.options.locale].editClusterError||this.options.locales.en.editClusterError);else throw new Error("No function has been configured to handle the editing of nodes.");else this.showManipulatorToolbar()}addEdgeMode(){var e,n,i,o,s;if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="addEdge",this.guiEnabled===!0){var a;const l=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(l),this._createSeperator(),this._createDescription(l.edgeDescription||this.options.locales.en.edgeDescription),this._bindElementEvents(this.closeDiv,he(a=this.toggleEditMode).call(a,this))}this._temporaryBindUI("onTouch",he(e=this._handleConnect).call(e,this)),this._temporaryBindUI("onDragEnd",he(n=this._finishConnect).call(n,this)),this._temporaryBindUI("onDrag",he(i=this._dragControlNode).call(i,this)),this._temporaryBindUI("onRelease",he(o=this._finishConnect).call(o,this)),this._temporaryBindUI("onDragStart",he(s=this._dragStartEdge).call(s,this)),this._temporaryBindUI("onHold",()=>{})}editEdgeMode(){if(this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="editEdge",typeof this.options.editEdge=="object"&&typeof this.options.editEdge.editWithoutDrag=="function"&&(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0)){const a=this.body.edges[this.edgeBeingEditedId];this._performEditEdge(a.from.id,a.to.id);return}if(this.guiEnabled===!0){var e;const a=this.options.locales[this.options.locale];this.manipulationDOM={},this._createBackButton(a),this._createSeperator(),this._createDescription(a.editEdgeDescription||this.options.locales.en.editEdgeDescription),this._bindElementEvents(this.closeDiv,he(e=this.toggleEditMode).call(e,this))}if(this.edgeBeingEditedId=this.selectionHandler.getSelectedEdgeIds()[0],this.edgeBeingEditedId!==void 0){var n,i,o,s;const a=this.body.edges[this.edgeBeingEditedId],l=this._getNewTargetNode(a.from.x,a.from.y),C=this._getNewTargetNode(a.to.x,a.to.y);this.temporaryIds.nodes.push(l.id),this.temporaryIds.nodes.push(C.id),this.body.nodes[l.id]=l,this.body.nodeIndices.push(l.id),this.body.nodes[C.id]=C,this.body.nodeIndices.push(C.id),this._temporaryBindUI("onTouch",he(n=this._controlNodeTouch).call(n,this)),this._temporaryBindUI("onTap",()=>{}),this._temporaryBindUI("onHold",()=>{}),this._temporaryBindUI("onDragStart",he(i=this._controlNodeDragStart).call(i,this)),this._temporaryBindUI("onDrag",he(o=this._controlNodeDrag).call(o,this)),this._temporaryBindUI("onDragEnd",he(s=this._controlNodeDragEnd).call(s,this)),this._temporaryBindUI("onMouseMove",()=>{}),this._temporaryBindEvent("beforeDrawing",c=>{const u=a.edgeType.findBorderPositions(c);l.selected===!1&&(l.x=u.from.x,l.y=u.from.y),C.selected===!1&&(C.x=u.to.x,C.y=u.to.y)}),this.body.emitter.emit("_redraw")}else this.showManipulatorToolbar()}deleteSelected(){this.editMode!==!0&&this.enableEditMode(),this._clean(),this.inMode="delete";const e=this.selectionHandler.getSelectedNodeIds(),n=this.selectionHandler.getSelectedEdgeIds();let i;if(e.length>0){for(let o=0;o0&&typeof this.options.deleteEdge=="function"&&(i=this.options.deleteEdge);if(typeof i=="function"){const o={nodes:e,edges:n};if(i.length===2)i(o,s=>{s!=null&&this.inMode==="delete"?(this.body.data.edges.getDataSet().remove(s.edges),this.body.data.nodes.getDataSet().remove(s.nodes),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()):(this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar())});else throw new Error("The function for delete does not support two arguments (data, callback)")}else this.body.data.edges.getDataSet().remove(n),this.body.data.nodes.getDataSet().remove(e),this.body.emitter.emit("startSimulation"),this.showManipulatorToolbar()}_setup(){this.options.enabled===!0?(this.guiEnabled=!0,this._createWrappers(),this.editMode===!1?this._createEditButton():this.showManipulatorToolbar()):(this._removeManipulationDOM(),this.guiEnabled=!1)}_createWrappers(){if(this.manipulationDiv===void 0&&(this.manipulationDiv=document.createElement("div"),this.manipulationDiv.className="vis-manipulation",this.editMode===!0?this.manipulationDiv.style.display="block":this.manipulationDiv.style.display="none",this.canvas.frame.appendChild(this.manipulationDiv)),this.editModeDiv===void 0&&(this.editModeDiv=document.createElement("div"),this.editModeDiv.className="vis-edit-mode",this.editMode===!0?this.editModeDiv.style.display="none":this.editModeDiv.style.display="block",this.canvas.frame.appendChild(this.editModeDiv)),this.closeDiv===void 0){var e,n;this.closeDiv=document.createElement("button"),this.closeDiv.className="vis-close",this.closeDiv.setAttribute("aria-label",(e=(n=this.options.locales[this.options.locale])===null||n===void 0?void 0:n.close)!==null&&e!==void 0?e:this.options.locales.en.close),this.closeDiv.style.display=this.manipulationDiv.style.display,this.canvas.frame.appendChild(this.closeDiv)}}_getNewTargetNode(e,n){const i=Dt({},this.options.controlNodeStyle);i.id="targetNode"+la(),i.hidden=!1,i.physics=!1,i.x=e,i.y=n;const o=this.body.functions.createNode(i);return o.shape.boundingBox={left:e,right:e,top:n,bottom:n},o}_createEditButton(){var e;this._clean(),this.manipulationDOM={},Dr(this.editModeDiv);const n=this.options.locales[this.options.locale],i=this._createButton("editMode","vis-edit vis-edit-mode",n.edit||this.options.locales.en.edit);this.editModeDiv.appendChild(i),this._bindElementEvents(i,he(e=this.toggleEditMode).call(e,this))}_clean(){this.inMode=!1,this.guiEnabled===!0&&(Dr(this.editModeDiv),Dr(this.manipulationDiv),this._cleanupDOMEventListeners()),this._cleanupTemporaryNodesAndEdges(),this._unbindTemporaryUIs(),this._unbindTemporaryEvents(),this.body.emitter.emit("restorePhysics")}_cleanupDOMEventListeners(){for(const n of po(e=this._domEventListenerCleanupQueue).call(e,0)){var e;n()}}_removeManipulationDOM(){this._clean(),Dr(this.manipulationDiv),Dr(this.editModeDiv),Dr(this.closeDiv),this.manipulationDiv&&this.canvas.frame.removeChild(this.manipulationDiv),this.editModeDiv&&this.canvas.frame.removeChild(this.editModeDiv),this.closeDiv&&this.canvas.frame.removeChild(this.closeDiv),this.manipulationDiv=void 0,this.editModeDiv=void 0,this.closeDiv=void 0}_createSeperator(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;this.manipulationDOM["seperatorLineDiv"+e]=document.createElement("div"),this.manipulationDOM["seperatorLineDiv"+e].className="vis-separator-line",this.manipulationDiv.appendChild(this.manipulationDOM["seperatorLineDiv"+e])}_createAddNodeButton(e){var n;const i=this._createButton("addNode","vis-add",e.addNode||this.options.locales.en.addNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,he(n=this.addNodeMode).call(n,this))}_createAddEdgeButton(e){var n;const i=this._createButton("addEdge","vis-connect",e.addEdge||this.options.locales.en.addEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,he(n=this.addEdgeMode).call(n,this))}_createEditNodeButton(e){var n;const i=this._createButton("editNode","vis-edit",e.editNode||this.options.locales.en.editNode);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,he(n=this.editNode).call(n,this))}_createEditEdgeButton(e){var n;const i=this._createButton("editEdge","vis-edit",e.editEdge||this.options.locales.en.editEdge);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,he(n=this.editEdgeMode).call(n,this))}_createDeleteButton(e){var n;let i;this.options.rtl?i="vis-delete-rtl":i="vis-delete";const o=this._createButton("delete",i,e.del||this.options.locales.en.del);this.manipulationDiv.appendChild(o),this._bindElementEvents(o,he(n=this.deleteSelected).call(n,this))}_createBackButton(e){var n;const i=this._createButton("back","vis-back",e.back||this.options.locales.en.back);this.manipulationDiv.appendChild(i),this._bindElementEvents(i,he(n=this.showManipulatorToolbar).call(n,this))}_createButton(e,n,i){let o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"vis-label";return this.manipulationDOM[e+"Div"]=document.createElement("button"),this.manipulationDOM[e+"Div"].className="vis-button "+n,this.manipulationDOM[e+"Label"]=document.createElement("div"),this.manipulationDOM[e+"Label"].className=o,this.manipulationDOM[e+"Label"].innerText=i,this.manipulationDOM[e+"Div"].appendChild(this.manipulationDOM[e+"Label"]),this.manipulationDOM[e+"Div"]}_createDescription(e){this.manipulationDOM.descriptionLabel=document.createElement("div"),this.manipulationDOM.descriptionLabel.className="vis-none",this.manipulationDOM.descriptionLabel.innerText=e,this.manipulationDiv.appendChild(this.manipulationDOM.descriptionLabel)}_temporaryBindEvent(e,n){this.temporaryEventFunctions.push({event:e,boundFunction:n}),this.body.emitter.on(e,n)}_temporaryBindUI(e,n){if(this.body.eventListeners[e]!==void 0)this.temporaryUIFunctions[e]=this.body.eventListeners[e],this.body.eventListeners[e]=n;else throw new Error("This UI function does not exist. Typo? You tried: "+e+" possible are: "+Xg(zt(this.body.eventListeners)))}_unbindTemporaryUIs(){for(const e in this.temporaryUIFunctions)Object.prototype.hasOwnProperty.call(this.temporaryUIFunctions,e)&&(this.body.eventListeners[e]=this.temporaryUIFunctions[e],delete this.temporaryUIFunctions[e]);this.temporaryUIFunctions={}}_unbindTemporaryEvents(){for(let e=0;e{i.destroy()});const o=s=>{let{keyCode:a,key:l}=s;(l==="Enter"||l===" "||a===13||a===32)&&n()};e.addEventListener("keyup",o,!1),this._domEventListenerCleanupQueue.push(()=>{e.removeEventListener("keyup",o,!1)})}_cleanupTemporaryNodesAndEdges(){for(let s=0;s=0;l--)if(s[l]!==this.selectedControlNode.id){a=this.body.nodes[s[l]];break}if(a!==void 0&&this.selectedControlNode!==void 0)if(a.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const l=this.body.nodes[this.temporaryIds.nodes[0]];this.selectedControlNode.id===l.id?this._performEditEdge(a.id,o.to.id):this._performEditEdge(o.from.id,a.id)}else o.updateEdgeType(),this.body.emitter.emit("restorePhysics");this.body.emitter.emit("_redraw")}_handleConnect(e){if(new Date().valueOf()-this.touchTime>100){this.lastTouch=this.body.functions.getPointer(e.center),this.lastTouch.translation=on({},this.body.view.translation),this.interactionHandler.drag.pointer=this.lastTouch,this.interactionHandler.drag.translation=this.lastTouch.translation;const n=this.lastTouch,i=this.selectionHandler.getNodeAt(n);if(i!==void 0)if(i.isCluster===!0)alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError);else{const o=this._getNewTargetNode(i.x,i.y);this.body.nodes[o.id]=o,this.body.nodeIndices.push(o.id);const s=this.body.functions.createEdge({id:"connectionEdge"+la(),from:i.id,to:o.id,physics:!1,smooth:{enabled:!0,type:"continuous",roundness:.5}});this.body.edges[s.id]=s,this.body.edgeIndices.push(s.id),this.temporaryIds.nodes.push(o.id),this.temporaryIds.edges.push(s.id)}this.touchTime=new Date().valueOf()}}_dragControlNode(e){const n=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(n);let o;this.temporaryIds.edges[0]!==void 0&&(o=this.body.edges[this.temporaryIds.edges[0]].fromId);const s=this.selectionHandler._getAllNodesOverlappingWith(i);let a;for(let C=s.length-1;C>=0;C--){var l;if(bt(l=this.temporaryIds.nodes).call(l,s[C])===-1){a=this.body.nodes[s[C]];break}}if(e.controlEdge={from:o,to:a?a.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragging",e,n),this.temporaryIds.nodes[0]!==void 0){const C=this.body.nodes[this.temporaryIds.nodes[0]];C.x=this.canvas._XconvertDOMtoCanvas(n.x),C.y=this.canvas._YconvertDOMtoCanvas(n.y),this.body.emitter.emit("_redraw")}else this.interactionHandler.onDrag(e)}_finishConnect(e){const n=this.body.functions.getPointer(e.center),i=this.selectionHandler._pointerToPositionObject(n);let o;this.temporaryIds.edges[0]!==void 0&&(o=this.body.edges[this.temporaryIds.edges[0]].fromId);const s=this.selectionHandler._getAllNodesOverlappingWith(i);let a;for(let C=s.length-1;C>=0;C--){var l;if(bt(l=this.temporaryIds.nodes).call(l,s[C])===-1){a=this.body.nodes[s[C]];break}}this._cleanupTemporaryNodesAndEdges(),a!==void 0&&(a.isCluster===!0?alert(this.options.locales[this.options.locale].createEdgeError||this.options.locales.en.createEdgeError):this.body.nodes[o]!==void 0&&this.body.nodes[a.id]!==void 0&&this._performAddEdge(o,a.id)),e.controlEdge={from:o,to:a?a.id:void 0},this.selectionHandler.generateClickEvent("controlNodeDragEnd",e,n),this.body.emitter.emit("_redraw")}_dragStartEdge(e){const n=this.lastTouch;this.selectionHandler.generateClickEvent("dragStart",e,n,void 0,!0)}_performAddNode(e){const n={id:la(),x:e.pointer.canvas.x,y:e.pointer.canvas.y,label:"new"};if(typeof this.options.addNode=="function")if(this.options.addNode.length===2)this.options.addNode(n,i=>{i!=null&&this.inMode==="addNode"&&this.body.data.nodes.getDataSet().add(i),this.showManipulatorToolbar()});else throw this.showManipulatorToolbar(),new Error("The function for add does not support two arguments (data,callback)");else this.body.data.nodes.getDataSet().add(n),this.showManipulatorToolbar()}_performAddEdge(e,n){const i={from:e,to:n};if(typeof this.options.addEdge=="function")if(this.options.addEdge.length===2)this.options.addEdge(i,o=>{o!=null&&this.inMode==="addEdge"&&(this.body.data.edges.getDataSet().add(o),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for connect does not support two arguments (data,callback)");else this.body.data.edges.getDataSet().add(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}_performEditEdge(e,n){const i={id:this.edgeBeingEditedId,from:e,to:n,label:this.body.data.edges.get(this.edgeBeingEditedId).label};let o=this.options.editEdge;if(typeof o=="object"&&(o=o.editWithoutDrag),typeof o=="function")if(o.length===2)o(i,s=>{s==null||this.inMode!=="editEdge"?(this.body.edges[i.id].updateEdgeType(),this.body.emitter.emit("_redraw"),this.showManipulatorToolbar()):(this.body.data.edges.getDataSet().update(s),this.selectionHandler.unselectAll(),this.showManipulatorToolbar())});else throw new Error("The function for edit does not support two arguments (data, callback)");else this.body.data.edges.getDataSet().update(i),this.selectionHandler.unselectAll(),this.showManipulatorToolbar()}}const we="string",fe="boolean",ee="number",vl="array",Le="object",bN="dom",Cle="any",Gp=["arrow","bar","box","circle","crow","curve","diamond","image","inv_curve","inv_triangle","triangle","vee"],Fp={borderWidth:{number:ee},borderWidthSelected:{number:ee,undefined:"undefined"},brokenImage:{string:we,undefined:"undefined"},chosen:{label:{boolean:fe,function:"function"},node:{boolean:fe,function:"function"},__type__:{object:Le,boolean:fe}},color:{border:{string:we},background:{string:we},highlight:{border:{string:we},background:{string:we},__type__:{object:Le,string:we}},hover:{border:{string:we},background:{string:we},__type__:{object:Le,string:we}},__type__:{object:Le,string:we}},opacity:{number:ee,undefined:"undefined"},fixed:{x:{boolean:fe},y:{boolean:fe},__type__:{object:Le,boolean:fe}},font:{align:{string:we},color:{string:we},size:{number:ee},face:{string:we},background:{string:we},strokeWidth:{number:ee},strokeColor:{string:we},vadjust:{number:ee},multi:{boolean:fe,string:we},bold:{color:{string:we},size:{number:ee},face:{string:we},mod:{string:we},vadjust:{number:ee},__type__:{object:Le,string:we}},boldital:{color:{string:we},size:{number:ee},face:{string:we},mod:{string:we},vadjust:{number:ee},__type__:{object:Le,string:we}},ital:{color:{string:we},size:{number:ee},face:{string:we},mod:{string:we},vadjust:{number:ee},__type__:{object:Le,string:we}},mono:{color:{string:we},size:{number:ee},face:{string:we},mod:{string:we},vadjust:{number:ee},__type__:{object:Le,string:we}},__type__:{object:Le,string:we}},group:{string:we,number:ee,undefined:"undefined"},heightConstraint:{minimum:{number:ee},valign:{string:we},__type__:{object:Le,boolean:fe,number:ee}},hidden:{boolean:fe},icon:{face:{string:we},code:{string:we},size:{number:ee},color:{string:we},weight:{string:we,number:ee},__type__:{object:Le}},id:{string:we,number:ee},image:{selected:{string:we,undefined:"undefined"},unselected:{string:we,undefined:"undefined"},__type__:{object:Le,string:we}},imagePadding:{top:{number:ee},right:{number:ee},bottom:{number:ee},left:{number:ee},__type__:{object:Le,number:ee}},label:{string:we,undefined:"undefined"},labelHighlightBold:{boolean:fe},level:{number:ee,undefined:"undefined"},margin:{top:{number:ee},right:{number:ee},bottom:{number:ee},left:{number:ee},__type__:{object:Le,number:ee}},mass:{number:ee},physics:{boolean:fe},scaling:{min:{number:ee},max:{number:ee},label:{enabled:{boolean:fe},min:{number:ee},max:{number:ee},maxVisible:{number:ee},drawThreshold:{number:ee},__type__:{object:Le,boolean:fe}},customScalingFunction:{function:"function"},__type__:{object:Le}},shadow:{enabled:{boolean:fe},color:{string:we},size:{number:ee},x:{number:ee},y:{number:ee},__type__:{object:Le,boolean:fe}},shape:{string:["custom","ellipse","circle","database","box","text","image","circularImage","diamond","dot","star","triangle","triangleDown","square","icon","hexagon"]},ctxRenderer:{function:"function"},shapeProperties:{borderDashes:{boolean:fe,array:vl},borderRadius:{number:ee},interpolation:{boolean:fe},useImageSize:{boolean:fe},useBorderWithImage:{boolean:fe},coordinateOrigin:{string:["center","top-left"]},__type__:{object:Le}},size:{number:ee},title:{string:we,dom:bN,undefined:"undefined"},value:{number:ee,undefined:"undefined"},widthConstraint:{minimum:{number:ee},maximum:{number:ee},__type__:{object:Le,boolean:fe,number:ee}},x:{number:ee},y:{number:ee},__type__:{object:Le}},Ile={configure:{enabled:{boolean:fe},filter:{boolean:fe,string:we,array:vl,function:"function"},container:{dom:bN},showButton:{boolean:fe},__type__:{object:Le,boolean:fe,string:we,array:vl,function:"function"}},edges:{arrows:{to:{enabled:{boolean:fe},scaleFactor:{number:ee},type:{string:Gp},imageHeight:{number:ee},imageWidth:{number:ee},src:{string:we},__type__:{object:Le,boolean:fe}},middle:{enabled:{boolean:fe},scaleFactor:{number:ee},type:{string:Gp},imageWidth:{number:ee},imageHeight:{number:ee},src:{string:we},__type__:{object:Le,boolean:fe}},from:{enabled:{boolean:fe},scaleFactor:{number:ee},type:{string:Gp},imageWidth:{number:ee},imageHeight:{number:ee},src:{string:we},__type__:{object:Le,boolean:fe}},__type__:{string:["from","to","middle"],object:Le}},endPointOffset:{from:{number:ee},to:{number:ee},__type__:{object:Le,number:ee}},arrowStrikethrough:{boolean:fe},background:{enabled:{boolean:fe},color:{string:we},size:{number:ee},dashes:{boolean:fe,array:vl},__type__:{object:Le,boolean:fe}},chosen:{label:{boolean:fe,function:"function"},edge:{boolean:fe,function:"function"},__type__:{object:Le,boolean:fe}},color:{color:{string:we},highlight:{string:we},hover:{string:we},inherit:{string:["from","to","both"],boolean:fe},opacity:{number:ee},__type__:{object:Le,string:we}},dashes:{boolean:fe,array:vl},font:{color:{string:we},size:{number:ee},face:{string:we},background:{string:we},strokeWidth:{number:ee},strokeColor:{string:we},align:{string:["horizontal","top","middle","bottom"]},vadjust:{number:ee},multi:{boolean:fe,string:we},bold:{color:{string:we},size:{number:ee},face:{string:we},mod:{string:we},vadjust:{number:ee},__type__:{object:Le,string:we}},boldital:{color:{string:we},size:{number:ee},face:{string:we},mod:{string:we},vadjust:{number:ee},__type__:{object:Le,string:we}},ital:{color:{string:we},size:{number:ee},face:{string:we},mod:{string:we},vadjust:{number:ee},__type__:{object:Le,string:we}},mono:{color:{string:we},size:{number:ee},face:{string:we},mod:{string:we},vadjust:{number:ee},__type__:{object:Le,string:we}},__type__:{object:Le,string:we}},hidden:{boolean:fe},hoverWidth:{function:"function",number:ee},label:{string:we,undefined:"undefined"},labelHighlightBold:{boolean:fe},length:{number:ee,undefined:"undefined"},physics:{boolean:fe},scaling:{min:{number:ee},max:{number:ee},label:{enabled:{boolean:fe},min:{number:ee},max:{number:ee},maxVisible:{number:ee},drawThreshold:{number:ee},__type__:{object:Le,boolean:fe}},customScalingFunction:{function:"function"},__type__:{object:Le}},selectionWidth:{function:"function",number:ee},selfReferenceSize:{number:ee},selfReference:{size:{number:ee},angle:{number:ee},renderBehindTheNode:{boolean:fe},__type__:{object:Le}},shadow:{enabled:{boolean:fe},color:{string:we},size:{number:ee},x:{number:ee},y:{number:ee},__type__:{object:Le,boolean:fe}},smooth:{enabled:{boolean:fe},type:{string:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"]},roundness:{number:ee},forceDirection:{string:["horizontal","vertical","none"],boolean:fe},__type__:{object:Le,boolean:fe}},title:{string:we,undefined:"undefined"},width:{number:ee},widthConstraint:{maximum:{number:ee},__type__:{object:Le,boolean:fe,number:ee}},value:{number:ee,undefined:"undefined"},__type__:{object:Le}},groups:{useDefaultGroups:{boolean:fe},__any__:Fp,__type__:{object:Le}},interaction:{dragNodes:{boolean:fe},dragView:{boolean:fe},hideEdgesOnDrag:{boolean:fe},hideEdgesOnZoom:{boolean:fe},hideNodesOnDrag:{boolean:fe},hover:{boolean:fe},keyboard:{enabled:{boolean:fe},speed:{x:{number:ee},y:{number:ee},zoom:{number:ee},__type__:{object:Le}},bindToWindow:{boolean:fe},autoFocus:{boolean:fe},__type__:{object:Le,boolean:fe}},multiselect:{boolean:fe},navigationButtons:{boolean:fe},selectable:{boolean:fe},selectConnectedEdges:{boolean:fe},hoverConnectedEdges:{boolean:fe},tooltipDelay:{number:ee},zoomView:{boolean:fe},zoomSpeed:{number:ee},__type__:{object:Le}},layout:{randomSeed:{undefined:"undefined",number:ee,string:we},improvedLayout:{boolean:fe},clusterThreshold:{number:ee},hierarchical:{enabled:{boolean:fe},levelSeparation:{number:ee},nodeSpacing:{number:ee},treeSpacing:{number:ee},blockShifting:{boolean:fe},edgeMinimization:{boolean:fe},parentCentralization:{boolean:fe},direction:{string:["UD","DU","LR","RL"]},sortMethod:{string:["hubsize","directed"]},shakeTowards:{string:["leaves","roots"]},__type__:{object:Le,boolean:fe}},__type__:{object:Le}},manipulation:{enabled:{boolean:fe},initiallyActive:{boolean:fe},addNode:{boolean:fe,function:"function"},addEdge:{boolean:fe,function:"function"},editNode:{function:"function"},editEdge:{editWithoutDrag:{function:"function"},__type__:{object:Le,boolean:fe,function:"function"}},deleteNode:{boolean:fe,function:"function"},deleteEdge:{boolean:fe,function:"function"},controlNodeStyle:Fp,__type__:{object:Le,boolean:fe}},nodes:Fp,physics:{enabled:{boolean:fe},barnesHut:{theta:{number:ee},gravitationalConstant:{number:ee},centralGravity:{number:ee},springLength:{number:ee},springConstant:{number:ee},damping:{number:ee},avoidOverlap:{number:ee},__type__:{object:Le}},forceAtlas2Based:{theta:{number:ee},gravitationalConstant:{number:ee},centralGravity:{number:ee},springLength:{number:ee},springConstant:{number:ee},damping:{number:ee},avoidOverlap:{number:ee},__type__:{object:Le}},repulsion:{centralGravity:{number:ee},springLength:{number:ee},springConstant:{number:ee},nodeDistance:{number:ee},damping:{number:ee},__type__:{object:Le}},hierarchicalRepulsion:{centralGravity:{number:ee},springLength:{number:ee},springConstant:{number:ee},nodeDistance:{number:ee},damping:{number:ee},avoidOverlap:{number:ee},__type__:{object:Le}},maxVelocity:{number:ee},minVelocity:{number:ee},solver:{string:["barnesHut","repulsion","hierarchicalRepulsion","forceAtlas2Based"]},stabilization:{enabled:{boolean:fe},iterations:{number:ee},updateInterval:{number:ee},onlyDynamicEdges:{boolean:fe},fit:{boolean:fe},__type__:{object:Le,boolean:fe}},timestep:{number:ee},adaptiveTimestep:{boolean:fe},wind:{x:{number:ee},y:{number:ee},__type__:{object:Le}},__type__:{object:Le,boolean:fe}},autoResize:{boolean:fe},clickToUse:{boolean:fe},locale:{string:we},locales:{__any__:{any:Cle},__type__:{object:Le}},height:{string:we},width:{string:we},__type__:{object:Le}},wN={nodes:{borderWidth:[1,0,10,1],borderWidthSelected:[2,0,10,1],color:{border:["color","#2B7CE9"],background:["color","#97C2FC"],highlight:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]},hover:{border:["color","#2B7CE9"],background:["color","#D2E5FF"]}},opacity:[0,0,1,.1],fixed:{x:!1,y:!1},font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[0,0,50,1],strokeColor:["color","#ffffff"]},hidden:!1,labelHighlightBold:!0,physics:!0,scaling:{min:[10,0,200,1],max:[30,0,200,1],label:{enabled:!1,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},shape:["ellipse","box","circle","database","diamond","dot","square","star","text","triangle","triangleDown","hexagon"],shapeProperties:{borderDashes:!1,borderRadius:[6,0,20,1],interpolation:!0,useImageSize:!1},size:[25,0,200,1]},edges:{arrows:{to:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},middle:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"},from:{enabled:!1,scaleFactor:[1,0,3,.05],type:"arrow"}},endPointOffset:{from:[0,-10,10,1],to:[0,-10,10,1]},arrowStrikethrough:!0,color:{color:["color","#848484"],highlight:["color","#848484"],hover:["color","#848484"],inherit:["from","to","both",!0,!1],opacity:[1,0,1,.05]},dashes:!1,font:{color:["color","#343434"],size:[14,0,100,1],face:["arial","verdana","tahoma"],background:["color","none"],strokeWidth:[2,0,50,1],strokeColor:["color","#ffffff"],align:["horizontal","top","middle","bottom"]},hidden:!1,hoverWidth:[1.5,0,5,.1],labelHighlightBold:!0,physics:!0,scaling:{min:[1,0,100,1],max:[15,0,100,1],label:{enabled:!0,min:[14,0,200,1],max:[30,0,200,1],maxVisible:[30,0,200,1],drawThreshold:[5,0,20,1]}},selectionWidth:[1.5,0,5,.1],selfReferenceSize:[20,0,200,1],selfReference:{size:[20,0,200,1],angle:[Math.PI/2,-6*Math.PI,6*Math.PI,Math.PI/8],renderBehindTheNode:!0},shadow:{enabled:!1,color:"rgba(0,0,0,0.5)",size:[10,0,20,1],x:[5,-30,30,1],y:[5,-30,30,1]},smooth:{enabled:!0,type:["dynamic","continuous","discrete","diagonalCross","straightCross","horizontal","vertical","curvedCW","curvedCCW","cubicBezier"],forceDirection:["horizontal","vertical","none"],roundness:[.5,0,1,.05]},width:[1,0,30,1]},layout:{hierarchical:{enabled:!1,levelSeparation:[150,20,500,5],nodeSpacing:[100,20,500,5],treeSpacing:[200,20,500,5],blockShifting:!0,edgeMinimization:!0,parentCentralization:!0,direction:["UD","DU","LR","RL"],sortMethod:["hubsize","directed"],shakeTowards:["leaves","roots"]}},interaction:{dragNodes:!0,dragView:!0,hideEdgesOnDrag:!1,hideEdgesOnZoom:!1,hideNodesOnDrag:!1,hover:!1,keyboard:{enabled:!1,speed:{x:[10,0,40,1],y:[10,0,40,1],zoom:[.02,0,.1,.005]},bindToWindow:!0,autoFocus:!0},multiselect:!1,navigationButtons:!1,selectable:!0,selectConnectedEdges:!0,hoverConnectedEdges:!0,tooltipDelay:[300,0,1e3,25],zoomView:!0,zoomSpeed:[1,.1,2,.1]},manipulation:{enabled:!1,initiallyActive:!1},physics:{enabled:!0,barnesHut:{theta:[.5,.1,1,.05],gravitationalConstant:[-2e3,-3e4,0,50],centralGravity:[.3,0,10,.05],springLength:[95,0,500,5],springConstant:[.04,0,1.2,.005],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},forceAtlas2Based:{theta:[.5,.1,1,.05],gravitationalConstant:[-50,-500,0,1],centralGravity:[.01,0,1,.005],springLength:[95,0,500,5],springConstant:[.08,0,1.2,.005],damping:[.4,0,1,.01],avoidOverlap:[0,0,1,.01]},repulsion:{centralGravity:[.2,0,10,.05],springLength:[200,0,500,5],springConstant:[.05,0,1.2,.005],nodeDistance:[100,0,500,5],damping:[.09,0,1,.01]},hierarchicalRepulsion:{centralGravity:[.2,0,10,.05],springLength:[100,0,500,5],springConstant:[.01,0,1.2,.005],nodeDistance:[120,0,500,5],damping:[.09,0,1,.01],avoidOverlap:[0,0,1,.01]},maxVelocity:[50,0,150,1],minVelocity:[.1,.01,.5,.01],solver:["barnesHut","forceAtlas2Based","repulsion","hierarchicalRepulsion"],timestep:[.5,.01,1,.01],wind:{x:[0,-10,10,.1],y:[0,-10,10,.1]}}},cle=(t,e,n)=>{var i;return!!(Mr(t).call(t,"physics")&&Mr(i=wN.physics.solver).call(i,e)&&n.physics.solver!==e&&e!=="wind")};class dle{constructor(){}getDistances(e,n,i){const o={},s=e.edges;for(let l=0;l2&&arguments[2]!==void 0?arguments[2]:!1;const o=this.distanceSolver.getDistances(this.body,e,n);this._createL_matrix(o),this._createK_matrix(o),this._createE_matrix();const s=.01,a=1;let l=0;const C=Math.max(1e3,Math.min(10*this.body.nodeIndices.length,6e3)),c=5;let u=1e9,h=0,m=0,v=0,b=0,x=0;for(;u>s&&la&&xthis.body.emitter.emit("_requestRedraw")),this.groups=new Qne,this.canvas=new AAe(this.body),this.selectionHandler=new VAe(this.body,this.canvas),this.interactionHandler=new dAe(this.body,this.canvas,this.selectionHandler),this.view=new CAe(this.body,this.canvas),this.renderer=new oAe(this.body,this.canvas),this.physics=new tAe(this.body),this.layoutEngine=new ale(this.body),this.clustering=new iAe(this.body),this.manipulation=new lle(this.body,this.canvas,this.selectionHandler,this.interactionHandler),this.nodesHandler=new Sae(this.body,this.images,this.groups,this.layoutEngine),this.edgesHandler=new Kae(this.body,this.images,this.groups),this.body.modules.kamadaKawai=new ule(this.body,150,.05),this.body.modules.clustering=this.clustering,this.canvas._create(),this.setOptions(n),this.setData(e)}aS(je.prototype),je.prototype.setOptions=function(t){if(t===null&&(t=void 0),t!==void 0){if(Fee.validate(t,Ile)===!0&&console.error("%cErrors have been found in the supplied options object.",AT),oa(["locale","locales","clickToUse"],this.options,t),t.locale!==void 0&&(t.locale=tte(t.locales||this.options.locales,t.locale)),t=this.layoutEngine.setOptions(t.layout,t),this.canvas.setOptions(t),this.groups.setOptions(t.groups),this.nodesHandler.setOptions(t.nodes),this.edgesHandler.setOptions(t.edges),this.physics.setOptions(t.physics),this.manipulation.setOptions(t.manipulation,t,this.options),this.interactionHandler.setOptions(t.interaction),this.renderer.setOptions(t.interaction),this.selectionHandler.setOptions(t.interaction),t.groups!==void 0&&this.body.emitter.emit("refreshNodes"),"configure"in t&&(this.configurator||(this.configurator=new Zee(this,this.body.container,wN,this.canvas.pixelRatio,cle)),this.configurator.setOptions(t.configure)),this.configurator&&this.configurator.options.enabled===!0){const i={nodes:{},edges:{},layout:{},interaction:{},manipulation:{},physics:{},global:{}};Dt(i.nodes,this.nodesHandler.options),Dt(i.edges,this.edgesHandler.options),Dt(i.layout,this.layoutEngine.options),Dt(i.interaction,this.selectionHandler.options),Dt(i.interaction,this.renderer.options),Dt(i.interaction,this.interactionHandler.options),Dt(i.manipulation,this.manipulation.options),Dt(i.physics,this.physics.options),Dt(i.global,this.canvas.options),Dt(i.global,this.options),this.configurator.setModuleOptions(i)}t.clickToUse!==void 0?t.clickToUse===!0?this.activator===void 0&&(this.activator=new Bee(this.canvas.frame),this.activator.on("change",()=>{this.body.emitter.emit("activate")})):(this.activator!==void 0&&(this.activator.destroy(),delete this.activator),this.body.emitter.emit("activate")):this.body.emitter.emit("activate"),this.canvas.setSize(),this.body.emitter.emit("startSimulation")}},je.prototype._updateVisibleIndices=function(){const t=this.body.nodes,e=this.body.edges;this.body.nodeIndices=[],this.body.edgeIndices=[];for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&!this.clustering._isClusteredNode(n)&&t[n].options.hidden===!1&&this.body.nodeIndices.push(t[n].id);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)){const i=e[n],o=t[i.fromId],s=t[i.toId],a=o!==void 0&&s!==void 0;!this.clustering._isClusteredEdge(n)&&i.options.hidden===!1&&a&&o.options.hidden===!1&&s.options.hidden===!1&&this.body.edgeIndices.push(i.id)}},je.prototype.bindEventListeners=function(){this.body.emitter.on("_dataChanged",()=>{this.edgesHandler._updateState(),this.body.emitter.emit("_dataUpdated")}),this.body.emitter.on("_dataUpdated",()=>{this.clustering._updateState(),this._updateVisibleIndices(),this._updateValueRange(this.body.nodes),this._updateValueRange(this.body.edges),this.body.emitter.emit("startSimulation"),this.body.emitter.emit("_requestRedraw")})},je.prototype.setData=function(t){if(this.body.emitter.emit("resetPhysics"),this.body.emitter.emit("_resetData"),this.selectionHandler.unselectAll(),t&&t.dot&&(t.nodes||t.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(t&&t.options),t&&t.dot){console.warn("The dot property has been deprecated. Please use the static convertDot method to convert DOT into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertDot(dotString);");const e=qee(t.dot);this.setData(e);return}else if(t&&t.gephi){console.warn("The gephi property has been deprecated. Please use the static convertGephi method to convert gephi into vis.network format and use the normal data format with nodes and edges. This converter is used like this: var data = vis.network.convertGephi(gephiJson);");const e=Jee(t.gephi);this.setData(e);return}else this.nodesHandler.setData(t&&t.nodes,!0),this.edgesHandler.setData(t&&t.edges,!0);this.body.emitter.emit("_dataChanged"),this.body.emitter.emit("_dataLoaded"),this.body.emitter.emit("initPhysics")},je.prototype.destroy=function(){this.body.emitter.emit("destroy"),this.body.emitter.off(),this.off(),delete this.groups,delete this.canvas,delete this.selectionHandler,delete this.interactionHandler,delete this.view,delete this.renderer,delete this.physics,delete this.layoutEngine,delete this.clustering,delete this.manipulation,delete this.nodesHandler,delete this.edgesHandler,delete this.configurator,delete this.images;for(const t in this.body.nodes)Object.prototype.hasOwnProperty.call(this.body.nodes,t)&&delete this.body.nodes[t];for(const t in this.body.edges)Object.prototype.hasOwnProperty.call(this.body.edges,t)&&delete this.body.edges[t];Dr(this.body.container)},je.prototype._updateValueRange=function(t){let e,n,i,o=0;for(e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const s=t[e].getValue();s!==void 0&&(n=n===void 0?s:Math.min(s,n),i=i===void 0?s:Math.max(s,i),o+=s)}if(n!==void 0&&i!==void 0)for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&t[e].setValueRange(n,i,o)},je.prototype.isActive=function(){return!this.activator||this.activator.active},je.prototype.setSize=function(){return this.canvas.setSize.apply(this.canvas,arguments)},je.prototype.canvasToDOM=function(){return this.canvas.canvasToDOM.apply(this.canvas,arguments)},je.prototype.DOMtoCanvas=function(){return this.canvas.DOMtoCanvas.apply(this.canvas,arguments)},je.prototype.findNode=function(){return this.clustering.findNode.apply(this.clustering,arguments)},je.prototype.isCluster=function(){return this.clustering.isCluster.apply(this.clustering,arguments)},je.prototype.openCluster=function(){return this.clustering.openCluster.apply(this.clustering,arguments)},je.prototype.cluster=function(){return this.clustering.cluster.apply(this.clustering,arguments)},je.prototype.getNodesInCluster=function(){return this.clustering.getNodesInCluster.apply(this.clustering,arguments)},je.prototype.clusterByConnection=function(){return this.clustering.clusterByConnection.apply(this.clustering,arguments)},je.prototype.clusterByHubsize=function(){return this.clustering.clusterByHubsize.apply(this.clustering,arguments)},je.prototype.updateClusteredNode=function(){return this.clustering.updateClusteredNode.apply(this.clustering,arguments)},je.prototype.getClusteredEdges=function(){return this.clustering.getClusteredEdges.apply(this.clustering,arguments)},je.prototype.getBaseEdge=function(){return this.clustering.getBaseEdge.apply(this.clustering,arguments)},je.prototype.getBaseEdges=function(){return this.clustering.getBaseEdges.apply(this.clustering,arguments)},je.prototype.updateEdge=function(){return this.clustering.updateEdge.apply(this.clustering,arguments)},je.prototype.clusterOutliers=function(){return this.clustering.clusterOutliers.apply(this.clustering,arguments)},je.prototype.getSeed=function(){return this.layoutEngine.getSeed.apply(this.layoutEngine,arguments)},je.prototype.enableEditMode=function(){return this.manipulation.enableEditMode.apply(this.manipulation,arguments)},je.prototype.disableEditMode=function(){return this.manipulation.disableEditMode.apply(this.manipulation,arguments)},je.prototype.addNodeMode=function(){return this.manipulation.addNodeMode.apply(this.manipulation,arguments)},je.prototype.editNode=function(){return this.manipulation.editNode.apply(this.manipulation,arguments)},je.prototype.editNodeMode=function(){return console.warn("Deprecated: Please use editNode instead of editNodeMode."),this.manipulation.editNode.apply(this.manipulation,arguments)},je.prototype.addEdgeMode=function(){return this.manipulation.addEdgeMode.apply(this.manipulation,arguments)},je.prototype.editEdgeMode=function(){return this.manipulation.editEdgeMode.apply(this.manipulation,arguments)},je.prototype.deleteSelected=function(){return this.manipulation.deleteSelected.apply(this.manipulation,arguments)},je.prototype.getPositions=function(){return this.nodesHandler.getPositions.apply(this.nodesHandler,arguments)},je.prototype.getPosition=function(){return this.nodesHandler.getPosition.apply(this.nodesHandler,arguments)},je.prototype.storePositions=function(){return this.nodesHandler.storePositions.apply(this.nodesHandler,arguments)},je.prototype.moveNode=function(){return this.nodesHandler.moveNode.apply(this.nodesHandler,arguments)},je.prototype.getBoundingBox=function(){return this.nodesHandler.getBoundingBox.apply(this.nodesHandler,arguments)},je.prototype.getConnectedNodes=function(t){return this.body.nodes[t]!==void 0?this.nodesHandler.getConnectedNodes.apply(this.nodesHandler,arguments):this.edgesHandler.getConnectedNodes.apply(this.edgesHandler,arguments)},je.prototype.getConnectedEdges=function(){return this.nodesHandler.getConnectedEdges.apply(this.nodesHandler,arguments)},je.prototype.startSimulation=function(){return this.physics.startSimulation.apply(this.physics,arguments)},je.prototype.stopSimulation=function(){return this.physics.stopSimulation.apply(this.physics,arguments)},je.prototype.stabilize=function(){return this.physics.stabilize.apply(this.physics,arguments)},je.prototype.getSelection=function(){return this.selectionHandler.getSelection.apply(this.selectionHandler,arguments)},je.prototype.setSelection=function(){return this.selectionHandler.setSelection.apply(this.selectionHandler,arguments)},je.prototype.getSelectedNodes=function(){return this.selectionHandler.getSelectedNodeIds.apply(this.selectionHandler,arguments)},je.prototype.getSelectedEdges=function(){return this.selectionHandler.getSelectedEdgeIds.apply(this.selectionHandler,arguments)},je.prototype.getNodeAt=function(){const t=this.selectionHandler.getNodeAt.apply(this.selectionHandler,arguments);return t!==void 0&&t.id!==void 0?t.id:t},je.prototype.getEdgeAt=function(){const t=this.selectionHandler.getEdgeAt.apply(this.selectionHandler,arguments);return t!==void 0&&t.id!==void 0?t.id:t},je.prototype.selectNodes=function(){return this.selectionHandler.selectNodes.apply(this.selectionHandler,arguments)},je.prototype.selectEdges=function(){return this.selectionHandler.selectEdges.apply(this.selectionHandler,arguments)},je.prototype.unselectAll=function(){this.selectionHandler.unselectAll.apply(this.selectionHandler,arguments),this.selectionHandler.commitWithoutEmitting.apply(this.selectionHandler),this.redraw()},je.prototype.redraw=function(){return this.renderer.redraw.apply(this.renderer,arguments)},je.prototype.getScale=function(){return this.view.getScale.apply(this.view,arguments)},je.prototype.getViewPosition=function(){return this.view.getViewPosition.apply(this.view,arguments)},je.prototype.fit=function(){return this.view.fit.apply(this.view,arguments)},je.prototype.moveTo=function(){return this.view.moveTo.apply(this.view,arguments)},je.prototype.focus=function(){return this.view.focus.apply(this.view,arguments)},je.prototype.releaseNode=function(){return this.view.releaseNode.apply(this.view,arguments)},je.prototype.getOptionsFromConfigurator=function(){let t={};return this.configurator&&(t=this.configurator.getOptions.apply(this.configurator)),t};function hle(t,e){t.on("click",n=>{e.onHover(null),n.edges.length===0&&e.onHoverEdge(null);const i=n.nodes[0];i!==void 0?e.onFocus(String(i)):e.onClear()}),t.on("doubleClick",n=>{const i=n.nodes[0];if(i!==void 0){e.onOpenSource(String(i));return}const o=n.edges[0];o!==void 0&&e.onOpenRelationshipSource(String(o))}),t.on("hoverNode",n=>{n.node!==void 0&&(e.onInteractionStart(),e.onHoverEdge(null),e.onHover({nodeId:String(n.node),x:n.pointer.DOM.x,y:n.pointer.DOM.y}))}),t.on("blurNode",()=>e.onHover(null)),t.on("hoverEdge",n=>{n.edge!==void 0&&(e.onHover(null),e.onHoverEdge({edgeId:String(n.edge),x:n.pointer.DOM.x,y:n.pointer.DOM.y}))}),t.on("blurEdge",()=>e.onHoverEdge(null)),t.on("dragStart",()=>{e.onInteractionStart(),e.onHover(null),e.onHoverEdge(null)}),t.on("zoom",()=>{e.onHover(null),e.onHoverEdge(null)})}const fle=1e3,ple=4e3,Vp=4e3;function xN(t){return t.nodes.length>=fle||t.edges.length>=ple?"static":"interactive"}function Up(t){return xN(t)==="interactive"}function mle(t,e=!1){if(e)return NN(t);const n=new Map;for(const C of t){const c=n.get(C.community)??[];c.push(C),n.set(C.community,c)}const i=[...n.entries()].sort(([C,c],[u,h])=>h.length-c.length||C-u).map(([C,c])=>({community:C,members:c.sort((u,h)=>u.id.localeCompare(h.id))})),o=i.map(C=>Rle(C.members.length)),s=_le(i.map((C,c)=>({id:String(C.community),radius:o[c]??0}))),a=Math.PI*(3-Math.sqrt(5)),l=new Map;for(const C of i){const c=s.get(String(C.community))??{x:0,y:0};C.members.forEach((u,h)=>{if(h===0){l.set(u.id,{x:c.x,y:c.y});return}const m=24*Math.sqrt(h),v=h*a;l.set(u.id,{x:c.x+Math.cos(v)*m,y:c.y+Math.sin(v)*m})})}return l}function vle(t,e,n=!1){const i=[...t].sort((o,s)=>o.community-s.community||(s.degree??0)-(o.degree??0)||o.id.localeCompare(s.id));if(e==="circle"){const o=Math.max(160,i.length*44/(2*Math.PI));return new Map(i.map((s,a)=>{const l=-Math.PI/2+a*2*Math.PI/Math.max(1,i.length);return[s.id,{x:Math.cos(l)*o,y:Math.sin(l)*o}]}))}if(e==="concentric"){const o=[...t].sort((s,a)=>(a.degree??0)-(s.degree??0)||(a.memberCount??0)-(s.memberCount??0)||s.community-a.community||s.id.localeCompare(a.id));return ble(o)}return e==="hierarchical"?yle(i):e==="spiral"?wle(i):xle(i,n)}function yle(t){const e=new Map;for(const o of t){const s=o.depth??(o.root?0:1),a=e.get(s)??[];a.push(o),e.set(s,a)}const n=[...e.entries()].sort(([o],[s])=>o-s),i=new Map;for(const[o,s]of n){s.sort((l,C)=>Number(C.root??!1)-Number(l.root??!1)||(C.degree??0)-(l.degree??0)||l.id.localeCompare(C.id));const a=148;s.forEach((l,C)=>i.set(l.id,{x:(C-(s.length-1)/2)*a,y:o*168}))}return i}function ble(t){const e=new Map,n=t[0];if(!n)return e;e.set(n.id,{x:0,y:0});let i=1,o=1;for(;i{if(o===0)return[i.id,{x:0,y:0}];const s=36*Math.sqrt(o),a=o*.52;return[i.id,{x:Math.cos(a)*s,y:Math.sin(a)*s}]}))}function xle(t,e){const s=new Map;t.forEach((b,x)=>{const y=e?Math.floor(x/16):b.community,S=s.get(y)??[];S.push(b),s.set(y,S)});const a=[...s.entries()].sort(([b],[x])=>b-x).map(([b,x])=>{const y=Math.max(1,Math.ceil(Math.sqrt(x.length))),S=Math.max(1,Math.ceil(x.length/y));return{key:b,members:x,columns:y,rows:S,width:(y-1)*56,height:(S-1)*56}}),l=Math.max(1,Math.ceil(Math.sqrt(a.length))),C=Math.max(1,Math.ceil(a.length/l)),c=Array.from({length:l},()=>0),u=Array.from({length:C},()=>0);a.forEach((b,x)=>{const y=x%l,S=Math.floor(x/l);c[y]=Math.max(c[y]??0,b.width),u[S]=Math.max(u[S]??0,b.height)});const h=SN(c,112),m=SN(u,112),v=new Map;return a.forEach((b,x)=>{const y=x%l,S=Math.floor(x/l);b.members.forEach((T,O)=>{const M=Math.floor(O/b.columns),k=Math.min(b.columns,b.members.length-M*b.columns),G=O%b.columns;v.set(T.id,{x:(h[y]??0)+(G-(k-1)/2)*56,y:(m[S]??0)+(M-(b.rows-1)/2)*56})})}),v}function SN(t,e){let i=-(t.reduce((o,s)=>o+s,0)+Math.max(0,t.length-1)*e)/2;return t.map(o=>{const s=i+o/2;return i+=o+e,s})}function EN(t){if(!t.stats.aggregated||t.edges.length<=Vp)return t.edges;const e=[...t.edges].sort((a,l)=>(l.weight??TN(l.relation))-(a.weight??TN(a.relation))||a.source.localeCompare(l.source)||a.target.localeCompare(l.target)||a.id.localeCompare(l.id)),n=new Map(t.nodes.map(a=>[a.id,a.id])),i=a=>{let l=n.get(a)??a;for(;n.get(l)!==void 0&&n.get(l)!==l;)l=n.get(l);let C=a;for(;n.get(C)!==void 0&&n.get(C)!==l;){const c=n.get(C);n.set(C,l),C=c}return l},o=[],s=new Set;for(const a of e){const l=i(a.source),C=i(a.target);if(l!==C&&(n.set(C,l),o.push(a),s.add(a.id),o.length===Vp))return o}for(const a of e)if(!s.has(a.id)&&(o.push(a),o.length===Vp))break;return o}function TN(t){const e=Number.parseInt(t,10);return Number.isFinite(e)&&e>0?e:1}const io=14,Sle=1.35,Ele=24,Tle=1.6,Hp=10,Ole=28,Nle=104,Mle=3.9;function Rle(t){return Ele*Math.sqrt(Math.max(1,t-1))+18}function ON(t,e){const n=t.size??12;if(!e)return{id:t.id,halfWidth:n+Hp*.6,halfHeight:n+Hp*.6};const i=k0(t.label).length;return{id:t.id,halfWidth:Math.max(n,Math.min(Nle,i*Mle))+Hp,halfHeight:n+Ole}}function NN(t,e){const n=kN(t,e),i=bu(n,e),o=n.map(a=>ON(a,i.has(a.id))),s=kle(n,o);return RN(DN(n,s,e),o)}function kle(t,e){const n=e.reduce((s,a)=>s+4*a.halfWidth*a.halfHeight,0)/Math.max(1,e.length),i=Math.sqrt(n/Math.PI);return new Map(t.map((s,a)=>[s.id,a===0?{x:0,y:0}:{x:Math.cos(MN(s.id))*i*Math.sqrt(a),y:Math.sin(MN(s.id))*i*Math.sqrt(a)}]))}function MN(t){let e=2166136261;for(let n=0;n>>0)%4096/4096*Math.PI*2}function RN(t,e){const n=new Map(e.map(v=>[v.id,v])),i=[...t.entries()].sort(([v],[b])=>v.localeCompare(b));if(i.length===0)return t;let o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(const[v,{x:b,y:x}]of i){const y=n.get(v);o=Math.min(o,b-(y?.halfWidth??0)),s=Math.max(s,b+(y?.halfWidth??0)),a=Math.min(a,x-(y?.halfHeight??0)),l=Math.max(l,x+(y?.halfHeight??0))}const C=Math.max(1,s-o),c=Math.max(1,l-a),u=Math.min(Tle,Math.max(1,Sle*c/C)),h=(o+s)/2,m=(a+l)/2;return new Map(i.map(([v,{x:b,y:x}])=>[v,{x:(b-h)*u,y:x-m}]))}function kN(t,e){return[...t].sort((n,i)=>(e?.get(i.id)??0)-(e?.get(n.id)??0)||(i.memberCount??0)-(n.memberCount??0)||(i.degree??0)-(n.degree??0)||n.id.localeCompare(i.id))}function Dle(t,e,n,i=.7){const o=kN(t,n).filter(u=>e.has(u.id));if(o.length<2)return new Map(e);let s=0,a=0;for(const u of o){const h=e.get(u.id);s+=h.x,a+=h.y}s/=o.length,a/=o.length;const l=o.reduce((u,h)=>{const m=e.get(h.id);return Math.max(u,Math.hypot(m.x-s,m.y-a))},0)||1,C=Math.PI*(3-Math.sqrt(5)),c=Math.min(1,Math.max(0,i));return new Map(o.map((u,h)=>{const m=e.get(u.id),v=m.x-s,b=m.y-a,x=Math.hypot(v,b),y=l*Math.sqrt(h/(o.length-1)),S=x>1e-6?Math.atan2(b,v):h*C,T=x*(1-c)+y*c;return[u.id,{x:s+Math.cos(S)*T,y:a+Math.sin(S)*T}]}))}function _le(t){const e=new Map;if(t.length===0)return e;const n=t.reduce((h,m)=>Math.max(h,m.radius),0),i=t.reduce((h,m)=>h+m.radius,0)/t.length,o=Math.max(48,n*2+io),s=Math.PI*(3-Math.sqrt(5)),a=new Map,l=(h,m)=>`${Math.floor(h/o)}:${Math.floor(m/o)}`,C=(h,m,v)=>{const b=Math.floor(h/o),x=Math.floor(m/o);for(let y=-1;y<=1;y+=1)for(let S=-1;S<=1;S+=1)for(const T of a.get(`${b+y}:${x+S}`)??[])if(Math.hypot(T.x-h,T.y-m){e.set(h.id,{x:m,y:v});const b=l(m,v),x=a.get(b)??[];x.push({x:m,y:v,radius:h.radius}),a.set(b,x)},u=2*i+io;return t.forEach((h,m)=>{if(m===0){c(h,0,0);return}const v=u*Math.sqrt(m),b=m*s,x={x:Math.cos(b)*v,y:Math.sin(b)*v};if(C(x.x,x.y,h.radius)){c(h,x.x,x.y);return}const y=Math.max(10,h.radius*.4+io*.5);for(let S=1;S<=480;S+=1){const T=S*s,O=y*Math.sqrt(S),M=x.x+Math.cos(T)*O,k=x.y+Math.sin(T)*O;if(C(M,k,h.radius)){c(h,M,k);return}}c(h,x.x,x.y)}),RN(e,t.map(h=>({id:h.id,halfWidth:h.radius,halfHeight:h.radius})))}function jle(t,e,n=48){const i=[...t].sort((u,h)=>u.id.localeCompare(h.id)).flatMap(u=>{const h=e.get(u.id);return h?[{...u,x:h.x,y:h.y}]:[]}).map((u,h)=>({...u,index:h}));if(i.length<2)return new Map(i.map(u=>[u.id,{x:u.x,y:u.y}]));const s=i.reduce((u,h)=>Math.max(u,h.halfWidth,h.halfHeight),1)*2+io,a=u=>{const h=[],m=Math.floor((u.x-u.halfWidth-io)/s),v=Math.floor((u.x+u.halfWidth+io)/s),b=Math.floor((u.y-u.halfHeight-io)/s),x=Math.floor((u.y+u.halfHeight+io)/s);for(let y=m;y<=v;y+=1)for(let S=b;S<=x;S+=1)h.push(`${y}:${S}`);return h},l=Math.max(1,Math.min(Math.trunc(n),Math.max(8,Math.ceil(24e3/i.length)))),C=i.length,c=new Set;for(let u=0;u[u.id,{x:u.x,y:u.y}]))}function DN(t,e,n,i=48){const o=bu(t,n);return jle(t.map(s=>ON(s,o.has(s.id))),e,i)}const Yp=3,_N={focusedNodeId:null,physicsRunning:!1,layoutStyle:"automatic",initialLayoutPending:!1,forceLabels:!1,showEdgeLabels:!1,isolateSelection:!1,neighborhoodDepth:1,edgeDirection:"both",layoutSpacing:Yp,showMinimap:!0,hiddenCommunities:new Set,hiddenChanges:new Set,query:""};function zle(t,e="automatic"){return e!=="automatic"?{..._N,layoutStyle:e,physicsRunning:!1,initialLayoutPending:!1}:{..._N,physicsRunning:!1,initialLayoutPending:!1}}function Ple(t,e){switch(e.type){case"focus":return{...t,focusedNodeId:e.nodeId,physicsRunning:!1};case"clearFocus":return{...t,focusedNodeId:null,isolateSelection:!1};case"stabilized":return t.physicsRunning||t.initialLayoutPending?{...t,physicsRunning:!1,initialLayoutPending:!1}:t;case"revealLayout":return{...t,physicsRunning:!1,initialLayoutPending:!1};case"setPhysics":return{...t,physicsRunning:e.running};case"setLayout":return{...t,layoutStyle:e.layout,physicsRunning:e.runPhysics,initialLayoutPending:!1};case"setLabels":return{...t,forceLabels:e.visible};case"setEdgeLabels":return{...t,showEdgeLabels:e.visible};case"setIsolation":return{...t,isolateSelection:e.isolated};case"setNeighborhoodDepth":return{...t,neighborhoodDepth:Math.max(1,Math.min(4,Math.trunc(e.depth)))};case"setEdgeDirection":return{...t,edgeDirection:e.direction};case"setLayoutSpacing":return{...t,layoutSpacing:e.spacing};case"setMinimap":return{...t,showMinimap:e.visible};case"search":return{...t,query:e.query};case"toggleCommunity":{const n=new Set(t.hiddenCommunities);return n.has(e.communityId)?n.delete(e.communityId):n.add(e.communityId),{...t,hiddenCommunities:n}}case"setHiddenCommunities":return{...t,hiddenCommunities:new Set(e.communityIds)};case"toggleChange":{const n=new Set(t.hiddenChanges);return n.has(e.change)?n.delete(e.change):n.add(e.change),{...t,hiddenChanges:n}}}}const Ec=176,Tc=108,jN=8,Lle=1500,Ble=2e3;function Zle(t){const e=[...t.positions.values()],n=t.viewport.left+t.viewport.width,i=t.viewport.top+t.viewport.height,o=[...e.map(L=>L.x),t.viewport.left,n],s=[...e.map(L=>L.y),t.viewport.top,i],a=Math.min(...o),l=Math.max(...o),C=Math.min(...s),c=Math.max(...s),u=Math.max(1,l-a),h=Math.max(1,c-C),m=Ec-jN*2,v=Tc-jN*2,b=Math.min(m/u,v/h),x=u*b,y=h*b,S=(Ec-x)/2,T=(Tc-y)/2,O=({x:L,y:F})=>({x:S+(L-a)*b,y:T+(F-C)*b}),M=({x:L,y:F})=>({x:a+(L-S)/b,y:C+(F-T)/b}),k=O({x:t.viewport.left,y:t.viewport.top}),G=O({x:n,y:i});return{project:O,unproject:M,viewport:{x:k.x,y:k.y,width:G.x-k.x,height:G.y-k.y}}}function Gle({model:t,snapshot:e,visibleNodeIds:n,visibleEdgeIds:i,focusedNodeId:o,semanticDetail:s=!1,onNavigate:a}){const l=E.useMemo(()=>Zle(e),[e]),C=E.useMemo(()=>t.nodes.filter(v=>!n||n.has(v.id)).sort((v,b)=>v.id.localeCompare(b.id)),[t.nodes,n]),c=C.slice(0,Lle),u=E.useMemo(()=>t.edges.filter(v=>(!i||i.has(v.id))&&(!n||n.has(v.source)&&n.has(v.target))).sort((v,b)=>v.id.localeCompare(b.id)).slice(0,Ble),[t.edges,i,n]),h=E.useMemo(()=>new Map(t.communities.map(v=>[v.id,v.color])),[t.communities]),m=v=>{const b=v.currentTarget.getBoundingClientRect();b.width<=0||b.height<=0||a(l.unproject({x:(v.clientX-b.left)/b.width*Ec,y:(v.clientY-b.top)/b.height*Tc}))};return d.jsxs("aside",{className:"compass-minimap compass-glass-panel","aria-label":"Graph overview",children:[d.jsxs("header",{children:[d.jsx("span",{children:"Map"}),d.jsx("small",{children:c.length{const b=e.positions.get(v.source),x=e.positions.get(v.target);if(!b||!x)return null;const y=l.project(b),S=l.project(x);return d.jsx("line",{x1:y.x,y1:y.y,x2:S.x,y2:S.y},v.id)})}),d.jsx("g",{className:"compass-minimap-nodes",children:c.map(v=>{const b=e.positions.get(v.id);if(!b)return null;const x=l.project(b);return d.jsx("circle",{cx:x.x,cy:x.y,r:v.id===o?3:1.65,fill:s?wB(yg(v.kind)):v.color?.background??h.get(v.community)??"currentColor","data-node-category":s?yg(v.kind):void 0,"data-focused":v.id===o?"true":void 0},v.id)})}),d.jsx("rect",{className:"compass-minimap-viewport",x:l.viewport.x,y:l.viewport.y,width:l.viewport.width,height:l.viewport.height,rx:"2"})]})})]})}const zN={added:{background:"#14351f",border:"#4fbe6b"},removed:{background:"#3d1c20",border:"#e06c75"},changed:{background:"#332a15",border:"#c9902c"},unchanged:{background:"#20262e",border:"#7a838e"}},Fle={callable:{background:"#123048",border:"#4e9bd6"},type:{background:"#382a16",border:"#c4814c"},module:{background:"#0f322e",border:"#43b39e"},boundary:{background:"#3a2320",border:"#d9755f"},other:{background:"#222831",border:"#8593a3"}},PN={execution:"#4e9bd6",dependency:"#43b39e",structure:"#d2a15c",flow:"#c07bb4",other:"#8593a3"},Vle=200,Ule=1500,LN="#8D97A3",BN="#6B7581",ZN=.1,Hle=3,Yle=18,$le=96,Wle=1500;function Kle(t,e){const n=[...e].sort().slice(0,Wle),i=t.getPositions(n),o=Object.values(i),s=o.length===0?0:Math.max(Math.max(...o.map(({x:C})=>C))-Math.min(...o.map(({x:C})=>C)),Math.max(...o.map(({y:C})=>C))-Math.min(...o.map(({y:C})=>C))),a=Math.min($le,Math.max(Yle,s*.012)),l=Math.PI*(3-Math.sqrt(5));n.forEach((C,c)=>{const u=i[C];if(!u)return;const h=c*l;t.moveNode(C,u.x+Math.cos(h)*a,u.y+Math.sin(h)*a)})}function da(t){return window.matchMedia("(prefers-reduced-motion: reduce)").matches?!1:{duration:t,easingFunction:"easeInOutQuad"}}function Xle(t,e){return!t.physics||typeof t.physics!="object"?{...t,physics:{enabled:e}}:{...t,physics:{...t.physics,enabled:e}}}const Qle={autoResize:!0,interaction:{hover:!0,tooltipDelay:100,hideEdgesOnDrag:!0,navigationButtons:!1,keyboard:{enabled:!0,bindToWindow:!1,autoFocus:!1}},layout:{improvedLayout:!1,randomSeed:17},nodes:{borderWidth:1.5,shape:"dot"},edges:{arrows:{to:{enabled:!0,scaleFactor:.5}},smooth:{enabled:!0,type:"continuous",roundness:.2},selectionWidth:3},physics:{enabled:!0,solver:"forceAtlas2Based",stabilization:{enabled:!0,iterations:200,fit:!0,updateInterval:20},forceAtlas2Based:{gravitationalConstant:-60,centralGravity:.005,springLength:120,springConstant:.08,damping:.4,avoidOverlap:.8}}},qle={autoResize:!0,interaction:{hover:!0,tooltipDelay:100,hideEdgesOnDrag:!0,navigationButtons:!1,keyboard:{enabled:!0,bindToWindow:!1,autoFocus:!1}},layout:{improvedLayout:!1,randomSeed:17},nodes:{borderWidth:2,shape:"dot"},edges:{arrows:{to:{enabled:!1}},chosen:!1,smooth:{enabled:!0,type:"continuous",roundness:.24},selectionWidth:3},physics:{enabled:!1,solver:"forceAtlas2Based",stabilization:{enabled:!0,iterations:260,fit:!0,updateInterval:25},forceAtlas2Based:{gravitationalConstant:-34,centralGravity:.02,springLength:96,springConstant:.08,damping:.45,avoidOverlap:1}}},Jle={autoResize:!0,interaction:{hover:!0,tooltipDelay:100,hideEdgesOnDrag:!0,navigationButtons:!1,keyboard:{enabled:!0,bindToWindow:!1,autoFocus:!1}},layout:{improvedLayout:!0,randomSeed:17},nodes:{borderWidth:2,shape:"dot"},edges:{arrows:{to:{enabled:!0,scaleFactor:.38}},smooth:{enabled:!0,type:"continuous",roundness:.14},selectionWidth:3},physics:{enabled:!0,solver:"barnesHut",stabilization:{enabled:!0,iterations:520,fit:!0,updateInterval:25},maxVelocity:35,minVelocity:.55,barnesHut:{theta:.45,gravitationalConstant:-12e3,centralGravity:.12,springLength:180,springConstant:.025,damping:.3,avoidOverlap:.85}}},eCe={autoResize:!0,interaction:{hover:!0,tooltipDelay:100,hideEdgesOnDrag:!0,hideEdgesOnZoom:!0,hoverConnectedEdges:!1,selectConnectedEdges:!1,navigationButtons:!1,keyboard:{enabled:!0,bindToWindow:!1,autoFocus:!1}},layout:{improvedLayout:!1,randomSeed:17},nodes:{borderWidth:1.5,shape:"dot"},edges:{arrows:{to:{enabled:!1}},chosen:!1,smooth:!1,selectionWidth:3},physics:{enabled:!1,solver:"barnesHut"}};function GN(t,e,n,i,o,s){if(e.groundingStatus==="GROUNDED")return{background:"#153d3a",border:e.challenged?"#fbbf24":"#5eead4"};const a=e.change&&i?i[e.change]:void 0,l=s?.[yg(e.kind)],C=a?a.background:l?.background??e.color?.background??o?.get(e.community)??t.communities.find(c=>c.id===e.community)?.color??"#6688aa";return{background:C,border:n??a?.border??l?.border??e.color?.border??C}}function ua(t,e,n,i=!1){return{background:B0(t,e,i?n?.18:.1:n?.26:.14),border:e}}function tCe(t,e){if(t==="extracted")return{dashes:!1,width:1,opacity:.7};if(t==="ambiguous")return{dashes:[3,4],width:1,opacity:.62};if(t==="aggregated"){const n=Math.max(1,e??1),i=Math.log2(1+n);return{dashes:!1,width:Math.min(2.5,.5+.75*i),opacity:Math.min(.5,.16+.09*i)}}return{dashes:!0,width:.5,opacity:.35}}function FN(t,e,n,i,o){if(t==="added")return{color:i.added.border,dashes:!1,width:1.7,opacity:.6};if(t==="removed")return{color:i.removed.border,dashes:[6,5],width:1.6,opacity:.56};if(t==="changed")return{color:i.changed.border,dashes:!1,width:1.65,opacity:.48};if(t==="unchanged")return{color:i.unchanged.border,dashes:!0,width:1,opacity:.2};const s=tCe(e,o);return{color:n,...s}}function VN(t,e){return t.challenged?{color:"#fbbf24",dashes:[3,3],width:2.5,opacity:.9}:t.groundingStatus==="GROUNDED"?{color:"#5eead4",dashes:[7,4],width:2.3,opacity:.86}:e}function nCe(t){return t==="added"?{enabled:!0,type:"curvedCW",roundness:.13}:t==="removed"?{enabled:!0,type:"curvedCCW",roundness:.13}:{enabled:!0,type:"continuous",roundness:.1}}function iCe(t){const e=k0(t.label),n=t.memberCount??0;return n>0?`${e} -${n.toLocaleString()} symbols`:e}function oCe(t){return Math.round((t.size??12)+12)}function rCe(t){return{enabled:!0,color:t.color?.background??"#8D97A3",size:Math.round((t.size??12)*.6),x:0,y:0}}function sCe(t){const e=new Map;for(const s of[...t].sort((a,l)=>a.id.localeCompare(l.id))){const a=s.change??"unchanged",l=e.get(a)??[];l.push(s),e.set(a,l)}const n={added:-300,changed:0,removed:300,unchanged:0},i=new Map,o=Math.PI*(3-Math.sqrt(5));for(const[s,a]of e)a.forEach((l,C)=>{const c=C*o,u=s==="unchanged"?210+Math.sqrt(C)*34:42+Math.sqrt(C)*40;i.set(l.id,{x:n[s]+Math.cos(c)*u,y:Math.sin(c)*u})});return i}const gCe=E.forwardRef(function({model:e,focusedNodeId:n,hoveredNodeId:i,physicsRunning:o,layoutStyle:s="automatic",initialPositions:a,forceLabels:l,showEdgeLabels:C=!1,isolatedNodeIds:c,isolatedEdgeIds:u,layoutSpacing:h=Yp,showMinimap:m=!1,semanticDetail:v=!1,communityImportance:b,edgeSemanticHints:x,hiddenCommunities:y,hiddenChanges:S,onFocus:T,onOpenSource:O,onOpenRelationshipSource:M,onInteractionStart:k=()=>{},onHover:G,onHoverEdge:L,onClear:F,onStabilized:re},pe){const ie=E.useRef(null),J=E.useRef(null),[ve,me]=E.useState(null),ue=E.useRef(o);ue.current=o;const z=E.useRef(o),U=E.useRef({onFocus:T,onOpenSource:O,onOpenRelationshipSource:M,onInteractionStart:k,onHover:G,onHoverEdge:L,onClear:F});U.current={onFocus:T,onOpenSource:O,onOpenRelationshipSource:M,onInteractionStart:k,onHover:G,onHoverEdge:L,onClear:F};const Q=E.useRef(re);Q.current=re;const le=E.useRef(null),X=E.useRef(h),R=xu(),D=E.useMemo(()=>xN(e),[e.edges.length,e.nodes.length]),H=e.stats.aggregated,se=E.useMemo(()=>EN(e),[e]),de=E.useMemo(()=>new Set(e.nodes.filter(W=>!y.has(W.community)&&!S.has(W.change??"unchanged")&&(!c||c.has(W.id))).map(W=>W.id)),[S,y,c,e.nodes]),be=E.useMemo(()=>new Set(se.filter(W=>de.has(W.source)&&de.has(W.target)&&(!u||u.has(W.id))).map(W=>W.id)),[u,se,de]),Ne=E.useRef(de);Ne.current=de;const ge=E.useCallback(()=>{const W=J.current,Fe=ie.current;if(!W||!Fe)return;const Ee=W.getPositions([...Ne.current].sort().slice(0,Ule)),Ht=W.getViewPosition(),pt=Math.max(ZN,W.getScale()),Ke=Math.max(1,Fe.clientWidth)/pt,Xt=Math.max(1,Fe.clientHeight)/pt;me({positions:new Map(Object.entries(Ee)),viewport:{left:Ht.x-Ke/2,top:Ht.y-Xt/2,width:Ke,height:Xt}})},[]),ae=E.useMemo(()=>{let W=1;for(const Fe of e.nodes)W=Math.max(W,Fe.degree??1);return W},[e.nodes]),xe=E.useMemo(()=>new Map(e.communities.map(W=>[W.id,W.color])),[e.communities]),Me=E.useMemo(()=>St("--vscode-editor-foreground",St("--foreground","#eef5ff")),[R]),_=E.useMemo(()=>St("--vscode-descriptionForeground",St("--muted-foreground","#60728b")),[R]),ce=E.useMemo(()=>St("--vscode-editor-foreground",St("--foreground","#d8e4f2")),[R]),Se=E.useMemo(()=>St("--vscode-editor-background",St("--background","#08111f")),[R]),_e=E.useMemo(()=>{const W=St("--vscode-editor-background",St("--background","#08111f")),Fe=G0(W);return{added:ua(W,St("--vscode-gitDecoration-addedResourceForeground",Fe?"#56d364":"#1a7f37"),Fe),removed:ua(W,St("--vscode-gitDecoration-deletedResourceForeground",Fe?"#ff7b72":"#cf222e"),Fe),changed:ua(W,St("--vscode-gitDecoration-modifiedResourceForeground",Fe?"#d7a72b":"#9a6700"),Fe),unchanged:ua(W,St("--vscode-descriptionForeground",Fe?"#8b949e":"#656d76"),Fe,!0)}},[R]),gt=E.useMemo(()=>{const W=St("--vscode-editor-background",St("--background","#08111f")),Fe=G0(W),Ee=(Ht,pt,Ke)=>ua(W,St(Ht,Fe?pt:Ke),Fe);return{callable:Ee("--vscode-symbolIcon-functionForeground","#5fa8ff","#0969da"),type:Ee("--vscode-symbolIcon-classForeground","#e3b341","#9a6700"),module:Ee("--vscode-symbolIcon-moduleForeground","#56d4b4","#168b76"),boundary:Ee("--vscode-symbolIcon-eventForeground","#ff9b87","#cf4c35"),other:ua(W,St("--vscode-descriptionForeground",Fe?"#8b949e":"#656d76"),Fe,!0)}},[R]),Et=E.useMemo(()=>({execution:St("--vscode-symbolIcon-functionForeground","#5fa8ff"),dependency:St("--vscode-symbolIcon-moduleForeground","#56d4b4"),structure:St("--vscode-symbolIcon-classForeground","#e3b341"),flow:St("--vscode-symbolIcon-eventForeground","#ff9b87"),other:_}),[_,R]),ot=E.useMemo(()=>e.nodes.some(W=>W.change!==void 0)||e.edges.some(W=>W.change!==void 0),[e.edges,e.nodes]),Ce=E.useMemo(()=>H?new Set(bu(e.nodes,b)):new Set(ot?e.nodes.filter(W=>W.change!=="unchanged").sort((W,Fe)=>(Fe.degree??0)-(W.degree??0)||W.id.localeCompare(Fe.id)).slice(0,12).map(W=>W.id):D==="static"?[...e.nodes].sort((W,Fe)=>(Fe.degree??0)-(W.degree??0)||W.id.localeCompare(Fe.id)).slice(0,20).map(W=>W.id):[]),[b,H,ot,e.nodes,D]),Tt=E.useCallback(W=>!H||Ce.has(W)||W===n||W===i,[Ce,H,n,i]),Ve=E.useMemo(()=>D==="static"?new Set([...e.nodes].sort((W,Fe)=>(Fe.degree??0)-(W.degree??0)||W.id.localeCompare(Fe.id)).slice(0,Vle).map(W=>W.id)):new Set,[e.nodes,D]),sn=E.useMemo(()=>ot?sCe(e.nodes):new Map,[ot,e.nodes]),Ai=s==="automatic"&&D!=="static"?Yp:h,Ot=E.useMemo(()=>s==="automatic"?new Map:vle(e.nodes,s,e.stats.aggregated),[s,e.nodes,e.stats.aggregated]),qn=E.useMemo(()=>H?NN(e.nodes,b):ot?new Map:mle(e.nodes,e.stats.aggregated),[b,H,ot,e.nodes,e.stats.aggregated,D]),Jo=E.useMemo(()=>typeof document>"u"?void 0:document.body.classList.contains("vscode-high-contrast")||document.body.classList.contains("vscode-high-contrast-light")?St("--vscode-contrastBorder","#ffffff"):void 0,[R]),gn=E.useMemo(()=>new Ca(e.nodes.map(W=>{const Fe=W.size??Math.min(40,10+30*(W.degree??1)/ae),Ee=ot?W.change==="unchanged"?7+5*Math.sqrt((W.degree??1)/ae):11+12*Math.sqrt((W.degree??1)/ae):Fe,Ht=Ot.get(W.id)??sn.get(W.id)??a?.get(W.id)??qn.get(W.id),pt=Ht?{x:Ht.x*Ai,y:Ht.y*Ai}:void 0,Ke=H&&!Ce.has(W.id)?.82:W.change==="unchanged"?.58:1;return{id:W.id,label:H?iCe(W):W.label,color:Tt(W.id)?GN(e,W,void 0,zN,xe,v?Fle:void 0):{background:LN,border:BN},shape:v?bB(yg(W.kind)):"dot",size:Ee,...pt??{},opacity:Ke,...H?{borderWidth:2}:{},...H&&Tt(W.id)?{shadow:rCe(W)}:{},font:{color:"#eef5ff",face:"system-ui",size:H?Ce.has(W.id)?N0:0:ot||D==="static"?Ce.has(W.id)?12:0:(W.degree??1)>=ae*.15?12:0,vadjust:H?Math.round(Ee+12):0,...H?{strokeWidth:3,strokeColor:Se}:{}}}})),[Ce,ot,sn,xe,H,a,Ai,ae,e,D,v,Ot,qn]),jn=E.useMemo(()=>new Ca(se.map(W=>{const Fe=x?.get(W.id),Ee=VN(W,FN(W.change,W.confidence,Fe?PN[Fe]:v?PN[bg(W.relation)]:"#60728b",zN,W.weight));return{id:W.id,from:W.source,to:W.target,dashes:Ee.dashes,width:Ee.width,...ot&&D!=="static"?{smooth:nCe(W.change)}:{},color:{color:Ee.color,opacity:Ee.opacity}}})),[ot,x,se,D,v]);return E.useEffect(()=>{const W=ie.current;if(!W)return;le.current=null,X.current=Ai;const Fe=H?qle:D==="static"?eCe:ot?Jle:Qle,Ee=new je(W,{nodes:gn,edges:jn},Xle(Fe,ue.current));ue.current||Ee.stopSimulation(),J.current=Ee,hle(Ee,{onFocus:Ke=>U.current.onFocus(Ke),onOpenSource:Ke=>U.current.onOpenSource(Ke),onOpenRelationshipSource:Ke=>U.current.onOpenRelationshipSource(Ke),onInteractionStart:()=>{Ee.stopSimulation(),U.current.onInteractionStart()},onHover:Ke=>U.current.onHover(Ke),onHoverEdge:Ke=>U.current.onHoverEdge(Ke),onClear:()=>U.current.onClear()}),Ee.on("stabilizationIterationsDone",()=>{if(Ee.stopSimulation(),H){const Ke=new Map(Object.entries(Ee.getPositions())),Xt=DN(e.nodes,Dle(e.nodes,Ke,b),b);gn.update([...Xt].map(([zn,oo])=>({id:zn,x:oo.x,y:oo.y}))),Ee.redraw()}ue.current&&Ee.fit({animation:!1}),le.current={position:Ee.getViewPosition(),scale:Ee.getScale()},Q.current(),ge()}),Ee.on("stabilized",ge),Ee.on("dragEnd",ge),Ee.on("zoom",ge),Ee.on("resize",ge),Ee.on("animationFinished",ge);const Ht=sn.size>0||Ot.size>0||(a?.size??0)>0||qn.size>0;if(!ue.current&&Ht){Ee.stopSimulation();const Ke=()=>{const Xt=ie.current;return!Xt||Xt.clientWidth<=1||Xt.clientHeight<=1?!1:(Ee.fit({animation:!1}),le.current={position:Ee.getViewPosition(),scale:Ee.getScale()},!0)};if(!Ke()){const Xt=()=>{Ke()&&Ee.off("resize",Xt)};Ee.on("resize",Xt)}}const pt=window.setTimeout(ge,0);return()=>{window.clearTimeout(pt),Ee.destroy(),J.current=null}},[jn,gn,ot,sn,a,D,Ot,qn,ge]),E.useEffect(()=>{const W=J.current;if(!W)return;const Fe=z.current;z.current=o,W.setOptions({physics:{enabled:o}}),o?(Fe||Kle(W,Ne.current),W.startSimulation()):W.stopSimulation()},[jn,gn,o]),E.useEffect(()=>{const W=J.current;if(!W||s!=="automatic"||D==="static")return;const Fe=X.current;if(X.current=h,W.setOptions({physics:ot?{enabled:o,barnesHut:{springLength:180*h}}:{enabled:o,forceAtlas2Based:{springLength:(H?96:120)*h}}}),!o&&Fe!==h){const Ee=h/Fe,Ht=W.getPositions();gn.update(Object.entries(Ht).map(([pt,Ke])=>({id:pt,x:Ke.x*Ee,y:Ke.y*Ee}))),W.redraw(),ge()}},[H,ot,h,s,gn,o,ge,D]),E.useEffect(()=>{gn.update(e.nodes.map(W=>({id:W.id,hidden:!de.has(W.id)}))),jn.update(se.map(W=>({id:W.id,hidden:!be.has(W.id)}))),ge()},[jn,ge,se,e.nodes,gn,be,de]),E.useEffect(()=>{const W=J.current;if(!W)return;const Fe=n?new Set(W.getConnectedNodes(n).map(String)):new Set;if(gn.update(e.nodes.map(Ee=>{const Ht=Ee.id===n,pt=!n||Ht||Fe.has(Ee.id),Ke=H&&!Ce.has(Ee.id)?.82:Ee.change==="unchanged"?.58:1;return{id:Ee.id,opacity:n?pt?Math.max(Ke,.72):.32:Ke,borderWidth:Ht?4:Jo?2.5:H?2:1.5,color:Tt(Ee.id)||pt&&n!==null?GN(e,Ee,Jo,_e,xe,v?gt:void 0):{background:LN,border:BN},shadow:Ht?{enabled:!0,color:Ee.change?_e[Ee.change].border:v?gt[yg(Ee.kind)].border:Ee.color?.background??xe.get(Ee.community)??"#76b7ff",size:24,x:0,y:0}:{enabled:!1}}})),jn.update(se.map(Ee=>{const Ht=x?.get(Ee.id),pt=VN(Ee,FN(Ee.change,Ee.confidence,Ht?Et[Ht]:v?Et[bg(Ee.relation)]:_,_e,Ee.weight)),Ke=Ee.source===n||Ee.target===n;return{id:Ee.id,dashes:pt.dashes,color:{color:pt.color,opacity:n?Ke?.92:.12:pt.opacity},width:Ke?Math.max(3,pt.width):pt.width}})),n)if(W.selectNodes([n]),ue.current)W.focus(n,{scale:1.35,animation:window.matchMedia("(prefers-reduced-motion: reduce)").matches?!1:{duration:260,easingFunction:"easeInOutQuad"}});else{const Ee=W.getPositions([n])[n];Ee&&W.moveTo({position:Ee,scale:1.35,animation:!1})}else W.unselectAll()},[Ce,H,Jo,_e,xe,_,jn,x,n,e,gn,se,v,Et,gt]),E.useEffect(()=>{gn.update(e.nodes.map(W=>({id:W.id,font:{color:Me,size:H?l||W.id===n||Ce.has(W.id)?N0:0:l&&(D!=="static"||Ve.has(W.id))||W.id===n||(ot||D==="static"?Ce.has(W.id):(W.degree??1)>=ae*.15)?12:0,...H?{vadjust:oCe(W),strokeWidth:3,strokeColor:Se}:{}}})))},[Ce,Se,ot,H,Ve,n,l,Me,ae,e.nodes,gn,D]),E.useEffect(()=>{jn.update(se.map(W=>({id:W.id,label:C?W.relation:"",font:{align:"middle",color:ce,face:"system-ui",size:10,strokeWidth:3,strokeColor:St("--vscode-editor-background",St("--background","#08111f"))}})))},[jn,ce,se,C]),E.useImperativeHandle(pe,()=>({fit(){J.current?.fit({animation:da(280)})},fitSelection(W){const Fe=J.current;!Fe||W.length===0||Fe.fit({nodes:[...new Set(W)],animation:da(240)})},reset(){const W=J.current,Fe=le.current;if(W){if(!Fe){W.fit({animation:!1});return}W.moveTo({position:Fe.position,scale:Fe.scale,animation:!1})}},resetZoom(){J.current?.moveTo({scale:1,animation:da(180)})},zoomIn(){const W=J.current;W&&W.moveTo({scale:Math.min(Hle,W.getScale()*1.25),animation:da(160)})},zoomOut(){const W=J.current;W&&W.moveTo({scale:Math.max(ZN,W.getScale()/1.25),animation:da(160)})}}),[]),d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:ie,className:"compass-canvas","data-rendering-profile":D,"data-layout-style":s,"data-physics-running":o?"true":"false","data-isolated":c?"true":"false","data-layout-spacing":h,role:"region","aria-label":"Interactive Compass code graph",onMouseLeave:()=>{G(null),L(null)}}),m&&ve?d.jsx(Gle,{model:e,snapshot:ve,visibleNodeIds:de,visibleEdgeIds:be,focusedNodeId:n,semanticDetail:v,onNavigate:W=>J.current?.moveTo({position:W,animation:da(180)})}):null]})}),UN=1,HN=4;function aCe(t){return Math.max(UN,Math.min(HN,Math.trunc(t)))}function ACe(t,e,n,i){const o=aCe(n),s=new Map,a=new Map;for(const u of t.edges){const h=s.get(u.source)??[];h.push(u),s.set(u.source,h);const m=a.get(u.target)??[];m.push(u),a.set(u.target,m)}for(const u of[...s.values(),...a.values()])u.sort((h,m)=>h.id.localeCompare(m.id));const l=new Set([e]),C=new Set;let c=[e];for(let u=0;u0;u+=1){const h=new Set;for(const m of c.sort()){if(i!=="incoming")for(const v of s.get(m)??[])C.add(v.id),l.has(v.target)||h.add(v.target);if(i!=="outgoing")for(const v of a.get(m)??[])C.add(v.id),l.has(v.source)||h.add(v.source)}c=[...h];for(const m of c)l.add(m)}return{nodeIds:l,edgeIds:C}}const YN=[{value:"bubbles",label:"Bubbles",hint:"Packed community map on the canvas",Icon:v4},{value:"matrix",label:"Matrix",hint:"Who couples to whom, cell by cell",Icon:D4},{value:"treemap",label:"Area",hint:"Every community sized by symbol count",Icon:j4},{value:"lanes",label:"Tiers",hint:"Importance tiers with coupling ribbons",Icon:$4}],lCe=[{value:"added",label:"Added"},{value:"removed",label:"Removed"},{value:"changed",label:"Changed"},{value:"unchanged",label:"Context"}],CCe={hierarchical:"Depth-layer layout",circle:"Circle layout",concentric:"Concentric layout",spiral:"Spiral layout",grid:"Square grid layout"},$p=["both","outgoing","incoming"];function ICe(t){return t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.closest('[role="combobox"], [role="listbox"]')!==null)}function Wp({model:t,host:e,hierarchy:n,initialLevel:i,communityDetail:o,communityLoading:s,communityError:a,searchIndex:l,onClearSearchFilters:C,onBackToOverview:c,sourceRevisions:u,queryResult:h,initialInspectorLayout:m,onInspectorLayoutChange:v,preferredLayout:b="automatic",toolbarLeading:x,toolbarLeadingPanel:y,toolbarLeadingOpen:S,onToolbarLeadingClose:T,stageOverlay:O,showInspectorHeader:M=!0,themePreference:k,onThemePreferenceChange:G}){const[L,F]=E.useState(()=>l1(m)),re=E.useCallback(Ve=>{const sn=l1(Ve);F(sn),v?.(sn)},[v]),pe=E.useMemo(()=>aB(n),[n]),ie=E.useMemo(()=>AB(t,pe),[pe,t]),J=E.useMemo(()=>OB(ie)?jB(ie):void 0,[ie]),ve=E.useMemo(()=>n?sB(n):void 0,[n]),[me,ue]=E.useState(()=>n===void 0?"communities":ve!==void 0?"hierarchy":"symbols"),[z,U]=E.useState(()=>i!==void 0&&n?.levels.some(Ve=>Ve.level===i)?i:ve??0),[Q,le]=E.useState([]),X=E.useMemo(()=>{if(!n||me!=="hierarchy")return;const Ve=Q[Q.length-1];return Ve===void 0?y0(n,{kind:"level",level:z}):b0(n,Ve.level,Ve.groupIndex)??y0(n,{kind:"level",level:z})},[z,n,me,Q]),R=X!==void 0&&o===void 0&&me==="hierarchy",[D,H]=E.useState("bubbles"),[se,de]=E.useState(null),[be,Ne]=E.useState(null),ge=E.useMemo(()=>J&&se!==null?zB(ie,se):void 0,[se,J,ie]),xe=!o&&J!==void 0&&me==="communities"&&ge===void 0,Me=E.useMemo(()=>xe?wu(ie,J):R&&X?wu(X):!ge&&ie.stats.aggregated?wu(ie):void 0,[ge,J,X,R,ie,xe]),_=Me?D:"bubbles",ce=o?.model??ge?.model??X??(xe?J.model:ie),Se=o?`community-${o.communityId}`:ge?`community-${se}`:R?`level-${z}-${Q.length}`:xe?"communities":"overview",_e=o?.communityId??(ge?se??void 0:void 0),gt=o?.bounded??(ge?.bounded?{...ge.bounded,scope:"viewer"}:void 0),Et=E.useCallback(()=>{de(null),le(Ve=>Ve.slice(0,-1)),c?.()},[c]),ot=E.useCallback(Ve=>{const Ai=n?.levels.find(qn=>qn.level===z)?.groups.find(qn=>qn.index===Ve);if(Ai&&Ai.childIndices.length>0){le(qn=>[...qn,{level:z,groupIndex:Ve,label:Ai.label}]),U(z+1);return}const Ot=Ai?.community??Ve;if(J===void 0){e.openCommunity?.(Ot);return}de(Ot)},[z,J,n,e]),Ce=E.useMemo(()=>n&&me==="hierarchy"&&o===void 0?{...e,openCommunity:ot}:J&&o===void 0?{...e,openCommunity:Ve=>de(Ve)}:e,[o,J,n,e,ot,me]),Tt=E.useCallback(Ve=>Ve.previewAvailable?(C?.(),Ne(Ve.id),ie.stats.aggregated?J!==void 0&&o===void 0?(ue("communities"),de(Ve.community),!0):e.openCommunity?(e.openCommunity(Ve.community),!0):(Ne(null),!1):(o!==void 0&&c?.(),de(null),le([]),ue("symbols"),!0)):!1,[o,J,e,ie.stats.aggregated,c,C]);return d.jsx(cCe,{model:ce,hierarchy:n,communityKeyed:!R,host:Ce,detailCommunityId:_e,communityLoading:s,communityError:a,onBackToOverview:_e!==void 0||Q.length>0?Et:void 0,bounded:gt,initialFocusedNodeId:be??void 0,overviewSummary:xe?{communities:J.model.stats.communities,symbols:ie.nodes.length}:R?{communities:ce.nodes.length,symbols:ie.nodes.length}:void 0,communityImportance:xe?J.importance:void 0,communityOrder:xe?J.communityOrder:void 0,edgeSemanticHints:xe?J.edgeCategories:void 0,breadcrumbTrail:n!==void 0&&me==="hierarchy"?[{label:"Repository",onSelect:()=>{le([]),U(0)}},...Q.map((Ve,sn)=>({label:Ve.label,onSelect:()=>{le(Q.slice(0,sn)),U(Ve.level+1)}}))]:void 0,variant:_,variantData:Me,onVariantChange:H,searchModel:xe?ie:void 0,searchIndex:l,onOpenGlobalSearchResult:Tt,onSearchFocusApplied:()=>Ne(null),scopeControls:n&&o===void 0?d.jsxs("div",{className:"compass-scope-toggle compass-level-toggle",role:"group","aria-label":"Graph scope",children:[n.levels.map(Ve=>d.jsx("button",{type:"button","aria-label":`Level ${Ve.level}`,"aria-pressed":me==="hierarchy"&&z===Ve.level&&Q.length===0,title:`${Ve.merge==="locationAffinity"?"Grouped by shared location":"Grouped by relationship evidence"} · ${Ve.groupCount.toLocaleString()} groups`,onClick:()=>{ue("hierarchy"),le([]),U(Ve.level),de(null)},children:d.jsx("span",{children:`Level ${Ve.level}`})},Ve.level)),d.jsxs("button",{type:"button","aria-label":"Symbols","aria-pressed":me==="symbols",title:`Show all ${ie.nodes.length.toLocaleString()} symbols`,onClick:()=>{ue("symbols"),de(null)},children:[d.jsx(uu,{"aria-hidden":"true"}),d.jsx("span",{children:"Symbols"})]})]}):J&&o===void 0?d.jsxs("div",{className:"compass-scope-toggle",role:"group","aria-label":"Graph scope",children:[d.jsxs("button",{type:"button","aria-label":"Communities","aria-pressed":me==="communities",title:"Show one labelled bubble per community",onClick:()=>{ue("communities"),de(null)},children:[d.jsx(g0,{"aria-hidden":"true"}),d.jsx("span",{children:"Communities"})]}),d.jsxs("button",{type:"button","aria-label":"Symbols","aria-pressed":me==="symbols",title:`Show all ${ie.nodes.length.toLocaleString()} symbols`,onClick:()=>{ue("symbols"),de(null)},children:[d.jsx(uu,{"aria-hidden":"true"}),d.jsx("span",{children:"Symbols"})]})]}):void 0,onOpenCommunityFromSearch:J&&xe?(Ve,sn)=>{Ne(sn),de(Ve)}:void 0,autoLayoutDetail:ge!==void 0,sourceRevisions:u,queryResult:h,inspectorLayout:L,onInspectorLayoutChange:re,preferredLayout:b,toolbarLeading:x,toolbarLeadingPanel:y,toolbarLeadingOpen:S,onToolbarLeadingClose:T,stageOverlay:O,showInspectorHeader:M,themePreference:k,onThemePreferenceChange:G},Se)}function cCe({model:t,hierarchy:e,communityKeyed:n,host:i,detailCommunityId:o,communityLoading:s,communityError:a,onBackToOverview:l,bounded:C,initialFocusedNodeId:c,overviewSummary:u,communityImportance:h,communityOrder:m,edgeSemanticHints:v,breadcrumbTrail:b,variant:x,variantData:y,onVariantChange:S,searchModel:T,searchIndex:O,onOpenGlobalSearchResult:M,onSearchFocusApplied:k,scopeControls:G,onOpenCommunityFromSearch:L,autoLayoutDetail:F,themePreference:re,onThemePreferenceChange:pe,sourceRevisions:ie,queryResult:J,inspectorLayout:ve,onInspectorLayoutChange:me,preferredLayout:ue,toolbarLeading:z,toolbarLeadingPanel:U,toolbarLeadingOpen:Q,onToolbarLeadingClose:le,stageOverlay:X,showInspectorHeader:R}){const[D,H]=E.useReducer(Ple,t,Ie=>{const Ze=zle(Ie,ue),Be=ue==="automatic"&&Up(Ie);return{...Ze,...Be?{physicsRunning:!0,initialLayoutPending:!0}:{},...c?{focusedNodeId:c}:{}}}),[se,de]=E.useState(),[be,Ne]=E.useState(null),[ge,ae]=E.useState(null),xe=E.useRef(null),Me=yF(),_=E.useRef(i);_.current=i;const ce=E.useMemo(()=>new Map(t.nodes.map(Ie=>[Ie.id,Ie])),[t.nodes]),Se=E.useMemo(()=>new Map(t.edges.map(Ie=>[Ie.id,Ie])),[t.edges]),_e=E.useMemo(()=>{const Ie=new Map,Ze=new Map;for(const Be of t.edges){const Jn=Ie.get(Be.source)??new Set;Jn.add(Be.target),Ie.set(Be.source,Jn);const Kr=Ie.get(Be.target)??new Set;Kr.add(Be.source),Ie.set(Be.target,Kr);const ma=Ze.get(Be.source)??[];ma.push(Be),Ze.set(Be.source,ma);const El=Ze.get(Be.target)??[];El.push(Be),Ze.set(Be.target,El)}return{neighborIds:Ie,edges:Ze}},[t.edges]),gt=E.useMemo(()=>{const Ie=O?.nodes??T?.nodes;if(!Ie)return t.nodes;const Ze=new Set(Ie.map(Be=>Be.id));return[...t.nodes.filter(Be=>!Ze.has(Be.id)),...Ie]},[t.nodes,O?.nodes,T?.nodes]),Et=E.useMemo(()=>gt.map(Ie=>({node:Ie,text:[Ie.label,Ie.source?.file,Ie.kind].filter(Ze=>Ze!==void 0).join(` -`).toLocaleLowerCase()})),[gt]),ot=E.useMemo(()=>EN(t).length,[t]),Ce=se??(D.focusedNodeId?ce.get(D.focusedNodeId):void 0),Tt=E.useMemo(()=>Ce&&!se?IB(e,t,Ce,{communityKeyed:n}):void 0,[n,se,e,t,Ce]),Ve=E.useMemo(()=>Ce&&!se?ACe(t,Ce.id,D.neighborhoodDepth,D.edgeDirection):null,[t,Ce,se,D.edgeDirection,D.neighborhoodDepth]),sn=be?ce.get(be.nodeId):void 0,Ai=sn?C1(t,sn,o):void 0,Ot=ge?Se.get(ge.edgeId):void 0,qn=Ot?ce.get(Ot.source):void 0,Jo=Ot?ce.get(Ot.target):void 0,gn=E.useMemo(()=>t.nodes.some(Ie=>Ie.change!==void 0)||t.edges.some(Ie=>Ie.change!==void 0),[t.edges,t.nodes]),jn=E.useMemo(()=>{const Ie=new Map;for(const Ze of t.nodes){const Be=Ze.change??"unchanged";Ie.set(Be,(Ie.get(Be)??0)+1)}return Ie},[t.nodes]),W=E.useMemo(()=>Ce?[..._e.neighborIds.get(Ce.id)??[]].map(Ie=>ce.get(Ie)).filter(Ie=>Ie!==void 0).sort((Ie,Ze)=>Ie.label.localeCompare(Ze.label)):[],[_e.neighborIds,ce,Ce]),Fe=E.useMemo(()=>Ce?_e.edges.get(Ce.id)??[]:[],[_e.edges,Ce]),Ee=E.useDeferredValue(D.query),Ht=E.useMemo(()=>{const Ie=Ee.trim().toLocaleLowerCase();if(!Ie)return[];const Ze=[];for(const Be of Et)if(Be.text.includes(Ie)&&Ze.push(Be.node),Ze.length===20)break;return Ze},[Ee,Et]),pt=E.useCallback(Ie=>{de(void 0),Ne(null),ae(null),H({type:"focus",nodeId:Ie})},[]);E.useEffect(()=>{!c||!ce.has(c)||(pt(c),k?.())},[pt,c,ce,k]);const Ke=E.useCallback(Ie=>{_.current.openCommunity?.(Ie)},[]),Xt=E.useCallback(Ie=>{if(ce.has(Ie)){pt(Ie);return}const Ze=O?.nodes.find(Jn=>Jn.id===Ie);if(Ze){if(M?.(Ze))return;H({type:"clearFocus"}),de(Ze);return}const Be=T?.nodes.find(Jn=>Jn.id===Ie);Be&&L&&L(Be.community,Be.id)},[pt,ce,L,M,O,T]),zn=E.useCallback(()=>{D.physicsRunning&&H({type:"setPhysics",running:!1})},[D.physicsRunning]),oo=E.useCallback(()=>{de(void 0),Ne(null),ae(null),H({type:"clearFocus"})},[]);E.useEffect(()=>{D.focusedNodeId&&!ce.has(D.focusedNodeId)&&oo()},[oo,ce,D.focusedNodeId]),E.useEffect(()=>{const Ie=Ze=>{if(Ze.metaKey||Ze.ctrlKey||Ze.altKey||Q||Ze.key==="Escape"&&document.querySelector(".compass-explore-panel")||ICe(Ze.target))return;const Be=Ze.key.toLocaleLowerCase();let Jn=!0;if(Be==="f")Ze.shiftKey&&Ve?xe.current?.fitSelection([...Ve.nodeIds]):Ze.shiftKey?Jn=!1:xe.current?.fit();else if(Be==="+"||Be==="=")xe.current?.zoomIn();else if(Be==="-"||Be==="_")xe.current?.zoomOut();else if(Be==="0")xe.current?.resetZoom();else if(Be==="i"&&Ce)H({type:"setIsolation",isolated:!D.isolateSelection});else if(Be==="[")H({type:"setNeighborhoodDepth",depth:Math.max(UN,D.neighborhoodDepth-1)});else if(Be==="]")H({type:"setNeighborhoodDepth",depth:Math.min(HN,D.neighborhoodDepth+1)});else if(Be==="d"){const Kr=$p.indexOf(D.edgeDirection);H({type:"setEdgeDirection",direction:$p[(Kr+1)%$p.length]??"both"})}else Be==="m"?H({type:"setMinimap",visible:!D.showMinimap}):Be==="l"?Ze.shiftKey?H({type:"setEdgeLabels",visible:!D.showEdgeLabels}):H({type:"setLabels",visible:!D.forceLabels}):Be==="escape"&&l?l():Be==="escape"&&Ce?oo():Jn=!1;Jn&&Ze.preventDefault()};return document.addEventListener("keydown",Ie,{capture:!0}),()=>document.removeEventListener("keydown",Ie,{capture:!0})},[oo,l,Ce,Ve,D.edgeDirection,D.forceLabels,Q,D.isolateSelection,D.neighborhoodDepth,D.showEdgeLabels,D.showMinimap]);const dm=E.useCallback(()=>{H({type:"stabilized"})},[]),um=E.useCallback(()=>{H({type:"revealLayout"})},[]),fa=E.useCallback(Ie=>{const Ze=ce.get(Ie);if(!Ze)return;const Be=C1(t,Ze,o);Be.type==="community"&&_.current.openCommunity?.(Be.communityId),Be.type==="source"&&_.current.openSource(Be.source,Ze.change==="removed"?ie?.before:ie?.after)},[o,ce,t.stats.aggregated,ie?.after,ie?.before]),pa=E.useCallback(Ie=>{const Ze=Se.get(Ie);if(!Ze)return;const Be=cw(Ze);Be&&_.current.openSource(Be,Ze.change==="removed"?ie?.before:ie?.after)},[Se,ie?.after,ie?.before]),Yr=o!==void 0?t.communities.find(Ie=>Ie.id===o)?.label??`Community ${o}`:void 0,To=YN.find(Ie=>Ie.value===x)?.label,$r=u??(y?{communities:y.communities.length,symbols:y.symbols}:void 0),Wr=$r?`${x==="bubbles"||!To?"":`${To} · `}${$r.communities.toLocaleString()} communities · ${$r.symbols.toLocaleString()} symbols${D.layoutStyle==="automatic"&&!Up(t)?" · press Layout to arrange":""}`:void 0,hm=se?`Found ${se.label} · outside preview`:Ce&&D.isolateSelection&&Ve?`Isolated ${Ve.nodeIds.size} nodes · ${D.neighborhoodDepth} hop${D.neighborhoodDepth===1?"":"s"}`:Ce?`Inspecting ${Ce.label}`:Yr?`Community ${Yr} · ${t.stats.nodes.toLocaleString()} symbols`:Wr||(D.layoutStyle!=="automatic"?CCe[D.layoutStyle]:D.physicsRunning?"Layout running":Up(t)?"Automatic layout":`Static layout · ${t.nodes.length.toLocaleString()} nodes stay seeded`),xl=x==="bubbles",Sl=s!=null?t.communities.find(Ie=>Ie.id===s):void 0,ro=s!=null?{kind:"community",communityLabel:Sl?.label??`Community ${s}`}:D.initialLayoutPending&&xl?{kind:"layout"}:null;return d.jsxs("div",{className:"compass-workspace",style:{"--compass-inspector-width":`${ve.width}px`},children:[d.jsxs("div",{className:"compass-workspace-content","data-inspector-collapsed":ve.collapsed,inert:ro?!0:void 0,"aria-hidden":ro?!0:void 0,children:[d.jsxs("main",{className:"compass-graph-stage","data-comparison":gn?"true":"false","data-controls":Me?"header":void 0,"data-breadcrumb":u!==void 0||F||b!==void 0&&b.length>0?"true":void 0,children:[y&&x!=="bubbles"?d.jsx("div",{className:"compass-variant-stage",children:x==="matrix"?d.jsx(YB,{data:y,onOpenCommunity:Ke}):x==="treemap"?d.jsx($B,{data:y,onOpenCommunity:Ke}):d.jsx(QB,{data:y,onOpenCommunity:Ke})}):d.jsx(gCe,{ref:xe,model:t,focusedNodeId:se?null:Ce?.id??null,hoveredNodeId:be?.nodeId??null,physicsRunning:D.physicsRunning,layoutStyle:D.layoutStyle,forceLabels:D.forceLabels,showEdgeLabels:D.showEdgeLabels,isolatedNodeIds:D.isolateSelection?Ve?.nodeIds:void 0,isolatedEdgeIds:D.isolateSelection?Ve?.edgeIds:void 0,layoutSpacing:D.layoutSpacing,showMinimap:D.showMinimap,semanticDetail:o!==void 0&&!gn,communityImportance:h,edgeSemanticHints:v,hiddenCommunities:D.hiddenCommunities,hiddenChanges:D.hiddenChanges,onFocus:pt,onOpenSource:fa,onOpenRelationshipSource:pa,onInteractionStart:zn,onHover:Ne,onHoverEdge:ae,onClear:oo,onStabilized:dm}),X,b!==void 0&&b.length>0?d.jsx("nav",{className:"compass-graph-breadcrumb compass-glass-panel","aria-label":"Graph path",children:b.map((Ie,Ze)=>d.jsxs("span",{className:"compass-breadcrumb-step",children:[Ze>0?d.jsx("span",{className:"compass-breadcrumb-separator","aria-hidden":"true",children:"▸"}):null,Ze+1===b.length?d.jsx("span",{"aria-current":"page",children:Ie.label}):d.jsx("button",{type:"button",onClick:Ie.onSelect,children:Ie.label})]},`${Ze}-${Ie.label}`))}):u!==void 0||F?d.jsx("nav",{className:"compass-graph-breadcrumb compass-glass-panel","aria-label":"Graph path",children:o===void 0?d.jsx("span",{"aria-current":"page",children:"Repository"}):d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:l,children:"Repository"}),d.jsx("span",{className:"compass-breadcrumb-separator","aria-hidden":"true",children:"▸"}),d.jsx("span",{"aria-current":"page",children:Yr??`Community ${o}`})]})}):null,d.jsx(dCe,{slot:Me,children:d.jsx(vF,{status:hm,physicsRunning:D.physicsRunning&&xl,layoutStyle:D.layoutStyle,forceLabels:D.forceLabels,showEdgeLabels:D.showEdgeLabels,hasSelection:Ce!==void 0&&se===void 0,isolateSelection:D.isolateSelection,neighborhoodDepth:D.neighborhoodDepth,edgeDirection:D.edgeDirection,layoutSpacing:D.layoutSpacing,showMinimap:D.showMinimap,themeControls:pe?d.jsx("div",{className:"compass-scope-toggle compass-theme-toggle",role:"group","aria-label":"Colour theme",children:UB.map(Ie=>d.jsxs("button",{type:"button","aria-label":Ie.label,"aria-pressed":(re??"auto")===Ie.value,title:Ie.hint,onClick:()=>pe(Ie.value),children:[Ie.value==="auto"?d.jsx(B4,{"aria-hidden":"true"}):Ie.value==="light"?d.jsx(tB,{"aria-hidden":"true"}):d.jsx(Z4,{"aria-hidden":"true"}),d.jsx("span",{children:Ie.label})]},Ie.value))}):void 0,scopeControls:G,canvasControls:x==="bubbles",variantControls:y?d.jsx("div",{className:"compass-scope-toggle compass-variant-toggle",role:"group","aria-label":"Overview design",children:YN.map(({value:Ie,label:Ze,hint:Be,Icon:Jn})=>d.jsx("button",{type:"button","aria-label":Ze,"aria-pressed":x===Ie,title:`${Ze} — ${Be}`,onClick:()=>S(Ie),children:d.jsx(Jn,{"aria-hidden":"true"})},Ie))}):void 0,leadingControls:z,leadingPanel:U,leadingPanelOpen:Q,onLeadingPanelClose:le,onTogglePhysics:()=>H({type:"setPhysics",running:!D.physicsRunning}),onLayoutChange:Ie=>H({type:"setLayout",layout:Ie,runPhysics:!1}),onZoomOut:()=>xe.current?.zoomOut(),onResetZoom:()=>xe.current?.resetZoom(),onZoomIn:()=>xe.current?.zoomIn(),onFit:()=>xe.current?.fit(),onFitSelection:()=>{Ve&&xe.current?.fitSelection([...Ve.nodeIds])},onReset:()=>{oo(),H({type:"setIsolation",isolated:!1}),xe.current?.reset()},onToggleLabels:()=>H({type:"setLabels",visible:!D.forceLabels}),onToggleEdgeLabels:()=>H({type:"setEdgeLabels",visible:!D.showEdgeLabels}),onToggleIsolation:()=>{const Ie=!D.isolateSelection;H({type:"setIsolation",isolated:Ie}),Ie&&Ve&&window.requestAnimationFrame(()=>{xe.current?.fitSelection([...Ve.nodeIds])})},onNeighborhoodDepthChange:Ie=>H({type:"setNeighborhoodDepth",depth:Ie}),onEdgeDirectionChange:Ie=>H({type:"setEdgeDirection",direction:Ie}),onLayoutSpacingChange:Ie=>H({type:"setLayoutSpacing",spacing:Ie}),onToggleMinimap:()=>H({type:"setMinimap",visible:!D.showMinimap}),onBack:l})}),gn&&d.jsx("div",{className:"compass-change-legend","aria-label":"Graph change filters",children:lCe.filter(({value:Ie})=>(jn.get(Ie)??0)>0).map(({value:Ie,label:Ze})=>{const Be=!D.hiddenChanges.has(Ie);return d.jsxs("button",{type:"button","data-change":Ie,"aria-pressed":Be,onClick:()=>H({type:"toggleChange",change:Ie}),children:[d.jsx("span",{"aria-hidden":"true"}),Ze,d.jsx("small",{children:jn.get(Ie)??0})]},Ie)})}),o!==void 0&&!gn?d.jsx(xF,{model:t}):null,a&&d.jsx("div",{className:"absolute bottom-4 left-4 z-20 max-w-md rounded-md border border-destructive/50 bg-background/95 px-3 py-2 text-sm text-destructive shadow-lg",role:"alert",children:a}),C&&d.jsx("div",{className:"compass-bounded-notice",role:"status",children:C.scope==="viewer"?d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Most connected symbols first"}),d.jsxs("span",{children:["This community holds ",C.parentMembers.toLocaleString()," symbols; the view shows the ",C.currentMembers.toLocaleString()," most connected. Search for a symbol to open it directly."]})]}):C.scope==="export"?d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Bounded community detail"}),d.jsxs("span",{children:["This standalone document embeds the"," ",C.currentMembers.toLocaleString()," most connected of"," ",C.parentMembers.toLocaleString()," symbols. Open the graph in VS Code or run ",d.jsxs("code",{children:["compass export json --community ",o]})," to inspect every symbol."]})]}):d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Partial community comparison"}),d.jsxs("span",{children:["This view is limited to ",C.limit.toLocaleString()," nodes. Increase"," ",d.jsx("code",{children:"compass.graphNodeLimit"})," to inspect all"," ",Math.max(C.parentMembers,C.currentMembers).toLocaleString()," symbols."]})]})}),be&&sn&&Ai&&d.jsx(NF,{node:sn,hover:be,activation:Ai}),ge&&Ot&&qn&&Jo&&d.jsx(jF,{edge:Ot,sourceNode:qn,targetNode:Jo,hover:ge})]}),!ve.collapsed&&d.jsx(TF,{width:ve.width,onResize:Ie=>me({...ve,width:Ie})}),d.jsx(jZ,{model:t,selected:Ce,searchOnly:se!==void 0,searchCoverage:O?{indexed:O.nodes.length,total:O.totalNodes}:void 0,communityFacts:Tt,neighbors:W,connectedEdges:Fe,query:D.query,matches:Ht,communityOrder:m,hiddenCommunities:D.hiddenCommunities,communityDrilldown:o!==void 0,subgraphAvailable:e!==void 0&&Ce!==void 0&&Tt?.level!==void 0&&b0(e,Tt.level,Ce.community)!==void 0,comparisonMode:gn,sourceRevisions:ie,queryResult:J,renderedEdgeCount:ot,showHeader:R,onQueryChange:Ie=>H({type:"search",query:Ie}),onFocus:Xt,onOpenSource:i.openSource,onOpenCommunity:o===void 0?i.openCommunity:void 0,searchSpansCommunities:O||T?!0:void 0,onQueryNode:i.queryNode,onToggleCommunity:Ie=>H({type:"toggleCommunity",communityId:Ie}),onSetAllVisible:Ie=>H({type:"setHiddenCommunities",communityIds:Ie?[]:t.communities.map(Ze=>Ze.id)}),collapsed:ve.collapsed,onToggleCollapsed:()=>me({...ve,collapsed:!ve.collapsed})})]}),ro?.kind==="community"?d.jsx(mw,{kind:"community",communityLabel:ro.communityLabel}):ro?.kind==="layout"?d.jsx(mw,{kind:"layout",onShowGraph:um}):null]})}function dCe({slot:t,children:e}){return t?bs.createPortal(e,t):e}function $N(t,e,n){if(!n)return;const i=t.nodes.find(o=>o.community===e&&o.memberCount!==void 0)?.memberCount;if(!(i===void 0||n.nodes.length>=i))return{limit:n.nodes.length,parentMembers:i,currentMembers:n.nodes.length,scope:"export"}}const Kp=224,uCe=76,Oc=124,Xp=96,ha=96,hCe=288,fCe=112,Qp=12;function pCe(t,e,n={width:1280,height:620},i={},o){const s=t.filter(L=>L.nodeCount>0||L.incomingRelationships>0||L.outgoingRelationships>0);if(s.length===0)return{width:n.width,height:n.height,nodes:[],routes:[],lanes:[]};const a=new Set(s.map(L=>L.id)),l=e.filter(L=>a.has(L.sourceGroup)&&a.has(L.targetGroup)),C=mCe(s,l),c=C.length,u=Math.max(n.width,ha*2+hCe*c),h=(u-ha*2)/c;bCe(C,l);const m=Math.max(...C.map(L=>L.length)),v=Math.max(n.height,Oc+Xp+m*fCe),b=C.findIndex(L=>L.some(F=>F.id===o)),x=Array.from({length:c},(L,F)=>({index:F,x:ha+h*F,width:h,label:TCe(F,c,b<0?void 0:b)})),y=v-Oc-Xp,S=C.flatMap((L,F)=>{const re=y/Math.max(1,L.length);return L.map((pe,ie)=>{const J={x:ha+h*F+h/2,y:Oc+re*ie+re/2},ve=i[pe.id]??J;return{...pe,x:qp(ve.x,ha+Kp/2,u-ha-Kp/2),y:qp(ve.y,Oc,v-Xp),width:Math.min(Kp,h-40),height:uCe,column:ECe(ve.x,x)}})}),T=new Map(S.map(L=>[L.id,L])),O=xCe(l,T),M=QN(l,T,"source"),k=QN(l,T,"target"),G=l.flatMap(L=>{const F=T.get(L.sourceGroup),re=T.get(L.targetGroup);if(!F||!re)return[];const pe=qN(F,re);return[{...L,direction:pe,path:wCe(F,re,pe,O.get(L.id)??0,{height:v},M.get(L.id)??0,k.get(L.id)??0),width:1+Math.min(4.4,Math.log10(L.relationships+1)*1.35)}]});return{width:u,height:v,nodes:S,routes:G,lanes:x}}function mCe(t,e){if(t.length===1)return[[t[0]]];if(e.length===0)return WN(t);const n=vCe(t,e),i=new Map(n.map((c,u)=>[c.id,u])),o=new Map;for(const c of t)o.set(c.id,[]);for(const c of e)(i.get(c.sourceGroup)??0)<(i.get(c.targetGroup)??0)&&c.sourceGroup!==c.targetGroup&&o.get(c.targetGroup)?.push(c);const s=new Map;for(const c of n){const u=(o.get(c.id)??[]).map(h=>(s.get(h.sourceGroup)??0)+1);s.set(c.id,u.length>0?Math.max(...u):0)}const a=Math.max(0,...s.values()),l=Math.min(Qp,a+1);if(l===1)return WN(t);const C=Array.from({length:l},()=>[]);for(const c of n){const u=s.get(c.id)??0,h=ac.length>0)}function vCe(t,e){const n=new Map(t.map(a=>[a.id,a])),i=new Set(n.keys()),o=[],s=[];for(;i.size>0;){const a=yCe(i,e),l=[...i].map(h=>({section:n.get(h),incoming:a.incoming.get(h)??0,outgoing:a.outgoing.get(h)??0})),C=l.filter(h=>h.incoming===0),c=l.filter(h=>h.outgoing===0);if(C.length>0){const h=C.sort((m,v)=>v.outgoing-m.outgoing||yl(m.section,v.section))[0];o.push(h.section),i.delete(h.section.id);continue}if(c.length>0){const h=c.sort((m,v)=>v.incoming-m.incoming||yl(m.section,v.section))[0];s.unshift(h.section),i.delete(h.section.id);continue}const u=l.sort((h,m)=>m.outgoing-m.incoming-(h.outgoing-h.incoming)||m.outgoing+m.incoming-(h.outgoing+h.incoming)||yl(h.section,m.section))[0];o.push(u.section),i.delete(u.section.id)}return[...o,...s]}function yCe(t,e){const n=new Map,i=new Map;for(const o of e){if(o.sourceGroup===o.targetGroup||!t.has(o.sourceGroup)||!t.has(o.targetGroup))continue;const s=1+Math.log10(o.relationships+1);i.set(o.sourceGroup,(i.get(o.sourceGroup)??0)+s),n.set(o.targetGroup,(n.get(o.targetGroup)??0)+s)}return{incoming:n,outgoing:i}}function WN(t){const e=Math.min(6,Math.max(2,Math.ceil(Math.sqrt(t.length)))),n=Array.from({length:e},()=>[]);return[...t].sort(yl).forEach((i,o)=>{n[Math.floor(o*e/t.length)].push(i)}),n}function bCe(t,e){const n=new Map;for(const i of e)KN(n,i.sourceGroup,i.targetGroup,i.relationships),KN(n,i.targetGroup,i.sourceGroup,i.relationships);for(let i=0;i<8;i+=1)for(const o of[1,-1]){const s=o===1?1:t.length-2,a=o===1?t.length:-1;for(let l=s;l!==a;l+=o){const C=new Map,c=o===1?t.slice(0,l):t.slice(l+1);for(const h of c)h.forEach((m,v)=>{C.set(m.id,h.length===1?.5:v/(h.length-1))});const u=new Map(t[l].map((h,m,v)=>[h.id,v.length===1?.5:m/(v.length-1)]));t[l].sort((h,m)=>{const v=XN(h.id,n,C),b=XN(m.id,n,C);return(v??u.get(h.id)??.5)-(b??u.get(m.id)??.5)||yl(h,m)})}}}function KN(t,e,n,i){const o=t.get(e)??new Map;o.set(n,(o.get(n)??0)+i),t.set(e,o)}function XN(t,e,n){let i=0,o=0;for(const[s,a]of e.get(t)??[]){const l=n.get(s);l!==void 0&&(i+=l*a,o+=a)}return o>0?i/o:void 0}function wCe(t,e,n,i,o,s,a){const l=t.y+s,C=e.y+a;if(n==="forward"){const b=t.x+t.width/2,x=e.x-e.width/2,y=Math.max(1,x-b),S=qp(y*.42,42,168),T=OCe(i%9,1.5);return[`M ${b} ${l}`,`C ${b+S} ${l+T}`,`${x-S} ${C+T}`,`${x} ${C}`].join(" ")}if(n==="backward"){const b=t.x-t.width/2,x=e.x+e.width/2,y=(l+C)/2{const l=e.get(s.sourceGroup),C=e.get(a.sourceGroup),c=e.get(s.targetGroup),u=e.get(a.targetGroup);return(l?.column??0)-(C?.column??0)||(c?.column??0)-(u?.column??0)||(l?.y??0)-(C?.y??0)||(c?.y??0)-(u?.y??0)||a.relationships-s.relationships||s.id.localeCompare(a.id)});for(const s of o){const a=e.get(s.sourceGroup),l=e.get(s.targetGroup);if(!a||!l)continue;const C=qN(a,l),c=`${Math.min(a.column,l.column)}:${Math.max(a.column,l.column)}:${C}`,u=i.get(c)??0;n.set(s.id,u),i.set(c,u+1)}return n}function QN(t,e,n){const i=new Map;for(const s of t){const a=n==="source"?s.sourceGroup:s.targetGroup,l=i.get(a)??[];l.push(s),i.set(a,l)}const o=new Map;for(const s of i.values()){s.sort((l,C)=>{const c=e.get(n==="source"?l.targetGroup:l.sourceGroup),u=e.get(n==="source"?C.targetGroup:C.sourceGroup);return(c?.y??0)-(u?.y??0)||(c?.x??0)-(u?.x??0)||l.id.localeCompare(C.id)});const a=Math.min(8,38/Math.max(1,s.length-1));s.forEach((l,C)=>{o.set(l.id,(C-(s.length-1)/2)*a)})}return o}function SCe(t,e,n,i,o){const s=Math.sign(i-e)||1,a=Math.sign(o-n)||1,l=Math.min(12,Math.abs(i-e)/2,Math.abs(n-t)/2);return[`M ${t} ${e}`,`H ${n-Math.sign(n-t)*l}`,`Q ${n} ${e} ${n} ${e+s*l}`,`V ${i-s*l}`,`Q ${n} ${i} ${n+a*l} ${i}`,`H ${o}`].join(" ")}function qN(t,e){return e.column>t.column?"forward":e.columneM(o)),l=E.useRef(s),[C,c]=E.useState(1),[u,h]=E.useState("none"),m=E.useRef("none"),v=E.useRef(0),[b,x]=E.useState(MCe),[y,S]=E.useState("key"),[T,O]=E.useState(),M=E.useRef(null),k=E.useRef(void 0),G=E.useRef(void 0);E.useEffect(()=>{const _=eM(o);l.current=_,a(_),c(1),m.current="start",v.current=0,h("start"),M.current?.scrollTo?.({left:0,top:0}),S("key")},[o]);const L=E.useMemo(()=>DCe(t.routes,e),[t.routes,e]),F=E.useMemo(()=>y==="complete"?{routes:t.routes,reciprocals:new Map}:_Ce(t.routes.filter(_=>L.has(_.id)),e?.kind==="route"?e.id:void 0),[L,t.routes,y,e]),re=F.routes,pe=E.useMemo(()=>{if(y==="complete"||e===void 0)return t.groups;const _=new Set;e.kind==="group"&&_.add(e.id);for(const ce of re)_.add(ce.sourceGroup),_.add(ce.targetGroup);return t.groups.filter(ce=>_.has(ce.id))},[t.groups,y,re,e]),ie=E.useMemo(()=>pCe(pe,re,b,s,y==="key"&&e?.kind==="group"?e.id:void 0),[pe,s,y,re,e,b]),J=ie.routes,ve=E.useMemo(()=>e?.kind!=="group"?new Set:new Set(J.filter(_=>_.sourceGroup===e.id||_.targetGroup===e.id).flatMap(_=>[_.id,_.sourceGroup,_.targetGroup])),[J,e]),me=Math.max(1,...J.map(_=>_.relationships)),ue=t.routes.length-J.length,z={width:Math.round(ie.width*C),height:Math.round(ie.height*C)},U=_=>{n(_)},Q=(_,ce)=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),U(ce))},le=(_,ce)=>{const Se={...l.current,[_]:ce};l.current=Se,a(Se)},X=()=>{try{window.localStorage.setItem(o,JSON.stringify(l.current))}catch{}},R=()=>{l.current={},a({});try{window.localStorage.removeItem(o)}catch{}},D=()=>{c(1),m.current="start",v.current=0,h("start");const _=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;M.current?.scrollTo?.({left:0,top:0,behavior:_?"auto":"smooth"})},H=_=>{const ce=Math.max(0,_.scrollWidth-_.clientWidth),Se=ce<=1?"none":_.scrollLeft<=1?"start":_.scrollLeft>=ce-1?"end":"middle";v.current=ce,m.current=Se,h(_e=>_e===Se?_e:Se)},se=_=>{H(_.currentTarget)},de=_=>{_.target!==_.currentTarget||!M.current||(k.current={x:_.clientX,y:_.clientY,scrollLeft:M.current.scrollLeft,scrollTop:M.current.scrollTop,pointerId:_.pointerId},_.currentTarget.setPointerCapture(_.pointerId))},be=_=>{const ce=k.current,Se=M.current;!ce||!Se||ce.pointerId!==_.pointerId||(Se.scrollLeft=ce.scrollLeft-(_.clientX-ce.x),Se.scrollTop=ce.scrollTop-(_.clientY-ce.y))},Ne=_=>{k.current?.pointerId===_.pointerId&&(k.current=void 0,_.currentTarget.hasPointerCapture(_.pointerId)&&_.currentTarget.releasePointerCapture(_.pointerId))},ge=(_,ce)=>{_.stopPropagation();const Se=JN(_.currentTarget.ownerSVGElement,_);Se&&(G.current={id:ce.id,pointerId:_.pointerId,offsetX:Se.x-ce.x,offsetY:Se.y-ce.y,startClientX:_.clientX,startClientY:_.clientY,moved:!1},O(ce.id),_.currentTarget.setPointerCapture(_.pointerId))},ae=(_,ce)=>{const Se=G.current;!Se||Se.id!==ce.id||Se.pointerId!==_.pointerId||(_.currentTarget.hasPointerCapture(_.pointerId)&&_.currentTarget.releasePointerCapture(_.pointerId),G.current=void 0,O(void 0),Se.moved?X():U({kind:"group",id:ce.id}))},xe=_=>{G.current?.pointerId===_.pointerId&&(G.current=void 0,O(void 0))},Me=(_,ce)=>{if(_.key==="Enter"||_.key===" "){_.preventDefault(),U({kind:"group",id:ce.id});return}if(!_.altKey||!_.key.startsWith("Arrow"))return;_.preventDefault();const Se=_.shiftKey?24:8;le(ce.id,{x:ce.x+(_.key==="ArrowRight"?Se:_.key==="ArrowLeft"?-Se:0),y:ce.y+(_.key==="ArrowDown"?Se:_.key==="ArrowUp"?-Se:0)}),X()};return E.useEffect(()=>{const _=M.current;if(!_)return;const ce=()=>{const _e=v.current,gt=Math.max(0,_.scrollWidth-_.clientWidth),Et=_e>1&&_.scrollLeft>=_e-1;if(gt>_e&&(m.current==="end"||Et)&&(_.scrollLeft=gt),H(_),_.clientWidth<=0||_.clientHeight<=0)return;const ot={width:Math.round(_.clientWidth),height:Math.round(_.clientHeight)};x(Ce=>Ce.width===ot.width&&Ce.height===ot.height?Ce:ot)};if(ce(),typeof ResizeObserver>"u")return;const Se=new ResizeObserver(ce);return Se.observe(_),()=>Se.disconnect()},[z.height,z.width]),d.jsxs("section",{className:"architecture-map-panel","aria-labelledby":"architecture-map-title","data-route-mode":y,children:[d.jsxs("header",{className:"architecture-map-header",children:[d.jsxs("div",{className:"architecture-map-intro",children:[d.jsx("span",{children:"Flow canvas"}),d.jsx("strong",{id:"architecture-map-title",children:"Subsystem relationship direction"}),d.jsx("small",{id:"architecture-map-help",children:"Scroll sideways or drag open canvas space to follow the complete architecture."})]}),d.jsxs("div",{className:"architecture-map-actions",children:[d.jsxs("div",{className:"architecture-route-mode",role:"group","aria-label":"Route visibility",children:[d.jsx("button",{type:"button","aria-pressed":y==="key",onClick:()=>S("key"),children:e?.kind==="group"?"Neighbors":"Key routes"}),d.jsxs("button",{type:"button","aria-pressed":y==="complete",onClick:()=>S("complete"),children:["All routes · ",t.routes.length]})]}),d.jsxs("div",{className:"architecture-map-toolbar","aria-label":"Map controls",children:[d.jsx("button",{type:"button","aria-label":"Zoom out",onClick:()=>c(_=>Math.max(.75,_-.25)),children:d.jsx(L4,{"aria-hidden":"true"})}),d.jsxs("span",{"aria-live":"polite",children:[Math.round(C*100),"%"]}),d.jsx("button",{type:"button","aria-label":"Zoom in",onClick:()=>c(_=>Math.min(2,_+.25)),children:d.jsx(u0,{"aria-hidden":"true"})}),d.jsx("button",{type:"button","aria-label":"Reset zoom and scroll position",title:"Reset zoom and scroll position",onClick:D,children:d.jsx(I0,{"aria-hidden":"true"})}),d.jsx("button",{type:"button","aria-label":"Reset subsystem positions",title:"Reset subsystem positions",disabled:Object.keys(s).length===0,onClick:R,children:d.jsx(h0,{"aria-hidden":"true"})})]})]})]}),d.jsx("div",{ref:M,className:"architecture-map-viewport",role:"region","aria-label":"Scrollable architecture flow diagram","aria-describedby":"architecture-map-help",tabIndex:0,"data-scroll-position":u,onScroll:se,children:ie.nodes.length>0?d.jsx("div",{className:"architecture-map-canvas",style:{width:z.width,height:z.height},children:d.jsxs("svg",{className:"architecture-map",viewBox:`0 0 ${ie.width} ${ie.height}`,role:"group","aria-label":zCe(ie.nodes.length,J.length,t.routes.length),onPointerDown:de,onPointerMove:be,onPointerUp:Ne,onPointerCancel:()=>{k.current=void 0},children:[d.jsxs("defs",{children:[d.jsx("marker",{id:"architecture-arrow",className:"architecture-arrow architecture-arrow-default",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:d.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})}),d.jsx("marker",{id:"architecture-arrow-incoming",className:"architecture-arrow architecture-arrow-incoming",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:d.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})}),d.jsx("marker",{id:"architecture-arrow-outgoing",className:"architecture-arrow architecture-arrow-outgoing",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:d.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})]}),d.jsxs("g",{className:"architecture-map-lanes","aria-hidden":"true",children:[ie.lanes.map(_=>d.jsxs("g",{children:[d.jsx("rect",{x:_.x+8,y:34,width:_.width-16,height:ie.height-76,rx:"12"}),d.jsx("text",{x:_.x+_.width/2,y:61,children:_.label})]},_.index)),d.jsx("text",{className:"architecture-map-direction",x:96,y:24,children:"PRIMARY CALL DIRECTION →"})]}),d.jsx("g",{className:"architecture-routes",children:J.map(_=>{const ce=F.reciprocals.get(_.id),Se=e?.kind==="route"&&e.id===_.id,_e=Se||e===void 0||e.kind==="group"&&ve.has(_.id),gt=_.inferred>_.extracted?"inferred":"extracted",Et=e?.kind==="group"?_.targetGroup===e.id?"incoming":_.sourceGroup===e.id?"outgoing":void 0:void 0,ot=y==="key"?.3+Math.sqrt(_.relationships/me)*.28:.1+Math.sqrt(_.relationships/me)*.2;return d.jsxs("g",{role:"button",tabIndex:0,"aria-label":`${_.sourceGroup} to ${_.targetGroup}, ${_.relationships} ${i}${ce?`; bidirectional, ${ce.relationships} reverse ${i}`:""}${_.direction==="backward"?", feedback route":""}`,"data-direction":_.direction,"data-evidence":gt,"data-reciprocal":ce?"true":void 0,"data-focus-direction":Et,"data-selected":Se||void 0,"data-dimmed":!_e||void 0,onClick:()=>U({kind:"route",id:_.id}),onKeyDown:Ce=>Q(Ce,{kind:"route",id:_.id}),children:[d.jsx("path",{className:"architecture-route-hit",d:_.path}),d.jsx("path",{className:"architecture-route-line",d:_.path,style:{strokeWidth:_.width,"--architecture-route-opacity":ot},markerStart:ce?jCe(Et):void 0,markerEnd:Et==="incoming"?"url(#architecture-arrow-incoming)":Et==="outgoing"?"url(#architecture-arrow-outgoing)":"url(#architecture-arrow)"}),d.jsxs("title",{children:[_.sourceGroup," → ",_.targetGroup,": ",_.relationships," ",i,ce&&` · ${ce.sourceGroup} → ${ce.targetGroup}: ${ce.relationships} ${i}`]})]},_.id)})}),d.jsx("g",{className:"architecture-map-nodes",children:ie.nodes.map(_=>{const ce=e?.kind==="group"&&e.id===_.id,Se=ce||e===void 0||e.kind==="group"&&ve.has(_.id)||e.kind==="route"&&t.routes.some(_e=>_e.id===e.id&&(_e.sourceGroup===_.id||_e.targetGroup===_.id));return d.jsxs("g",{role:"button",tabIndex:0,"aria-label":`${_.name}, ${_.nodeCount} visible symbols, ${_.incomingRelationships} incoming and ${_.outgoingRelationships} outgoing ${i}; drag to reposition`,transform:`translate(${_.x-_.width/2} ${_.y-_.height/2})`,"data-selected":ce||void 0,"data-dimmed":!Se||void 0,"data-dragging":T===_.id||void 0,onPointerDown:_e=>ge(_e,_),onPointerMove:_e=>{const gt=G.current;if(!gt||gt.id!==_.id||gt.pointerId!==_e.pointerId)return;const Et=JN(_e.currentTarget.ownerSVGElement,_e);Et&&((Math.abs(_e.clientX-gt.startClientX)>3||Math.abs(_e.clientY-gt.startClientY)>3)&&(gt.moved=!0),le(_.id,{x:Et.x-gt.offsetX,y:Et.y-gt.offsetY}))},onPointerUp:_e=>ae(_e,_),onPointerCancel:_e=>xe(_e),onKeyDown:_e=>Me(_e,_),children:[d.jsx("rect",{className:"architecture-map-node-shadow",width:_.width,height:_.height,rx:"9"}),d.jsx("rect",{className:"architecture-map-node-card",width:_.width,height:_.height,rx:"9"}),d.jsx("rect",{className:"architecture-map-node-accent",width:"4",height:_.height-16,x:"8",y:"8",rx:"2"}),d.jsx("text",{x:"20",y:"27",className:"architecture-map-node-name",children:kCe(_.name,24)}),d.jsxs("text",{x:"20",y:"48",className:"architecture-map-node-meta",children:[_.nodeCount.toLocaleString()," symbols"," · ","↓",_.incomingRelationships.toLocaleString()," ↑",_.outgoingRelationships.toLocaleString()]}),d.jsxs("g",{className:"architecture-map-node-grip","aria-hidden":"true",children:[d.jsx("circle",{cx:_.width-18,cy:"26",r:"1.2"}),d.jsx("circle",{cx:_.width-13,cy:"26",r:"1.2"}),d.jsx("circle",{cx:_.width-18,cy:"31",r:"1.2"}),d.jsx("circle",{cx:_.width-13,cy:"31",r:"1.2"}),d.jsx("circle",{cx:_.width-18,cy:"36",r:"1.2"}),d.jsx("circle",{cx:_.width-13,cy:"36",r:"1.2"})]}),d.jsxs("title",{children:[_.name," — drag to reposition"]})]},_.id)})})]})}):d.jsxs("div",{className:"architecture-map-empty",children:[d.jsx("strong",{children:"No architecture to draw"}),d.jsx("span",{children:"No subsystems match the current scope and evidence filters."})]})}),d.jsxs("footer",{className:"architecture-map-footer",children:[d.jsxs("div",{className:"architecture-map-legend","aria-label":"Map legend",children:[d.jsxs("span",{children:[d.jsx("i",{"data-evidence":"extracted"})," Extracted"]}),d.jsxs("span",{children:[d.jsx("i",{"data-evidence":"inferred"})," Inferred"]}),d.jsxs("span",{children:[d.jsx("i",{"data-direction":"incoming"})," Incoming"]}),d.jsxs("span",{children:[d.jsx("i",{"data-direction":"outgoing"})," Outgoing"]}),d.jsxs("span",{children:[d.jsx("i",{"data-direction":"bidirectional","aria-hidden":"true",children:"↔"})," Bidirectional"]}),d.jsxs("span",{children:[d.jsx("i",{"data-direction":"feedback"})," Feedback"]}),d.jsxs("span",{children:[d.jsx(G4,{"aria-hidden":"true"})," Drag cards to arrange"]}),ue>0&&d.jsxs("button",{type:"button",onClick:()=>S("complete"),children:[J.length," of ",t.routes.length," routes · Show all"]})]}),d.jsxs("details",{className:"architecture-map-table",children:[d.jsx("summary",{children:"View routes as a table"}),d.jsx("div",{children:d.jsxs("table",{children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"From"}),d.jsx("th",{children:"To"}),d.jsx("th",{children:"Relationships"}),d.jsx("th",{children:"Evidence"})]})}),d.jsx("tbody",{children:t.routes.map(_=>d.jsxs("tr",{children:[d.jsx("td",{children:tM(t,_.sourceGroup)}),d.jsx("td",{children:tM(t,_.targetGroup)}),d.jsx("td",{children:_.relationships.toLocaleString()}),d.jsxs("td",{children:[_.extracted," extracted · ",_.inferred," inferred"]})]},_.id))})]})})]})]})]})}function JN(t,e){if(!t)return;const n=t.getScreenCTM();if(!n)return;const i=t.createSVGPoint();i.x=e.clientX,i.y=e.clientY;const o=i.matrixTransform(n.inverse());return{x:o.x,y:o.y}}function eM(t){try{const e=JSON.parse(window.localStorage.getItem(t)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).flatMap(([n,i])=>i&&typeof i=="object"&&"x"in i&&"y"in i&&typeof i.x=="number"&&typeof i.y=="number"&&Number.isFinite(i.x)&&Number.isFinite(i.y)?[[n,{x:i.x,y:i.y}]]:[]))}catch{return{}}}function tM(t,e){return t.groups.find(n=>n.id===e)?.name??e}function kCe(t,e){return t.length<=e?t:`${t.slice(0,e-1)}…`}function DCe(t,e){const n=o=>[...o].sort((s,a)=>a.relationships-s.relationships||s.id.localeCompare(a.id)),i=new Set;if(e?.kind==="route"){const o=t.find(s=>s.id===e.id);if(o){i.add(o.id);const s=t.find(a=>a.sourceGroup===o.targetGroup&&a.targetGroup===o.sourceGroup);s&&i.add(s.id)}return i}else if(e?.kind==="group"){const o=n(t.filter(a=>a.targetGroup===e.id)).slice(0,6),s=n(t.filter(a=>a.sourceGroup===e.id)).slice(0,6);for(const a of n([...o,...s]))i.add(a.id);return i}for(const o of n(t)){if(i.size>=NCe)break;i.add(o.id)}return i}function _Ce(t,e){const n=new Map(t.map(a=>[nM(a.sourceGroup,a.targetGroup),a])),i=new Set,o=[],s=new Map;for(const a of t){if(i.has(a.id))continue;const l=n.get(nM(a.targetGroup,a.sourceGroup));if(!l||l.id===a.id||i.has(l.id)){o.push(a),i.add(a.id);continue}const C=a.id===e?a:l.id===e?l:a.relationships>l.relationships||a.relationships===l.relationships&&a.id.localeCompare(l.id)<=0?a:l,c=C.id===a.id?l:a;o.push(C),s.set(C.id,c),i.add(a.id),i.add(l.id)}return o.sort((a,l)=>l.relationships-a.relationships||a.id.localeCompare(l.id)),{routes:o,reciprocals:s}}function nM(t,e){return`${t}\0${e}`}function jCe(t){return t==="incoming"?"url(#architecture-arrow-outgoing)":t==="outgoing"?"url(#architecture-arrow-incoming)":"url(#architecture-arrow)"}function zCe(t,e,n){return e===n?`${t} subsystems and ${n} directed routes`:`${t} subsystems and ${e} of ${n} directed routes visible`}function PCe(t,e){const n=t.projections.find(y=>y.scope===(e.scope==="all"?"all_code":"production"));if(!n)throw new Error(`Architecture projection is missing scope '${e.scope}'`);const i=new Map(n.groups.map(y=>[y.id,y])),o=new Set(n.overviewGroupIds),s=new Map(n.memberships.map(y=>[t.nodes[y.nodeIndex].id,n.groups[y.groupIndex].id])),a=y=>{const S=s.get(y);return S?i.get(S)?.parentId??S:void 0},l=t.relationships.filter(y=>LCe(e.evidence,y.confidence)&&BCe(e.lens,y.relationClass)&&a(y.source)&&a(y.target)),C=new Map,c=new Map;for(const y of l){const S=a(y.source),T=a(y.target);if(S===T){C.set(S,(C.get(S)??0)+1);continue}if(!o.has(S)||!o.has(T))continue;const O=`${S}->${T}`,M=c.get(O)??[];M.push(y),c.set(O,M)}const u=[...c.entries()].map(([y,S])=>({id:y,sourceGroup:a(S[0].source),targetGroup:a(S[0].target),relationships:S.length,extracted:S.filter(T=>T.confidence==="extracted").length,inferred:S.filter(T=>T.confidence==="inferred").length,ambiguous:S.filter(T=>T.confidence==="ambiguous").length})).sort((y,S)=>S.relationships-y.relationships||y.id.localeCompare(S.id)),h=new Map,m=new Map;for(const y of u)m.set(y.sourceGroup,(m.get(y.sourceGroup)??0)+y.relationships),h.set(y.targetGroup,(h.get(y.targetGroup)??0)+y.relationships);const v=n.overviewGroupIds.flatMap(y=>{const S=i.get(y);return S?[{id:S.id,name:S.name.value,nodeCount:S.nodeCount,totalNodeCount:S.nodeCount,internalRelationshipCount:C.get(S.id)??0,incomingRelationships:h.get(S.id)??0,outgoingRelationships:m.get(S.id)??0,scopes:S.sourceScopes}]:[]}),b=v.reduce((y,S)=>y+S.nodeCount,0),x=v.reduce((y,S)=>y+S.internalRelationshipCount,0)+u.reduce((y,S)=>y+S.relationships,0);return{title:t.title,scope:e.scope,evidence:e.evidence,lens:e.lens,groups:v,routes:u,statistics:{visibleNodes:b,totalNodes:n.quality.metrics.sourceScopes.production+n.quality.metrics.sourceScopes.test+n.quality.metrics.sourceScopes.generated+n.quality.metrics.sourceScopes.vendor+n.quality.metrics.sourceScopes.unknown,visibleRelationships:x,totalRelationships:l.length,communities:t.statistics.communities,extracted:t.statistics.extracted,inferred:t.statistics.inferred,ambiguous:t.statistics.ambiguous},coverage:{internal:n.coverage.internal,crossGroup:n.coverage.crossGroup,unassigned:n.coverage.unassigned},omissions:n.omissions,quality:n.quality,provenance:t.provenance}}function LCe(t,e){return t==="all"||t===e}function BCe(t,e){return t==="all"?e!=="unknown":t==="architecture"?e==="execution"||e==="dependency":t===e}function iM(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,sM=oM,Jp=(t,e)=>n=>{var i;if(e?.variants==null)return sM(t,n?.class,n?.className);const{variants:o,defaultVariants:s}=e,a=Object.keys(o).map(c=>{const u=n?.[c],h=s?.[c];if(u===null)return null;const m=rM(u)||rM(h);return o[c][m]}),l=n&&Object.entries(n).reduce((c,u)=>{let[h,m]=u;return m===void 0||(c[h]=m),c},{}),C=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((c,u)=>{let{class:h,className:m,...v}=u;return Object.entries(v).every(b=>{let[x,y]=b;return Array.isArray(y)?y.includes({...s,...l}[x]):{...s,...l}[x]===y})?[...c,h,m]:c},[]);return sM(t,a,C,n?.class,n?.className)},ZCe=(t,e)=>{const n=new Array(t.length+e.length);for(let i=0;i({classGroupId:t,validator:e}),gM=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Nc="-",aM=[],FCe="arbitrary..",VCe=t=>{const e=HCe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return UCe(a);const l=a.split(Nc),C=l[0]===""&&l.length>1?1:0;return AM(l,C,e)},getConflictingClassGroupIds:(a,l)=>{if(l){const C=i[a],c=n[a];return C?c?ZCe(c,C):C:c||aM}return n[a]||aM}}},AM=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const o=t[e],s=n.nextPart.get(o);if(s){const c=AM(t,e+1,s);if(c)return c}const a=n.validators;if(a===null)return;const l=e===0?t.join(Nc):t.slice(e).join(Nc),C=a.length;for(let c=0;ct.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),i=e.slice(0,n);return i?FCe+i:void 0})(),HCe=t=>{const{theme:e,classGroups:n}=t;return YCe(n,e)},YCe=(t,e)=>{const n=gM();for(const i in t){const o=t[i];em(o,n,i,e)}return n},em=(t,e,n,i)=>{const o=t.length;for(let s=0;s{if(typeof t=="string"){WCe(t,e,n);return}if(typeof t=="function"){KCe(t,e,n,i);return}XCe(t,e,n,i)},WCe=(t,e,n)=>{const i=t===""?e:lM(e,t);i.classGroupId=n},KCe=(t,e,n,i)=>{if(QCe(t)){em(t(i),e,n,i);return}e.validators===null&&(e.validators=[]),e.validators.push(GCe(n,t))},XCe=(t,e,n,i)=>{const o=Object.entries(t),s=o.length;for(let a=0;a{let n=t;const i=e.split(Nc),o=i.length;for(let s=0;s"isThemeGetter"in t&&t.isThemeGetter===!0,qCe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),i=Object.create(null);const o=(s,a)=>{n[s]=a,e++,e>t&&(e=0,i=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=i[s])!==void 0)return o(s,a),a},set(s,a){s in n?n[s]=a:o(s,a)}}},tm="!",CM=":",JCe=[],IM=(t,e,n,i,o)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:i,isExternal:o}),eIe=t=>{const{prefix:e,experimentalParseClassName:n}=t;let i=o=>{const s=[];let a=0,l=0,C=0,c;const u=o.length;for(let x=0;xC?c-C:void 0;return IM(s,v,m,b)};if(e){const o=e+CM,s=i;i=a=>a.startsWith(o)?s(a.slice(o.length)):IM(JCe,!1,a,void 0,!0)}if(n){const o=i;i=s=>n({className:s,parseClassName:o})}return i},tIe=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,i)=>{e.set(n,1e6+i)}),n=>{const i=[];let o=[];for(let s=0;s0&&(o.sort(),i.push(...o),o=[]),i.push(a)):o.push(a)}return o.length>0&&(o.sort(),i.push(...o)),i}},nIe=t=>({cache:qCe(t.cacheSize),parseClassName:eIe(t),sortModifiers:tIe(t),postfixLookupClassGroupIds:iIe(t),...VCe(t)}),iIe=t=>{const e=Object.create(null),n=t.postfixLookupClassGroups;if(n)for(let i=0;i{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:o,sortModifiers:s,postfixLookupClassGroupIds:a}=e,l=[],C=t.trim().split(oIe);let c="";for(let u=C.length-1;u>=0;u-=1){const h=C[u],{isExternal:m,modifiers:v,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:y}=n(h);if(m){c=h+(c.length>0?" "+c:c);continue}let S=!!y,T;if(S){const L=x.substring(0,y);T=i(L);const F=T&&a[T]?i(x):void 0;F&&F!==T&&(T=F,S=!1)}else T=i(x);if(!T){if(!S){c=h+(c.length>0?" "+c:c);continue}if(T=i(x),!T){c=h+(c.length>0?" "+c:c);continue}S=!1}const O=v.length===0?"":v.length===1?v[0]:s(v).join(":"),M=b?O+tm:O,k=M+T;if(l.indexOf(k)>-1)continue;l.push(k);const G=o(T,S);for(let L=0;L0?" "+c:c)}return c},sIe=(...t)=>{let e=0,n,i,o="";for(;e{if(typeof t=="string")return t;let e,n="";for(let i=0;i{let n,i,o,s;const a=C=>{const c=e.reduce((u,h)=>h(u),t());return n=nIe(c),i=n.cache.get,o=n.cache.set,s=l,l(C)},l=C=>{const c=i(C);if(c)return c;const u=rIe(C,n);return o(C,u),u};return s=a,(...C)=>s(sIe(...C))},aIe=[],bn=t=>{const e=n=>n[t]||aIe;return e.isThemeGetter=!0,e},dM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,uM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,AIe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lIe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CIe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,IIe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,cIe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dIe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vr=t=>AIe.test(t),tt=t=>!!t&&!Number.isNaN(Number(t)),Eo=t=>!!t&&Number.isInteger(Number(t)),nm=t=>t.endsWith("%")&&tt(t.slice(0,-1)),qo=t=>lIe.test(t),hM=()=>!0,uIe=t=>CIe.test(t)&&!IIe.test(t),im=()=>!1,hIe=t=>cIe.test(t),fIe=t=>dIe.test(t),pIe=t=>!Oe(t)&&!ke(t),mIe=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),vIe=t=>Ur(t,bM,im),Oe=t=>dM.test(t),Ws=t=>Ur(t,wM,uIe),fM=t=>Ur(t,OIe,tt),yIe=t=>Ur(t,SM,hM),bIe=t=>Ur(t,xM,im),pM=t=>Ur(t,vM,im),wIe=t=>Ur(t,yM,fIe),Mc=t=>Ur(t,EM,hIe),ke=t=>uM.test(t),bl=t=>Ks(t,wM),xIe=t=>Ks(t,xM),mM=t=>Ks(t,vM),SIe=t=>Ks(t,bM),EIe=t=>Ks(t,yM),Rc=t=>Ks(t,EM,!0),TIe=t=>Ks(t,SM,!0),Ur=(t,e,n)=>{const i=dM.exec(t);return i?i[1]?e(i[1]):n(i[2]):!1},Ks=(t,e,n=!1)=>{const i=uM.exec(t);return i?i[1]?e(i[1]):n:!1},vM=t=>t==="position"||t==="percentage",yM=t=>t==="image"||t==="url",bM=t=>t==="length"||t==="size"||t==="bg-size",wM=t=>t==="length",OIe=t=>t==="number",xM=t=>t==="family-name",SM=t=>t==="number"||t==="weight",EM=t=>t==="shadow",NIe=gIe(()=>{const t=bn("color"),e=bn("font"),n=bn("text"),i=bn("font-weight"),o=bn("tracking"),s=bn("leading"),a=bn("breakpoint"),l=bn("container"),C=bn("spacing"),c=bn("radius"),u=bn("shadow"),h=bn("inset-shadow"),m=bn("text-shadow"),v=bn("drop-shadow"),b=bn("blur"),x=bn("perspective"),y=bn("aspect"),S=bn("ease"),T=bn("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...M(),ke,Oe],G=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],F=()=>[ke,Oe,C],re=()=>[Vr,"full","auto",...F()],pe=()=>[Eo,"none","subgrid",ke,Oe],ie=()=>["auto",{span:["full",Eo,ke,Oe]},Eo,ke,Oe],J=()=>[Eo,"auto",ke,Oe],ve=()=>["auto","min","max","fr",ke,Oe],me=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ue=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...F()],U=()=>[Vr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...F()],Q=()=>[Vr,"screen","full","dvw","lvw","svw","min","max","fit",...F()],le=()=>[Vr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...F()],X=()=>[t,ke,Oe],R=()=>[...M(),mM,pM,{position:[ke,Oe]}],D=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",SIe,vIe,{size:[ke,Oe]}],se=()=>[nm,bl,Ws],de=()=>["","none","full",c,ke,Oe],be=()=>["",tt,bl,Ws],Ne=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[tt,nm,mM,pM],xe=()=>["","none",b,ke,Oe],Me=()=>["none",tt,ke,Oe],_=()=>["none",tt,ke,Oe],ce=()=>[tt,ke,Oe],Se=()=>[Vr,"full",...F()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[qo],breakpoint:[qo],color:[hM],container:[qo],"drop-shadow":[qo],ease:["in","out","in-out"],font:[pIe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[qo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[qo],shadow:[qo],spacing:["px",tt],text:[qo],"text-shadow":[qo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Vr,Oe,ke,y]}],container:["container"],"container-type":[{"@container":["","normal","size",ke,Oe]}],"container-named":[mIe],columns:[{columns:[tt,Oe,ke,l]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:re()}],"inset-x":[{"inset-x":re()}],"inset-y":[{"inset-y":re()}],start:[{"inset-s":re(),start:re()}],end:[{"inset-e":re(),end:re()}],"inset-bs":[{"inset-bs":re()}],"inset-be":[{"inset-be":re()}],top:[{top:re()}],right:[{right:re()}],bottom:[{bottom:re()}],left:[{left:re()}],visibility:["visible","invisible","collapse"],z:[{z:[Eo,"auto",ke,Oe]}],basis:[{basis:[Vr,"full","auto",l,...F()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tt,Vr,"auto","initial","none",Oe]}],grow:[{grow:["",tt,ke,Oe]}],shrink:[{shrink:["",tt,ke,Oe]}],order:[{order:[Eo,"first","last","none",ke,Oe]}],"grid-cols":[{"grid-cols":pe()}],"col-start-end":[{col:ie()}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":pe()}],"row-start-end":[{row:ie()}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ve()}],"auto-rows":[{"auto-rows":ve()}],gap:[{gap:F()}],"gap-x":[{"gap-x":F()}],"gap-y":[{"gap-y":F()}],"justify-content":[{justify:[...me(),"normal"]}],"justify-items":[{"justify-items":[...ue(),"normal"]}],"justify-self":[{"justify-self":["auto",...ue()]}],"align-content":[{content:["normal",...me()]}],"align-items":[{items:[...ue(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ue(),{baseline:["","last"]}]}],"place-content":[{"place-content":me()}],"place-items":[{"place-items":[...ue(),"baseline"]}],"place-self":[{"place-self":["auto",...ue()]}],p:[{p:F()}],px:[{px:F()}],py:[{py:F()}],ps:[{ps:F()}],pe:[{pe:F()}],pbs:[{pbs:F()}],pbe:[{pbe:F()}],pt:[{pt:F()}],pr:[{pr:F()}],pb:[{pb:F()}],pl:[{pl:F()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":F()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":F()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...Q()]}],"min-inline-size":[{"min-inline":["auto",...Q()]}],"max-inline-size":[{"max-inline":["none",...Q()]}],"block-size":[{block:["auto",...le()]}],"min-block-size":[{"min-block":["auto",...le()]}],"max-block-size":[{"max-block":["none",...le()]}],w:[{w:[l,"screen",...U()]}],"min-w":[{"min-w":[l,"screen","none",...U()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,bl,Ws]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,TIe,yIe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nm,Oe]}],"font-family":[{font:[xIe,bIe,e]}],"font-features":[{"font-features":[Oe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ke,Oe]}],"line-clamp":[{"line-clamp":[tt,"none",ke,fM]}],leading:[{leading:[s,...F()]}],"list-image":[{"list-image":["none",ke,Oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:X()}],"text-color":[{text:X()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ne(),"wavy"]}],"text-decoration-thickness":[{decoration:[tt,"from-font","auto",ke,Ws]}],"text-decoration-color":[{decoration:X()}],"underline-offset":[{"underline-offset":[tt,"auto",ke,Oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"tab-size":[{tab:[Eo,ke,Oe]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Oe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:D()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Eo,ke,Oe],radial:["",ke,Oe],conic:[Eo,ke,Oe]},EIe,wIe]}],"bg-color":[{bg:X()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:X()}],"gradient-via":[{via:X()}],"gradient-to":[{to:X()}],rounded:[{rounded:de()}],"rounded-s":[{"rounded-s":de()}],"rounded-e":[{"rounded-e":de()}],"rounded-t":[{"rounded-t":de()}],"rounded-r":[{"rounded-r":de()}],"rounded-b":[{"rounded-b":de()}],"rounded-l":[{"rounded-l":de()}],"rounded-ss":[{"rounded-ss":de()}],"rounded-se":[{"rounded-se":de()}],"rounded-ee":[{"rounded-ee":de()}],"rounded-es":[{"rounded-es":de()}],"rounded-tl":[{"rounded-tl":de()}],"rounded-tr":[{"rounded-tr":de()}],"rounded-br":[{"rounded-br":de()}],"rounded-bl":[{"rounded-bl":de()}],"border-w":[{border:be()}],"border-w-x":[{"border-x":be()}],"border-w-y":[{"border-y":be()}],"border-w-s":[{"border-s":be()}],"border-w-e":[{"border-e":be()}],"border-w-bs":[{"border-bs":be()}],"border-w-be":[{"border-be":be()}],"border-w-t":[{"border-t":be()}],"border-w-r":[{"border-r":be()}],"border-w-b":[{"border-b":be()}],"border-w-l":[{"border-l":be()}],"divide-x":[{"divide-x":be()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":be()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ne(),"hidden","none"]}],"divide-style":[{divide:[...Ne(),"hidden","none"]}],"border-color":[{border:X()}],"border-color-x":[{"border-x":X()}],"border-color-y":[{"border-y":X()}],"border-color-s":[{"border-s":X()}],"border-color-e":[{"border-e":X()}],"border-color-bs":[{"border-bs":X()}],"border-color-be":[{"border-be":X()}],"border-color-t":[{"border-t":X()}],"border-color-r":[{"border-r":X()}],"border-color-b":[{"border-b":X()}],"border-color-l":[{"border-l":X()}],"divide-color":[{divide:X()}],"outline-style":[{outline:[...Ne(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tt,ke,Oe]}],"outline-w":[{outline:["",tt,bl,Ws]}],"outline-color":[{outline:X()}],shadow:[{shadow:["","none",u,Rc,Mc]}],"shadow-color":[{shadow:X()}],"inset-shadow":[{"inset-shadow":["none",h,Rc,Mc]}],"inset-shadow-color":[{"inset-shadow":X()}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:X()}],"ring-offset-w":[{"ring-offset":[tt,Ws]}],"ring-offset-color":[{"ring-offset":X()}],"inset-ring-w":[{"inset-ring":be()}],"inset-ring-color":[{"inset-ring":X()}],"text-shadow":[{"text-shadow":["none",m,Rc,Mc]}],"text-shadow-color":[{"text-shadow":X()}],opacity:[{opacity:[tt,ke,Oe]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":X()}],"mask-image-linear-to-color":[{"mask-linear-to":X()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":X()}],"mask-image-t-to-color":[{"mask-t-to":X()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":X()}],"mask-image-r-to-color":[{"mask-r-to":X()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":X()}],"mask-image-b-to-color":[{"mask-b-to":X()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":X()}],"mask-image-l-to-color":[{"mask-l-to":X()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":X()}],"mask-image-x-to-color":[{"mask-x-to":X()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":X()}],"mask-image-y-to-color":[{"mask-y-to":X()}],"mask-image-radial":[{"mask-radial":[ke,Oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":X()}],"mask-image-radial-to-color":[{"mask-radial-to":X()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":X()}],"mask-image-conic-to-color":[{"mask-conic-to":X()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:D()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Oe]}],filter:[{filter:["","none",ke,Oe]}],blur:[{blur:xe()}],brightness:[{brightness:[tt,ke,Oe]}],contrast:[{contrast:[tt,ke,Oe]}],"drop-shadow":[{"drop-shadow":["","none",v,Rc,Mc]}],"drop-shadow-color":[{"drop-shadow":X()}],grayscale:[{grayscale:["",tt,ke,Oe]}],"hue-rotate":[{"hue-rotate":[tt,ke,Oe]}],invert:[{invert:["",tt,ke,Oe]}],saturate:[{saturate:[tt,ke,Oe]}],sepia:[{sepia:["",tt,ke,Oe]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Oe]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[tt,ke,Oe]}],"backdrop-contrast":[{"backdrop-contrast":[tt,ke,Oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tt,ke,Oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tt,ke,Oe]}],"backdrop-invert":[{"backdrop-invert":["",tt,ke,Oe]}],"backdrop-opacity":[{"backdrop-opacity":[tt,ke,Oe]}],"backdrop-saturate":[{"backdrop-saturate":[tt,ke,Oe]}],"backdrop-sepia":[{"backdrop-sepia":["",tt,ke,Oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":F()}],"border-spacing-x":[{"border-spacing-x":F()}],"border-spacing-y":[{"border-spacing-y":F()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tt,"initial",ke,Oe]}],ease:[{ease:["linear","initial",S,ke,Oe]}],delay:[{delay:[tt,ke,Oe]}],animate:[{animate:["none",T,ke,Oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,ke,Oe]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:Me()}],"rotate-x":[{"rotate-x":Me()}],"rotate-y":[{"rotate-y":Me()}],"rotate-z":[{"rotate-z":Me()}],scale:[{scale:_()}],"scale-x":[{"scale-x":_()}],"scale-y":[{"scale-y":_()}],"scale-z":[{"scale-z":_()}],"scale-3d":["scale-3d"],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[ke,Oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],zoom:[{zoom:[Eo,ke,Oe]}],accent:[{accent:X()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:X()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Oe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":X()}],"scrollbar-track-color":[{"scrollbar-track":X()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mbs":[{"scroll-mbs":F()}],"scroll-mbe":[{"scroll-mbe":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pbs":[{"scroll-pbs":F()}],"scroll-pbe":[{"scroll-pbe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Oe]}],fill:[{fill:["none",...X()]}],"stroke-w":[{stroke:[tt,bl,Ws,fM]}],stroke:[{stroke:["none",...X()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function wl(...t){return NIe(oM(t))}const MIe=Jp("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function om({className:t,variant:e,...n}){return d.jsx("div",{"data-slot":"alert",role:"alert",className:wl(MIe({variant:e}),t),...n})}function rm({className:t,...e}){return d.jsx("div",{"data-slot":"alert-title",className:wl("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...e})}function sm({className:t,...e}){return d.jsx("div",{"data-slot":"alert-description",className:wl("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...e})}const RIe=Jp("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Hr({className:t,variant:e="default",asChild:n=!1,...i}){const o=n?yw:"span";return d.jsx(o,{"data-slot":"badge","data-variant":e,className:wl(RIe({variant:e}),t),...i})}const kIe=Jp("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function gm({className:t,variant:e="default",size:n="default",asChild:i=!1,...o}){const s=i?yw:"button";return d.jsx(s,{"data-slot":"button","data-variant":e,"data-size":n,className:wl(kIe({variant:e,size:n,className:t})),...o})}const am={resolved:0,inferred:1,ambiguous:2,unresolved:3};function DIe({graph:t,host:e}){const n=new Map,i=_Ie(t);for(const s of t.edges){const a=n.get(s.target);(!a||am[s.resolution]>am[a])&&n.set(s.target,s.resolution)}const o={schema:"compass.viewer.graph/1",title:`Calls from ${t.nodes.find(s=>s.id===t.rootSymbol)?.name??t.rootSymbol}`,stats:{nodes:t.nodes.length,edges:t.edges.length,communities:4,aggregated:!1},nodes:t.nodes.map(s=>({id:s.id,label:s.name,kind:s.unresolved?"Unresolved call":"Function",community:am[n.get(s.id)??"resolved"],communityName:n.get(s.id)??"resolved",depth:i.get(s.id),root:s.id===t.rootSymbol,source:jIe(s)})),edges:t.edges.map(s=>({id:s.id,source:s.source,target:s.target,relation:`${s.callee} · ${s.resolution}`,confidence:s.resolution==="resolved"?"extracted":s.resolution==="inferred"?"inferred":"ambiguous"})),communities:[{id:0,label:"Resolved",color:"#59A14F",hidden:!1},{id:1,label:"Inferred",color:"#4E79A7",hidden:!1},{id:2,label:"Ambiguous",color:"#F28E2B",hidden:!1},{id:3,label:"Unresolved",color:"#E15759",hidden:!1}],hyperedges:[]};return d.jsx(Wp,{model:o,host:e,preferredLayout:"hierarchical"})}function _Ie(t){const e=new Map;for(const o of t.edges){const s=e.get(o.source)??[];s.push(o.target),e.set(o.source,s);const a=e.get(o.target)??[];a.push(o.source),e.set(o.target,a)}const n=new Map([[t.rootSymbol,0]]),i=[t.rootSymbol];for(;i.length>0;){const o=i.shift();if(o===void 0)break;const s=n.get(o)??0;for(const a of e.get(o)??[])n.has(a)||(n.set(a,s+1),i.push(a))}return n}function jIe(t){if(t.anchor)return{file:t.anchor.source_file,startByte:t.anchor.start_byte,endByte:t.anchor.end_byte};if(t.file)return{file:t.file,...t.startLine!=null?{startLine:t.startLine}:{},...t.endLine!=null?{endLine:t.endLine}:{},...t.startByte!=null?{startByte:t.startByte}:{},...t.endByte!=null?{endByte:t.endByte}:{}}}function zIe({coverage:t}){return!t.partial&&t.unresolved===0&&t.ambiguous===0?null:d.jsxs(om,{children:[d.jsx(rm,{children:"Partial call coverage"}),d.jsx(sm,{children:t.warning})]})}function PIe({graph:t,host:e}){const[n,i]=E.useState(!1),o=n?t.continuations:t.continuations.slice(0,20),s=t.direction==="callers"?"No callers found":t.direction==="callees"?"No callees found":"No calls found";return d.jsxs("div",{className:"call-graph-view relative h-screen",children:[d.jsx(DIe,{graph:t,host:e}),d.jsx("div",{className:"call-graph-direction absolute top-2 left-1/2 z-20 flex -translate-x-1/2 gap-1 rounded-md border bg-popover/95 p-1 shadow-lg backdrop-blur",role:"group","aria-label":"Call graph direction",children:[["callers","Callers"],["both","Both"],["callees","Callees"]].map(([a,l])=>d.jsx(gm,{size:"sm",variant:t.direction===a?"secondary":"ghost","aria-pressed":t.direction===a,disabled:!e.changeDirection,onClick:()=>{t.direction!==a&&e.changeDirection?.(a)},children:l},a))}),d.jsxs("section",{className:"call-graph-summary absolute bottom-3 left-3 z-20 flex max-w-[min(44rem,calc(100%-1.5rem))] flex-col gap-2 rounded-md border bg-popover/95 p-3 text-popover-foreground shadow-xl backdrop-blur",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsxs(Hr,{variant:"outline",children:[d.jsx(fu,{})," depth ",t.depth]}),d.jsxs(Hr,{variant:"outline",children:[t.nodes.length," ",t.nodes.length===1?"node":"nodes"]}),d.jsxs(Hr,{variant:"outline",children:[t.edges.length," ",t.edges.length===1?"edge":"edges"]}),d.jsxs(Hr,{variant:"secondary",children:[t.coverage.resolved," resolved"]}),d.jsxs(Hr,{variant:"outline",children:[t.coverage.inferred," inferred"]}),d.jsxs(Hr,{variant:"outline",children:[t.coverage.ambiguous," ambiguous"]}),d.jsxs(Hr,{variant:"destructive",children:[t.coverage.unresolved," unresolved"]}),t.coverage.evidenceLayer&&d.jsx(Hr,{variant:"outline",children:LIe(t.coverage.evidenceLayer)})]}),t.edges.length===0&&d.jsxs(om,{children:[d.jsx(rm,{children:s}),d.jsx(sm,{children:"Compass found the root function but no represented relationships in this direction."})]}),t.truncated&&d.jsxs(om,{children:[d.jsx(IA,{}),d.jsx(rm,{children:"Partial call graph"}),d.jsx(sm,{children:"Compass reached the configured graph limit. Counts and paths may be incomplete."})]}),d.jsx(zIe,{coverage:t.coverage}),t.continuations.length>0&&d.jsxs("div",{children:[d.jsx("div",{className:"flex max-h-24 flex-wrap gap-1 overflow-auto","aria-label":"Call graph continuations",children:o.map(a=>d.jsxs(gm,{size:"xs",variant:"outline",disabled:!e.expand,onClick:()=>e.expand?.(a.symbol,a.direction,a.nextDepth),children:[a.direction==="callers"?d.jsx(f4,{}):a.direction==="callees"?d.jsx(u4,{}):d.jsx(u0,{}),"Expand ",a.direction]},`${a.symbol}:${a.direction}:${a.nextDepth}`))}),!n&&t.continuations.length>o.length&&d.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:[d.jsxs("p",{className:"text-xs text-muted-foreground",role:"status",children:["Showing ",o.length," of ",t.continuations.length," continuations"]}),d.jsxs(gm,{size:"xs",variant:"outline",onClick:()=>i(!0),children:["Show all ",t.continuations.length," continuations"]})]})]})]})]})}function LIe(t){return t.split("_").map((e,n)=>n===0?`${e.slice(0,1).toUpperCase()}${e.slice(1)}`:e).join(" ")}const TM=0;function BIe(t,e){const n=new Set(t.nodes.map(C=>C.id)),i=t.edges.filter(C=>n.has(C.source)&&n.has(C.target)).map(GIe),o=new Map;for(const C of i)o.set(C.source,(o.get(C.source)??0)+1),o.set(C.target,(o.get(C.target)??0)+1);const s=VIe(t),a=new Set(t.paths.flatMap(C=>C.nodeIds.slice(0,1))),l=t.nodes.map(C=>ZIe(C,o.get(C.id)??0,s.get(C.id),a.has(C.id)));return{schema:"compass.viewer.graph/1",title:e,stats:{nodes:l.length,edges:i.length,communities:l.length>0?1:0,aggregated:!1},nodes:l,edges:i,communities:l.length>0?[{id:TM,label:"Query result",color:"#6f7bf7",hidden:!1}]:[],hyperedges:[]}}function ZIe(t,e,n,i){const o=t.details?.type==="symbol"?t.details.data.signature??void 0:void 0;return{id:t.id,label:t.name,kind:t.kind,community:TM,communityName:"Query result",degree:e,...n!==void 0?{depth:n}:{},...i?{root:!0}:{},...t.language?{language:t.language}:{},...o?{signature:o}:{},...t.source?{source:t.source}:{},codeEvidence:t.evidence}}function GIe(t){const e=FIe(t);return{id:t.id,source:t.source,target:t.target,relation:t.kind,...t.relationshipSite?{relationshipSite:t.relationshipSite}:{},...t.details?{details:t.details}:{},...e?{confidence:e}:{},codeEvidence:t.evidence}}function FIe(t){return t.evidence.some(e=>e.confidence==="ambiguous")?"ambiguous":t.evidence.some(e=>e.confidence==="inferred")?"inferred":t.evidence.length>0?"extracted":void 0}function VIe(t){const e=new Map;for(const n of t.paths)n.nodeIds.forEach((i,o)=>{const s=e.get(i);(s===void 0||o[y.id,y])),i=new Map(e.nodes.map(y=>[y.id,y])),o=new Map,s=[],a=OM(i,n),l=OM(n,i),C=new Map(HIe(i,n).map(y=>[y,W0(n.get(y),i.get(y),"node")])),c=[...C.entries()].filter(([,y])=>y.fields.length>0).map(([y])=>y),u=$Ie(t.edges,e.edges),h=u.matched.map(({before:y,after:S})=>({before:y,after:S,evidence:YIe(y,S)})).filter(({evidence:y})=>y.fields.length>0);for(const y of a)Am(o,i.get(y),"added",jC(void 0,i.get(y)));for(const y of l)Am(o,n.get(y),"removed",jC(n.get(y),void 0));for(const y of c)Am(o,i.get(y),"changed",C.get(y));for(const y of u.added)s.push({...y,change:"added",evidence:jC(void 0,y)}),lm(o,y,n,i);for(const y of u.removed)s.push({...y,change:"removed",evidence:jC(y,void 0)}),lm(o,y,n,i);for(const{after:y,evidence:S}of h)s.push({...y,change:"changed",evidence:S}),lm(o,y,n,i);const m=[...o.values()].sort((y,S)=>y.id.localeCompare(S.id));s.sort((y,S)=>y.id.localeCompare(S.id));const v=WIe(s),b=new Set(m.map(y=>y.community)),x=[...e.communities,...t.communities.filter(y=>!e.communities.some(S=>S.id===y.id))].filter(y=>b.has(y.id));return{addedNodes:a.length,removedNodes:l.length,changedNodes:c.length,addedEdges:u.added.length,removedEdges:u.removed.length,changedEdges:h.length,graph:{...e,title:`Graph delta · ${e.title}`,stats:{...e.stats,nodes:m.length,edges:v.length,communities:x.length,aggregated:t.stats.aggregated||e.stats.aggregated},nodes:m,edges:v,communities:x,hyperedges:[]}}}function OM(t,e){return[...t.keys()].filter(n=>!e.has(n))}function HIe(t,e){return[...t.keys()].filter(n=>e.has(n))}function Am(t,e,n,i){e&&t.set(e.id,{...e,change:n,...i?{evidence:i}:{}})}function NM(t,e,n,i){if(t.has(e))return;const o=i.get(e)??n.get(e);o&&t.set(e,{...o,change:"unchanged"})}function lm(t,e,n,i){NM(t,e.source,n,i),NM(t,e.target,n,i)}function YIe(t,e){return W0({...t,id:e.id},e,"edge")}function $Ie(t,e){const n=new Set,i=new Set,o=[],s=(l,C)=>{n.add(l),i.add(C),o.push({before:t[l],after:e[C]})};MM(t,e,n,i,s,l=>Dc(l.id)?void 0:l.id),MM(t,e,n,i,s,l=>Dc(l.id)?Cm(l):void 0);const a=new Map;t.forEach((l,C)=>{if(n.has(C)||!Dc(l.id))return;const c=a.get(kc(l))??{parent:[],current:[]};c.parent.push(C),a.set(kc(l),c)}),e.forEach((l,C)=>{if(i.has(C)||!Dc(l.id))return;const c=a.get(kc(l))??{parent:[],current:[]};c.current.push(C),a.set(kc(l),c)});for(const l of a.values()){l.parent.sort((c,u)=>RM(t[c],t[u])),l.current.sort((c,u)=>RM(e[c],e[u]));const C=Math.min(l.parent.length,l.current.length);for(let c=0;c!i.has(C)),removed:t.filter((l,C)=>!n.has(C))}}function MM(t,e,n,i,o,s){const a=new Map;e.forEach((l,C)=>{if(i.has(C))return;const c=s(l);if(c===void 0)return;const u=a.get(c)??[];u.push(C),a.set(c,u)}),t.forEach((l,C)=>{if(n.has(C))return;const c=s(l);if(c===void 0)return;const h=a.get(c)?.shift();h!==void 0&&o(C,h)})}function Cm(t){return JSON.stringify(JB(t,"edge"))}function kc(t){return JSON.stringify([t.source,t.target,t.relation])}function RM(t,e){return Cm(t).localeCompare(Cm(e))||t.id.localeCompare(e.id)}function Dc(t){return/^edge-\d+-/.test(t)}function WIe(t){const e=new Map;return t.map(n=>{const i=e.get(n.id)??0;return e.set(n.id,i+1),i===0?n:{...n,id:`${n.id}::${n.change}-${i}`}})}function KIe({workbench:t,host:e,communityDetail:n,communityLoading:i,communityError:o,onBackToOverview:s,initialInspectorLayout:a,onInspectorLayoutChange:l,themePreference:C,onThemePreferenceChange:c}){const[u,h]=E.useState(()=>DM(t)??t.defaultView),m=t.views.length<=1,[v,b]=E.useState(m),[x,y]=E.useState(null),S=t.views.find(O=>O.id===u)??t.views[0];E.useEffect(()=>{const O=()=>{const M=DM(t);M&&h(M)};return window.addEventListener("hashchange",O),()=>window.removeEventListener("hashchange",O)},[t]);const T=O=>{h(O);const M=`view=${encodeURIComponent(O)}`;window.location.hash.slice(1)!==M&&(window.location.hash=M)};return S?d.jsxs("div",{className:"visualization-workbench","data-navigation-collapsed":v,children:[d.jsxs("aside",{className:"visualization-rail","data-collapsed":v,"aria-label":"Compass navigation",children:[d.jsxs("header",{children:[d.jsx("span",{className:"visualization-bearing","aria-hidden":"true",children:d.jsx(pw,{className:"compass-navigation-logo",variant:"app"})}),d.jsxs("span",{children:[d.jsx("strong",{children:"Compass"}),d.jsx("small",{title:t.title,children:t.title})]}),d.jsx("button",{className:"visualization-rail-disclosure",type:"button","aria-label":v?"Expand graph navigation":"Collapse graph navigation",title:v?"Expand graph navigation":"Collapse graph navigation",onClick:()=>b(O=>!O),children:v?d.jsx(V4,{"aria-hidden":"true"}):d.jsx(F4,{"aria-hidden":"true"})})]}),m?d.jsx("nav",{"aria-label":"Graph views"}):d.jsx("nav",{"aria-label":"Graph views",children:t.views.map(O=>d.jsxs("button",{type:"button","aria-current":O.id===S.id?"page":void 0,onClick:()=>T(O.id),children:[d.jsx(tce,{view:O}),d.jsxs("span",{children:[d.jsx("strong",{children:O.title}),d.jsx("small",{children:O.description})]}),d.jsx("i",{"data-status":O.coverage.status,title:`${O.coverage.status} view`})]},O.id))}),d.jsxs("footer",{children:[d.jsx("span",{children:"Snapshot"}),d.jsx("code",{children:nce(t.graphIdentity)})]})]}),d.jsxs("main",{className:"visualization-main",children:[d.jsxs("header",{className:"visualization-context",children:[S.kind!=="code"&&d.jsxs("div",{className:"visualization-context-title",children:[d.jsx("span",{children:ice(S)}),d.jsx("strong",{children:S.title})]}),d.jsx("div",{className:"visualization-controls",ref:y}),d.jsxs("div",{className:"visualization-coverage","data-status":S.coverage.status,children:[S.kind!=="call"&&d.jsxs(d.Fragment,{children:[d.jsxs("span",{children:[S.coverage.nodes.toLocaleString()," nodes"]}),d.jsxs("span",{children:[S.coverage.edges.toLocaleString()," relationships"]})]}),d.jsx("strong",{children:oce(S)})]})]}),d.jsx(s1.Provider,{value:x,children:d.jsx("section",{className:"visualization-stage","aria-label":`${S.title} visualization`,children:d.jsx(XIe,{view:S,host:e,communityDetail:n,communityLoading:i,communityError:o,onBackToOverview:s,initialInspectorLayout:a,onInspectorLayoutChange:l,themePreference:C,onThemePreferenceChange:c},S.id)})})]})]}):null}function XIe({view:t,host:e,communityDetail:n,communityLoading:i,communityError:o,onBackToOverview:s,initialInspectorLayout:a,onInspectorLayoutChange:l,themePreference:C,onThemePreferenceChange:c}){if(t.kind==="call")return d.jsx(PIe,{graph:t.graph,host:{openSource:e.openSource,...e.expandCall?{expand:e.expandCall}:{},...e.changeCallDirection?{changeDirection:e.changeCallDirection}:{}}});if(t.kind==="architecture")return d.jsx(qIe,{model:t.model,host:e});if(t.kind==="impact")return d.jsx(Im,{model:BIe(t.result,t.title),host:e,queryResult:t.result,preferredLayout:"hierarchical"});if(t.kind==="history"){const h=UIe(t.before,t.after);return d.jsxs("div",{className:"workbench-history-view",children:[d.jsxs("div",{className:"workbench-history-banner",children:[d.jsx(C0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsxs("strong",{children:[t.baseRevision," → ",t.targetRevision]}),d.jsxs("small",{children:["+",h.addedNodes," / −",h.removedNodes," / Δ",h.changedNodes," nodes"]}),t.hierarchyDiff!==void 0?d.jsx("small",{"data-hierarchy-diff":"true",children:QIe(t.hierarchyDiff)}):null]})]}),d.jsx(Im,{model:h.graph,host:e,preferredLayout:"grid",sourceRevisions:{before:t.baseRevision,after:t.targetRevision}})]})}const u=t.kind==="affected"?"hierarchical":t.kind==="artifact"?t.lens==="routes"?"hierarchical":"grid":"automatic";return d.jsx(Im,{model:t.model,host:e,preferredLayout:u,communityDetails:t.kind==="code"?t.communityDetails:void 0,searchIndex:t.kind==="code"?t.searchIndex:void 0,hierarchy:t.kind==="code"?t.hierarchy:void 0,initialLevel:t.kind==="code"?t.hierarchy?.initialLevel:void 0,communityDetail:t.kind==="code"?n:void 0,communityLoading:t.kind==="code"?i:void 0,communityError:t.kind==="code"?o:void 0,onBackToOverview:t.kind==="code"?s:void 0,initialInspectorLayout:a,onInspectorLayoutChange:l,themePreference:C,onThemePreferenceChange:c})}function QIe(t){return t.split===0&&t.merged===0&&t.appeared===0&&t.disappeared===0&&t.ambiguous===0?`${t.stable} community groups unchanged`:`Community structure: ${[t.split>0?`${t.split} split`:void 0,t.merged>0?`${t.merged} merged`:void 0,t.appeared>0?`${t.appeared} new`:void 0,t.disappeared>0?`${t.disappeared} gone`:void 0,t.ambiguous>0?`${t.ambiguous} ambiguous`:void 0].filter(n=>n!==void 0).join(" · ")}${t.omittedEvents>0?` · ${t.omittedEvents} more omitted`:""}`}function Im({model:t,host:e,queryResult:n,sourceRevisions:i,preferredLayout:o,communityDetails:s,searchIndex:a,hierarchy:l,initialLevel:C,communityDetail:c,communityLoading:u,communityError:h,onBackToOverview:m,initialInspectorLayout:v,onInspectorLayoutChange:b,themePreference:x,onThemePreferenceChange:y}){const[S,T]=E.useState(""),[O,M]=E.useState(""),[k,G]=E.useState(""),[L,F]=E.useState(""),[re,pe]=E.useState(),[ie,J]=E.useState(!1),ve=E.useId(),me=E.useRef(null),ue=E.useRef(null),z=E.useRef(!1),U=re===void 0?void 0:s?.[String(re)],le=(re===void 0?void 0:{communityId:re,model:U??t,bounded:$N(t,re,U)})??c,X=le?.model??t,R=le?`community-${le.communityId}`:"overview",D=E.useMemo(()=>JIe(X),[X]),H=E.useMemo(()=>ece(X,{relation:S,evidence:O,kind:k,language:L}),[X,O,k,L,S]);E.useEffect(()=>{T(""),M(""),G(""),F(""),J(!1)},[R]),E.useEffect(()=>{ie||!z.current||(z.current=!1,me.current?.focus())},[ie]),E.useEffect(()=>{if(!ie)return;const ge=xe=>{xe.key==="Escape"&&(z.current=!0,J(!1))},ae=xe=>{const Me=xe.target;me.current?.contains(Me)||ue.current?.contains(Me)||J(!1)};return document.addEventListener("keydown",ge),document.addEventListener("pointerdown",ae),()=>{document.removeEventListener("keydown",ge),document.removeEventListener("pointerdown",ae)}},[ie]),E.useLayoutEffect(()=>{if(!ie)return;const ge=()=>{const Me=me.current,_=ue.current;if(!Me||!_)return;const ce=Me.getBoundingClientRect(),Se=12,_e=Math.min(310,window.innerWidth-Se*2),gt=Math.min(ce.bottom+8,window.innerHeight-Se);_.style.width=`${_e}px`,_.style.left=`${Math.max(Se,Math.min(ce.left,window.innerWidth-_e-Se))}px`,_.style.top=`${gt}px`,_.style.maxHeight=`${Math.max(0,window.innerHeight-gt-Se)}px`};ge();const ae=typeof ResizeObserver>"u"?void 0:new ResizeObserver(ge);me.current&&ae?.observe(me.current);const xe=me.current?.closest(".compass-graph-toolbar");return xe&&ae?.observe(xe),window.addEventListener("resize",ge),document.addEventListener("scroll",ge,!0),()=>{ae?.disconnect(),window.removeEventListener("resize",ge),document.removeEventListener("scroll",ge,!0)}},[ie,R]);const se=E.useCallback(()=>{T(""),M(""),G(""),F("")},[]),de=E.useCallback(()=>J(!1),[]),be=[S,O,k,L].filter(Boolean).length,Ne=be>0&&H.nodes.length===0;return d.jsx("div",{className:"workbench-graph-lens",children:d.jsx(Wp,{model:le?t:H,searchIndex:a,onClearSearchFilters:se,hierarchy:l,initialLevel:C,communityDetail:le?{...le,model:H}:void 0,communityLoading:u,communityError:h,onBackToOverview:re===void 0?m:()=>pe(void 0),initialInspectorLayout:v,onInspectorLayoutChange:b,themePreference:x,onThemePreferenceChange:y,host:{...e,openCommunity:ge=>{s?.[String(ge)]?pe(ge):e.openCommunity?.(ge)}},queryResult:n,sourceRevisions:i,showInspectorHeader:!1,preferredLayout:o,toolbarLeading:d.jsxs("button",{ref:me,className:"workbench-filter-trigger",type:"button","aria-label":"Graph filters","aria-expanded":ie,"aria-controls":ve,onClick:()=>J(ge=>!ge),children:[d.jsx(eB,{"aria-hidden":"true"}),d.jsx("span",{children:"Filters"}),be>0?d.jsx("b",{children:be}):null,d.jsxs("small",{children:[H.nodes.length.toLocaleString()," / ",X.nodes.length.toLocaleString()]})]}),toolbarLeadingPanel:ie?d.jsxs("div",{ref:ue,id:ve,className:"workbench-filter-popover",role:"region","aria-label":"Graph filter options",children:[d.jsxs("header",{children:[d.jsxs("span",{children:[d.jsx("strong",{children:"Filter graph"}),d.jsx("small",{children:"Refine visible nodes and relationships"})]}),d.jsx("button",{type:"button",disabled:be===0,onClick:se,children:"Clear filters"})]}),d.jsx(Xs,{label:"Relationship",value:S,values:D.relations,onChange:T}),d.jsx(Xs,{label:"Evidence",value:O,values:D.evidence,onChange:M}),d.jsx(Xs,{label:"Node kind",value:k,values:D.kinds,onChange:G}),d.jsx(Xs,{label:"Language",value:L,values:D.languages,onChange:F}),d.jsx("footer",{role:"status",children:Ne?"No nodes match these filters":`Showing ${H.nodes.length.toLocaleString()} of ${X.nodes.length.toLocaleString()} nodes`})]}):void 0,toolbarLeadingOpen:ie,onToolbarLeadingClose:de,stageOverlay:X.nodes.length===0?d.jsx(kM,{title:"This view has no graph nodes",detail:"The exported graph lens did not contain any nodes to visualize."}):Ne&&!ie?d.jsx(kM,{title:"No nodes match these filters",detail:"Clear one or more filters to restore the graph.",onClear:se}):void 0})})}function kM({title:t,detail:e,onClear:n}){return d.jsxs("div",{className:"workbench-graph-empty",role:"status",children:[d.jsx(kC,{"aria-hidden":"true"}),d.jsx("strong",{children:t}),d.jsx("span",{children:e}),n?d.jsx("button",{type:"button",onClick:n,children:"Clear filters"}):null]})}function Xs({label:t,value:e,values:n,onChange:i}){return d.jsxs("label",{children:[d.jsx("span",{children:t}),d.jsxs("select",{value:e,onChange:o=>i(o.target.value),children:[d.jsx("option",{value:"",children:"All"}),n.map(o=>d.jsx("option",{value:o,children:cm(o)},o))]})]})}function qIe({model:t,host:e}){const[n,i]=E.useState("production"),[o,s]=E.useState("all"),[a,l]=E.useState("architecture"),C=E.useMemo(()=>PCe(t,{scope:n,evidence:o,lens:a}),[o,a,t,n]),c=C.groups.find(T=>T.nodeCount>0),[u,h]=E.useState(c?{kind:"group",id:c.id}:void 0),m=t.projections.find(T=>T.scope===(n==="all"?"all_code":"production")),v=u?.kind==="group"?m?.groups.find(T=>T.id===u.id):void 0,b=new Set(m?.groups.filter(T=>T.parentId===v?.id).map(T=>T.id)??[]),x=new Set(m?.memberships.filter(T=>{const O=m.groups[T.groupIndex]?.id;return O===v?.id||O!==void 0&&b.has(O)}).map(T=>t.nodes[T.nodeIndex]?.id).filter(T=>T!==void 0)??[]),y=t.nodes.filter(T=>x.has(T.id)),S=u?.kind==="route"?C.routes.find(T=>T.id===u.id):void 0;return d.jsxs("div",{className:"workbench-architecture",children:[d.jsxs("div",{className:"workbench-filter-strip","aria-label":"Architecture filters",children:[d.jsx(Xs,{label:"Source scope",value:n,values:["production","all"],onChange:T=>i(T)}),d.jsx(Xs,{label:"Evidence",value:o,values:["all","extracted","inferred","ambiguous"],onChange:T=>s(T)}),d.jsx(Xs,{label:"Lens",value:a,values:["architecture","execution","dependency","type","structure","all"],onChange:T=>l(T)}),d.jsxs("label",{children:["Subsystem directory",d.jsxs("select",{"aria-label":"Subsystem directory",value:v?.id??"",onChange:T=>T.target.value&&h({kind:"group",id:T.target.value}),children:[d.jsx("option",{value:"",children:"Select a subsystem"}),m?.groups.map(T=>d.jsxs("option",{value:T.id,children:[T.name.value," · ",T.nodeCount.toLocaleString()," symbols"]},T.id))]})]}),d.jsxs("span",{role:"status",children:[C.statistics.visibleRelationships.toLocaleString()," visible relationships"]}),d.jsxs("span",{role:"status",children:["Architecture quality: ",C.quality.status]}),d.jsxs("span",{role:"status",children:[C.omissions.shownGroups.toLocaleString()," of ",C.omissions.totalGroups.toLocaleString()," groups shown",C.omissions.omittedGroups>0?` · ${C.omissions.omittedGroups.toLocaleString()} available in directory`:""]})]}),d.jsxs("div",{className:"workbench-architecture-body",children:[d.jsx(RCe,{overview:C,selection:u,onSelect:h}),d.jsx("aside",{"aria-label":"Architecture details",children:v?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Subsystem"}),d.jsx("h2",{children:v.name.value}),d.jsxs("p",{children:[y.length.toLocaleString()," symbols · ",v.relationshipCount.toLocaleString()," related relationships"]}),d.jsxs("small",{children:["Name source: ",v.name.provenance," · quality ",v.name.quality,"/100"]}),d.jsx("div",{className:"workbench-symbol-list",children:y.slice(0,100).map(T=>d.jsxs("button",{type:"button",disabled:!T.sourceFile,onClick:()=>T.sourceFile&&e.openSource({file:T.sourceFile}),children:[d.jsx("strong",{children:T.label}),d.jsxs("small",{children:[T.kind,T.sourceFile?` · ${T.sourceFile}`:""]})]},T.id))})]}):S?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Subsystem route"}),d.jsxs("h2",{children:[_M(C,S.sourceGroup)," → ",_M(C,S.targetGroup)]}),d.jsxs("p",{children:[S.relationships.toLocaleString()," relationships cross this boundary."]})]}):d.jsx("p",{children:"Select a subsystem or route."})})]})]})}function JIe(t){const e=n=>[...new Set(n.filter(i=>!!i))].sort();return{relations:e(t.edges.map(n=>n.relation)),evidence:e(t.edges.map(n=>n.confidence)),kinds:e(t.nodes.map(n=>n.kind)),languages:e(t.nodes.map(n=>n.language))}}function ece(t,e){const n=t.nodes.filter(l=>(!e.kind||l.kind===e.kind)&&(!e.language||l.language===e.language));let i=new Set(n.map(l=>l.id));const o=t.edges.filter(l=>i.has(l.source)&&i.has(l.target)&&(!e.relation||l.relation===e.relation)&&(!e.evidence||l.confidence===e.evidence));if(e.relation||e.evidence){const l=new Set(o.flatMap(C=>[C.source,C.target]));for(const C of n)C.root&&l.add(C.id);i=l}const s=n.filter(l=>i.has(l.id)),a=new Set(s.map(l=>l.community));return{...t,stats:{...t.stats,nodes:s.length,edges:o.length,communities:a.size},nodes:s,edges:o,communities:t.communities.filter(l=>a.has(l.id))}}function tce({view:t}){const e=t.kind==="code"?kC:t.kind==="call"?fu:t.kind==="impact"?S4:t.kind==="architecture"?g0:t.kind==="history"?C0:t.kind==="affected"?q4:t.lens==="routes"?f0:t.lens==="provenance"?uu:W4;return d.jsx(e,{"aria-hidden":"true"})}function DM(t){const e=new URLSearchParams(window.location.hash.slice(1)).get("view");return e&&t.views.some(n=>n.id===e)?e:void 0}function nce(t){const e=t.startsWith("sha256:")?t.slice(7):t;return e.length>12?e.slice(0,12):e}function ice(t){return t.kind==="artifact"?`${cm(t.lens)} lens`:`${cm(t.kind)} graph`}function oce(t){return t.kind==="architecture"?t.coverage.status==="complete"?"Extraction complete":t.coverage.status==="summary"?"Extraction summary":"Extraction bounded":t.coverage.status==="complete"?"Complete":t.coverage.status==="summary"?"Community summary":"Bounded result"}function cm(t){return t.replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase())}function _M(t,e){return t.groups.find(n=>n.id===e)?.name??e}const rce=ye({provider:Ue(["github","gitlab","bitbucket"]),repositoryUrl:j().url(),revision:j().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i)});function sce(t,e,n=t.revision){if(!ace(n))return;const i=Ace(e.file);if(!i)return;const o=t.repositoryUrl.replace(/\/$/,""),s=lce(t.provider,e);return t.provider==="gitlab"?`${o}/-/blob/${n}/${i}${s}`:t.provider==="bitbucket"?`${o}/src/${n}/${i}${s}`:`${o}/blob/${n}/${i}${s}`}function gce(t,e,n){if(window.dispatchEvent(new CustomEvent("compass:open-source",{detail:e})),!t)return{kind:"unavailable"};const i=sce(t,e,n??t.revision);if(!i)return{kind:"unavailable"};const o=document.createElement("a");return o.href=i,o.target="_blank",o.rel="noopener noreferrer",o.click(),{kind:"opened",url:i}}function ace(t){return/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i.test(t)}function Ace(t){if(!t||t.startsWith("/")||t.startsWith("\\")||t.includes("\0"))return;const e=t.replaceAll("\\","/").split("/");if(!e.some(n=>!n||n==="."||n===".."))return e.map(encodeURIComponent).join("/")}function lce(t,e){const n=e.startLine;if(n===void 0)return"";const i=Math.max(n,e.endLine??n);return t==="gitlab"?i===n?`#L${n}`:`#L${n}-${i}`:t==="bitbucket"?i===n?`#lines-${n}`:`#lines-${n}:${i}`:i===n?`#L${n}`:`#L${n}-L${i}`}function jM(){const t=document.getElementById("compass-viewer-root"),e=document.getElementById("compass-viewer-model");if(!t||!e)throw new Error("Compass viewer root or model is missing");const n=JSON.parse(e.textContent??""),i=Ice(),o=B_.createRoot(t);let s="auto";P0(s);let a=()=>{};const l=y=>{s=y,P0(y),a()},C=A4.safeParse(n);if(C.success){a=()=>o.render(d.jsx(KIe,{workbench:C.data,host:{openSource(y,S){zM(i,y,S)}},themePreference:s,onThemePreferenceChange:l})),a();return}const c=jo.parse(n),u=Cce(),h=new Map;let m,v=null,b;const x=()=>{o.render(d.jsx(Wp,{model:c,hierarchy:u,initialLevel:u?.initialLevel,themePreference:s,onThemePreferenceChange:l,communityDetail:m,communityLoading:v,communityError:b,onBackToOverview:m?()=>{m=void 0,b=void 0,x()}:void 0,host:{openSource(y,S){zM(i,y,S)},openCommunity(y){v===null&&(v=y,b=void 0,x(),window.setTimeout(()=>{try{let S=h.get(y);if(!S){const T=document.querySelector(`script[data-compass-community="${y}"]`);if(!T)throw new Error(`Community ${y} detail is unavailable in this export.`);S=jo.parse(JSON.parse(T.textContent??"")),h.set(y,S)}m={communityId:y,model:S,bounded:$N(c,y,S)},window.dispatchEvent(new CustomEvent("compass:open-community",{detail:{communityId:y}}))}catch(S){b=S instanceof Error?S.message:String(S)}finally{v=null,x()}},0))}}}))};a=x,x()}function Cce(){const t=document.getElementById("compass-viewer-hierarchy");if(!t?.textContent)return;const e=i0.safeParse(JSON.parse(t.textContent));return e.success?e.data:void 0}function Ice(){const t=document.getElementById("compass-source-navigation");if(!t?.textContent)return;const e=rce.safeParse(JSON.parse(t.textContent));return e.success?e.data:void 0}function zM(t,e,n){gce(t,e,n).kind==="unavailable"&&cce(e.file)}function cce(t){const e=document.getElementById("compass-source-notice"),n=e??document.createElement("div");n.id="compass-source-notice",n.className="compass-source-notice",n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.textContent=["Source link unavailable.",`The exported revision for ${t} is not published by the configured remote.`,"Open this graph in VS Code to navigate to the local source."].join(" "),e||document.body.append(n)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",jM,{once:!0}):jM()})(); +${n.toLocaleString()} symbols`:e}function oCe(t){return Math.round((t.size??12)+12)}function rCe(t){return{enabled:!0,color:t.color?.background??"#8D97A3",size:Math.round((t.size??12)*.6),x:0,y:0}}function sCe(t){const e=new Map;for(const s of[...t].sort((a,l)=>a.id.localeCompare(l.id))){const a=s.change??"unchanged",l=e.get(a)??[];l.push(s),e.set(a,l)}const n={added:-300,changed:0,removed:300,unchanged:0},i=new Map,o=Math.PI*(3-Math.sqrt(5));for(const[s,a]of e)a.forEach((l,C)=>{const c=C*o,u=s==="unchanged"?210+Math.sqrt(C)*34:42+Math.sqrt(C)*40;i.set(l.id,{x:n[s]+Math.cos(c)*u,y:Math.sin(c)*u})});return i}const gCe=E.forwardRef(function({model:e,focusedNodeId:n,hoveredNodeId:i,physicsRunning:o,layoutStyle:s="automatic",initialPositions:a,forceLabels:l,showEdgeLabels:C=!1,isolatedNodeIds:c,isolatedEdgeIds:u,layoutSpacing:h=Yp,showMinimap:m=!1,semanticDetail:v=!1,communityImportance:b,edgeSemanticHints:x,hiddenCommunities:y,hiddenChanges:S,onFocus:T,onOpenSource:O,onOpenRelationshipSource:M,onInteractionStart:k=()=>{},onHover:G,onHoverEdge:L,onClear:F,onStabilized:re},pe){const ie=E.useRef(null),J=E.useRef(null),[ve,me]=E.useState(null),ue=E.useRef(o);ue.current=o;const z=E.useRef(o),U=E.useRef({onFocus:T,onOpenSource:O,onOpenRelationshipSource:M,onInteractionStart:k,onHover:G,onHoverEdge:L,onClear:F});U.current={onFocus:T,onOpenSource:O,onOpenRelationshipSource:M,onInteractionStart:k,onHover:G,onHoverEdge:L,onClear:F};const Q=E.useRef(re);Q.current=re;const le=E.useRef(null),X=E.useRef(h),R=xu(),D=E.useMemo(()=>xN(e),[e.edges.length,e.nodes.length]),H=e.stats.aggregated,se=E.useMemo(()=>EN(e),[e]),de=E.useMemo(()=>new Set(e.nodes.filter(W=>!y.has(W.community)&&!S.has(W.change??"unchanged")&&(!c||c.has(W.id))).map(W=>W.id)),[S,y,c,e.nodes]),be=E.useMemo(()=>new Set(se.filter(W=>de.has(W.source)&&de.has(W.target)&&(!u||u.has(W.id))).map(W=>W.id)),[u,se,de]),Me=E.useRef(de);Me.current=de;const ge=E.useCallback(()=>{const W=J.current,Fe=ie.current;if(!W||!Fe)return;const Ee=W.getPositions([...Me.current].sort().slice(0,Ule)),Ht=W.getViewPosition(),pt=Math.max(ZN,W.getScale()),Ke=Math.max(1,Fe.clientWidth)/pt,Xt=Math.max(1,Fe.clientHeight)/pt;me({positions:new Map(Object.entries(Ee)),viewport:{left:Ht.x-Ke/2,top:Ht.y-Xt/2,width:Ke,height:Xt}})},[]),ae=E.useMemo(()=>{let W=1;for(const Fe of e.nodes)W=Math.max(W,Fe.degree??1);return W},[e.nodes]),xe=E.useMemo(()=>new Map(e.communities.map(W=>[W.id,W.color])),[e.communities]),Re=E.useMemo(()=>St("--vscode-editor-foreground",St("--foreground","#eef5ff")),[R]),j=E.useMemo(()=>St("--vscode-descriptionForeground",St("--muted-foreground","#60728b")),[R]),ce=E.useMemo(()=>St("--vscode-editor-foreground",St("--foreground","#d8e4f2")),[R]),Se=E.useMemo(()=>St("--vscode-editor-background",St("--background","#08111f")),[R]),_e=E.useMemo(()=>{const W=St("--vscode-editor-background",St("--background","#08111f")),Fe=G0(W);return{added:ua(W,St("--vscode-gitDecoration-addedResourceForeground",Fe?"#56d364":"#1a7f37"),Fe),removed:ua(W,St("--vscode-gitDecoration-deletedResourceForeground",Fe?"#ff7b72":"#cf222e"),Fe),changed:ua(W,St("--vscode-gitDecoration-modifiedResourceForeground",Fe?"#d7a72b":"#9a6700"),Fe),unchanged:ua(W,St("--vscode-descriptionForeground",Fe?"#8b949e":"#656d76"),Fe,!0)}},[R]),gt=E.useMemo(()=>{const W=St("--vscode-editor-background",St("--background","#08111f")),Fe=G0(W),Ee=(Ht,pt,Ke)=>ua(W,St(Ht,Fe?pt:Ke),Fe);return{callable:Ee("--vscode-symbolIcon-functionForeground","#5fa8ff","#0969da"),type:Ee("--vscode-symbolIcon-classForeground","#e3b341","#9a6700"),module:Ee("--vscode-symbolIcon-moduleForeground","#56d4b4","#168b76"),boundary:Ee("--vscode-symbolIcon-eventForeground","#ff9b87","#cf4c35"),other:ua(W,St("--vscode-descriptionForeground",Fe?"#8b949e":"#656d76"),Fe,!0)}},[R]),Et=E.useMemo(()=>({execution:St("--vscode-symbolIcon-functionForeground","#5fa8ff"),dependency:St("--vscode-symbolIcon-moduleForeground","#56d4b4"),structure:St("--vscode-symbolIcon-classForeground","#e3b341"),flow:St("--vscode-symbolIcon-eventForeground","#ff9b87"),other:j}),[j,R]),ot=E.useMemo(()=>e.nodes.some(W=>W.change!==void 0)||e.edges.some(W=>W.change!==void 0),[e.edges,e.nodes]),Ce=E.useMemo(()=>H?new Set(bu(e.nodes,b)):new Set(ot?e.nodes.filter(W=>W.change!=="unchanged").sort((W,Fe)=>(Fe.degree??0)-(W.degree??0)||W.id.localeCompare(Fe.id)).slice(0,12).map(W=>W.id):D==="static"?[...e.nodes].sort((W,Fe)=>(Fe.degree??0)-(W.degree??0)||W.id.localeCompare(Fe.id)).slice(0,20).map(W=>W.id):[]),[b,H,ot,e.nodes,D]),Tt=E.useCallback(W=>!H||Ce.has(W)||W===n||W===i,[Ce,H,n,i]),Ue=E.useMemo(()=>D==="static"?new Set([...e.nodes].sort((W,Fe)=>(Fe.degree??0)-(W.degree??0)||W.id.localeCompare(Fe.id)).slice(0,Vle).map(W=>W.id)):new Set,[e.nodes,D]),sn=E.useMemo(()=>ot?sCe(e.nodes):new Map,[ot,e.nodes]),Ai=s==="automatic"&&D!=="static"?Yp:h,Ot=E.useMemo(()=>s==="automatic"?new Map:vle(e.nodes,s,e.stats.aggregated),[s,e.nodes,e.stats.aggregated]),qn=E.useMemo(()=>H?NN(e.nodes,b):ot?new Map:mle(e.nodes,e.stats.aggregated),[b,H,ot,e.nodes,e.stats.aggregated,D]),Jo=E.useMemo(()=>typeof document>"u"?void 0:document.body.classList.contains("vscode-high-contrast")||document.body.classList.contains("vscode-high-contrast-light")?St("--vscode-contrastBorder","#ffffff"):void 0,[R]),gn=E.useMemo(()=>new Ca(e.nodes.map(W=>{const Fe=W.size??Math.min(40,10+30*(W.degree??1)/ae),Ee=ot?W.change==="unchanged"?7+5*Math.sqrt((W.degree??1)/ae):11+12*Math.sqrt((W.degree??1)/ae):Fe,Ht=Ot.get(W.id)??sn.get(W.id)??a?.get(W.id)??qn.get(W.id),pt=Ht?{x:Ht.x*Ai,y:Ht.y*Ai}:void 0,Ke=H&&!Ce.has(W.id)?.82:W.change==="unchanged"?.58:1;return{id:W.id,label:H?iCe(W):W.label,color:Tt(W.id)?GN(e,W,void 0,zN,xe,v?Fle:void 0):{background:LN,border:BN},shape:v?bB(yg(W.kind)):"dot",size:Ee,...pt??{},opacity:Ke,...H?{borderWidth:2}:{},...H&&Tt(W.id)?{shadow:rCe(W)}:{},font:{color:"#eef5ff",face:"system-ui",size:H?Ce.has(W.id)?N0:0:ot||D==="static"?Ce.has(W.id)?12:0:(W.degree??1)>=ae*.15?12:0,vadjust:H?Math.round(Ee+12):0,...H?{strokeWidth:3,strokeColor:Se}:{}}}})),[Ce,ot,sn,xe,H,a,Ai,ae,e,D,v,Ot,qn]),jn=E.useMemo(()=>new Ca(se.map(W=>{const Fe=x?.get(W.id),Ee=VN(W,FN(W.change,W.confidence,Fe?PN[Fe]:v?PN[bg(W.relation)]:"#60728b",zN,W.weight));return{id:W.id,from:W.source,to:W.target,dashes:Ee.dashes,width:Ee.width,...ot&&D!=="static"?{smooth:nCe(W.change)}:{},color:{color:Ee.color,opacity:Ee.opacity}}})),[ot,x,se,D,v]);return E.useEffect(()=>{const W=ie.current;if(!W)return;le.current=null,X.current=Ai;const Fe=H?qle:D==="static"?eCe:ot?Jle:Qle,Ee=new je(W,{nodes:gn,edges:jn},Xle(Fe,ue.current));ue.current||Ee.stopSimulation(),J.current=Ee,hle(Ee,{onFocus:Ke=>U.current.onFocus(Ke),onOpenSource:Ke=>U.current.onOpenSource(Ke),onOpenRelationshipSource:Ke=>U.current.onOpenRelationshipSource(Ke),onInteractionStart:()=>{Ee.stopSimulation(),U.current.onInteractionStart()},onHover:Ke=>U.current.onHover(Ke),onHoverEdge:Ke=>U.current.onHoverEdge(Ke),onClear:()=>U.current.onClear()}),Ee.on("stabilizationIterationsDone",()=>{if(Ee.stopSimulation(),H){const Ke=new Map(Object.entries(Ee.getPositions())),Xt=DN(e.nodes,Dle(e.nodes,Ke,b),b);gn.update([...Xt].map(([zn,oo])=>({id:zn,x:oo.x,y:oo.y}))),Ee.redraw()}ue.current&&Ee.fit({animation:!1}),le.current={position:Ee.getViewPosition(),scale:Ee.getScale()},Q.current(),ge()}),Ee.on("stabilized",ge),Ee.on("dragEnd",ge),Ee.on("zoom",ge),Ee.on("resize",ge),Ee.on("animationFinished",ge);const Ht=sn.size>0||Ot.size>0||(a?.size??0)>0||qn.size>0;if(!ue.current&&Ht){Ee.stopSimulation();const Ke=()=>{const Xt=ie.current;return!Xt||Xt.clientWidth<=1||Xt.clientHeight<=1?!1:(Ee.fit({animation:!1}),le.current={position:Ee.getViewPosition(),scale:Ee.getScale()},!0)};if(!Ke()){const Xt=()=>{Ke()&&Ee.off("resize",Xt)};Ee.on("resize",Xt)}}const pt=window.setTimeout(ge,0);return()=>{window.clearTimeout(pt),Ee.destroy(),J.current=null}},[jn,gn,ot,sn,a,D,Ot,qn,ge]),E.useEffect(()=>{const W=J.current;if(!W)return;const Fe=z.current;z.current=o,W.setOptions({physics:{enabled:o}}),o?(Fe||Kle(W,Me.current),W.startSimulation()):W.stopSimulation()},[jn,gn,o]),E.useEffect(()=>{const W=J.current;if(!W||s!=="automatic"||D==="static")return;const Fe=X.current;if(X.current=h,W.setOptions({physics:ot?{enabled:o,barnesHut:{springLength:180*h}}:{enabled:o,forceAtlas2Based:{springLength:(H?96:120)*h}}}),!o&&Fe!==h){const Ee=h/Fe,Ht=W.getPositions();gn.update(Object.entries(Ht).map(([pt,Ke])=>({id:pt,x:Ke.x*Ee,y:Ke.y*Ee}))),W.redraw(),ge()}},[H,ot,h,s,gn,o,ge,D]),E.useEffect(()=>{gn.update(e.nodes.map(W=>({id:W.id,hidden:!de.has(W.id)}))),jn.update(se.map(W=>({id:W.id,hidden:!be.has(W.id)}))),ge()},[jn,ge,se,e.nodes,gn,be,de]),E.useEffect(()=>{const W=J.current;if(!W)return;const Fe=n?new Set(W.getConnectedNodes(n).map(String)):new Set;if(gn.update(e.nodes.map(Ee=>{const Ht=Ee.id===n,pt=!n||Ht||Fe.has(Ee.id),Ke=H&&!Ce.has(Ee.id)?.82:Ee.change==="unchanged"?.58:1;return{id:Ee.id,opacity:n?pt?Math.max(Ke,.72):.32:Ke,borderWidth:Ht?4:Jo?2.5:H?2:1.5,color:Tt(Ee.id)||pt&&n!==null?GN(e,Ee,Jo,_e,xe,v?gt:void 0):{background:LN,border:BN},shadow:Ht?{enabled:!0,color:Ee.change?_e[Ee.change].border:v?gt[yg(Ee.kind)].border:Ee.color?.background??xe.get(Ee.community)??"#76b7ff",size:24,x:0,y:0}:{enabled:!1}}})),jn.update(se.map(Ee=>{const Ht=x?.get(Ee.id),pt=VN(Ee,FN(Ee.change,Ee.confidence,Ht?Et[Ht]:v?Et[bg(Ee.relation)]:j,_e,Ee.weight)),Ke=Ee.source===n||Ee.target===n;return{id:Ee.id,dashes:pt.dashes,color:{color:pt.color,opacity:n?Ke?.92:.12:pt.opacity},width:Ke?Math.max(3,pt.width):pt.width}})),n)if(W.selectNodes([n]),ue.current)W.focus(n,{scale:1.35,animation:window.matchMedia("(prefers-reduced-motion: reduce)").matches?!1:{duration:260,easingFunction:"easeInOutQuad"}});else{const Ee=W.getPositions([n])[n];Ee&&W.moveTo({position:Ee,scale:1.35,animation:!1})}else W.unselectAll()},[Ce,H,Jo,_e,xe,j,jn,x,n,e,gn,se,v,Et,gt]),E.useEffect(()=>{gn.update(e.nodes.map(W=>({id:W.id,font:{color:Re,size:H?l||W.id===n||Ce.has(W.id)?N0:0:l&&(D!=="static"||Ue.has(W.id))||W.id===n||(ot||D==="static"?Ce.has(W.id):(W.degree??1)>=ae*.15)?12:0,...H?{vadjust:oCe(W),strokeWidth:3,strokeColor:Se}:{}}})))},[Ce,Se,ot,H,Ue,n,l,Re,ae,e.nodes,gn,D]),E.useEffect(()=>{jn.update(se.map(W=>({id:W.id,label:C?W.relation:"",font:{align:"middle",color:ce,face:"system-ui",size:10,strokeWidth:3,strokeColor:St("--vscode-editor-background",St("--background","#08111f"))}})))},[jn,ce,se,C]),E.useImperativeHandle(pe,()=>({fit(){J.current?.fit({animation:da(280)})},fitSelection(W){const Fe=J.current;!Fe||W.length===0||Fe.fit({nodes:[...new Set(W)],animation:da(240)})},reset(){const W=J.current,Fe=le.current;if(W){if(!Fe){W.fit({animation:!1});return}W.moveTo({position:Fe.position,scale:Fe.scale,animation:!1})}},resetZoom(){J.current?.moveTo({scale:1,animation:da(180)})},zoomIn(){const W=J.current;W&&W.moveTo({scale:Math.min(Hle,W.getScale()*1.25),animation:da(160)})},zoomOut(){const W=J.current;W&&W.moveTo({scale:Math.max(ZN,W.getScale()/1.25),animation:da(160)})}}),[]),d.jsxs(d.Fragment,{children:[d.jsx("div",{ref:ie,className:"compass-canvas","data-rendering-profile":D,"data-layout-style":s,"data-physics-running":o?"true":"false","data-isolated":c?"true":"false","data-layout-spacing":h,role:"region","aria-label":"Interactive Compass code graph",onMouseLeave:()=>{G(null),L(null)}}),m&&ve?d.jsx(Gle,{model:e,snapshot:ve,visibleNodeIds:de,visibleEdgeIds:be,focusedNodeId:n,semanticDetail:v,onNavigate:W=>J.current?.moveTo({position:W,animation:da(180)})}):null]})}),UN=1,HN=4;function aCe(t){return Math.max(UN,Math.min(HN,Math.trunc(t)))}function ACe(t,e,n,i){const o=aCe(n),s=new Map,a=new Map;for(const u of t.edges){const h=s.get(u.source)??[];h.push(u),s.set(u.source,h);const m=a.get(u.target)??[];m.push(u),a.set(u.target,m)}for(const u of[...s.values(),...a.values()])u.sort((h,m)=>h.id.localeCompare(m.id));const l=new Set([e]),C=new Set;let c=[e];for(let u=0;u0;u+=1){const h=new Set;for(const m of c.sort()){if(i!=="incoming")for(const v of s.get(m)??[])C.add(v.id),l.has(v.target)||h.add(v.target);if(i!=="outgoing")for(const v of a.get(m)??[])C.add(v.id),l.has(v.source)||h.add(v.source)}c=[...h];for(const m of c)l.add(m)}return{nodeIds:l,edgeIds:C}}const YN=[{value:"bubbles",label:"Bubbles",hint:"Packed community map on the canvas",Icon:v4},{value:"matrix",label:"Matrix",hint:"Who couples to whom, cell by cell",Icon:D4},{value:"treemap",label:"Area",hint:"Every community sized by symbol count",Icon:j4},{value:"lanes",label:"Tiers",hint:"Importance tiers with coupling ribbons",Icon:$4}],lCe=[{value:"added",label:"Added"},{value:"removed",label:"Removed"},{value:"changed",label:"Changed"},{value:"unchanged",label:"Context"}],CCe={hierarchical:"Depth-layer layout",circle:"Circle layout",concentric:"Concentric layout",spiral:"Spiral layout",grid:"Square grid layout"},$p=["both","outgoing","incoming"];function ICe(t){return t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT"||t.closest('[role="combobox"], [role="listbox"]')!==null)}function Wp({model:t,host:e,hierarchy:n,initialLevel:i,communityDetail:o,communityLoading:s,communityError:a,searchIndex:l,onClearSearchFilters:C,onBackToOverview:c,sourceRevisions:u,queryResult:h,initialInspectorLayout:m,onInspectorLayoutChange:v,preferredLayout:b="automatic",toolbarLeading:x,toolbarLeadingPanel:y,toolbarLeadingOpen:S,onToolbarLeadingClose:T,stageOverlay:O,showInspectorHeader:M=!0,themePreference:k,onThemePreferenceChange:G}){const[L,F]=E.useState(()=>l1(m)),re=E.useCallback(Ue=>{const sn=l1(Ue);F(sn),v?.(sn)},[v]),pe=E.useMemo(()=>aB(n),[n]),ie=E.useMemo(()=>AB(t,pe),[pe,t]),J=E.useMemo(()=>OB(ie)?jB(ie):void 0,[ie]),ve=E.useMemo(()=>n?sB(n):void 0,[n]),[me,ue]=E.useState(()=>n===void 0?"communities":ve!==void 0?"hierarchy":"symbols"),[z,U]=E.useState(()=>i!==void 0&&n?.levels.some(Ue=>Ue.level===i)?i:ve??0),[Q,le]=E.useState([]),X=E.useMemo(()=>{if(!n||me!=="hierarchy")return;const Ue=Q[Q.length-1];return Ue===void 0?y0(n,{kind:"level",level:z}):b0(n,Ue.level,Ue.groupIndex)??y0(n,{kind:"level",level:z})},[z,n,me,Q]),R=X!==void 0&&o===void 0&&me==="hierarchy",[D,H]=E.useState("bubbles"),[se,de]=E.useState(null),[be,Me]=E.useState(null),ge=E.useMemo(()=>J&&se!==null?zB(ie,se):void 0,[se,J,ie]),xe=!o&&J!==void 0&&me==="communities"&&ge===void 0,Re=E.useMemo(()=>xe?wu(ie,J):R&&X?wu(X):!ge&&ie.stats.aggregated?wu(ie):void 0,[ge,J,X,R,ie,xe]),j=Re?D:"bubbles",ce=o?.model??ge?.model??X??(xe?J.model:ie),Se=o?`community-${o.communityId}`:ge?`community-${se}`:R?`level-${z}-${Q.length}`:xe?"communities":"overview",_e=o?.communityId??(ge?se??void 0:void 0),gt=o?.bounded??(ge?.bounded?{...ge.bounded,scope:"viewer"}:void 0),Et=E.useCallback(()=>{de(null),le(Ue=>Ue.slice(0,-1)),c?.()},[c]),ot=E.useCallback(Ue=>{const Ai=n?.levels.find(qn=>qn.level===z)?.groups.find(qn=>qn.index===Ue);if(Ai&&Ai.childIndices.length>0){le(qn=>[...qn,{level:z,groupIndex:Ue,label:Ai.label}]),U(z+1);return}const Ot=Ai?.community??Ue;if(J===void 0){e.openCommunity?.(Ot);return}de(Ot)},[z,J,n,e]),Ce=E.useMemo(()=>n&&me==="hierarchy"&&o===void 0?{...e,openCommunity:ot}:J&&o===void 0?{...e,openCommunity:Ue=>de(Ue)}:e,[o,J,n,e,ot,me]),Tt=E.useCallback(Ue=>Ue.previewAvailable?(C?.(),Me(Ue.id),ie.stats.aggregated?J!==void 0&&o===void 0?(ue("communities"),de(Ue.community),!0):e.openCommunity?(e.openCommunity(Ue.community),!0):(Me(null),!1):(o!==void 0&&c?.(),de(null),le([]),ue("symbols"),!0)):!1,[o,J,e,ie.stats.aggregated,c,C]);return d.jsx(cCe,{model:ce,hierarchy:n,communityKeyed:!R,host:Ce,detailCommunityId:_e,communityLoading:s,communityError:a,onBackToOverview:_e!==void 0||Q.length>0?Et:void 0,bounded:gt,initialFocusedNodeId:be??void 0,overviewSummary:xe?{communities:J.model.stats.communities,symbols:ie.nodes.length}:R?{communities:ce.nodes.length,symbols:ie.nodes.length}:void 0,communityImportance:xe?J.importance:void 0,communityOrder:xe?J.communityOrder:void 0,edgeSemanticHints:xe?J.edgeCategories:void 0,breadcrumbTrail:n!==void 0&&me==="hierarchy"?[{label:"Repository",onSelect:()=>{le([]),U(0)}},...Q.map((Ue,sn)=>({label:Ue.label,onSelect:()=>{le(Q.slice(0,sn)),U(Ue.level+1)}}))]:void 0,variant:j,variantData:Re,onVariantChange:H,searchModel:xe?ie:void 0,searchIndex:l,onOpenGlobalSearchResult:Tt,onSearchFocusApplied:()=>Me(null),scopeControls:n&&o===void 0?d.jsxs("div",{className:"compass-scope-toggle compass-level-toggle",role:"group","aria-label":"Graph scope",children:[n.levels.map(Ue=>d.jsx("button",{type:"button","aria-label":`Level ${Ue.level}`,"aria-pressed":me==="hierarchy"&&z===Ue.level&&Q.length===0,title:`${Ue.merge==="locationAffinity"?"Grouped by shared location":"Grouped by relationship evidence"} · ${Ue.groupCount.toLocaleString()} groups`,onClick:()=>{ue("hierarchy"),le([]),U(Ue.level),de(null)},children:d.jsx("span",{children:`Level ${Ue.level}`})},Ue.level)),d.jsxs("button",{type:"button","aria-label":"Symbols","aria-pressed":me==="symbols",title:`Show all ${ie.nodes.length.toLocaleString()} symbols`,onClick:()=>{ue("symbols"),de(null)},children:[d.jsx(uu,{"aria-hidden":"true"}),d.jsx("span",{children:"Symbols"})]})]}):J&&o===void 0?d.jsxs("div",{className:"compass-scope-toggle",role:"group","aria-label":"Graph scope",children:[d.jsxs("button",{type:"button","aria-label":"Communities","aria-pressed":me==="communities",title:"Show one labelled bubble per community",onClick:()=>{ue("communities"),de(null)},children:[d.jsx(g0,{"aria-hidden":"true"}),d.jsx("span",{children:"Communities"})]}),d.jsxs("button",{type:"button","aria-label":"Symbols","aria-pressed":me==="symbols",title:`Show all ${ie.nodes.length.toLocaleString()} symbols`,onClick:()=>{ue("symbols"),de(null)},children:[d.jsx(uu,{"aria-hidden":"true"}),d.jsx("span",{children:"Symbols"})]})]}):void 0,onOpenCommunityFromSearch:J&&xe?(Ue,sn)=>{Me(sn),de(Ue)}:void 0,autoLayoutDetail:ge!==void 0,sourceRevisions:u,queryResult:h,inspectorLayout:L,onInspectorLayoutChange:re,preferredLayout:b,toolbarLeading:x,toolbarLeadingPanel:y,toolbarLeadingOpen:S,onToolbarLeadingClose:T,stageOverlay:O,showInspectorHeader:M,themePreference:k,onThemePreferenceChange:G},Se)}function cCe({model:t,hierarchy:e,communityKeyed:n,host:i,detailCommunityId:o,communityLoading:s,communityError:a,onBackToOverview:l,bounded:C,initialFocusedNodeId:c,overviewSummary:u,communityImportance:h,communityOrder:m,edgeSemanticHints:v,breadcrumbTrail:b,variant:x,variantData:y,onVariantChange:S,searchModel:T,searchIndex:O,onOpenGlobalSearchResult:M,onSearchFocusApplied:k,scopeControls:G,onOpenCommunityFromSearch:L,autoLayoutDetail:F,themePreference:re,onThemePreferenceChange:pe,sourceRevisions:ie,queryResult:J,inspectorLayout:ve,onInspectorLayoutChange:me,preferredLayout:ue,toolbarLeading:z,toolbarLeadingPanel:U,toolbarLeadingOpen:Q,onToolbarLeadingClose:le,stageOverlay:X,showInspectorHeader:R}){const[D,H]=E.useReducer(Ple,t,Ie=>{const Ze=zle(Ie,ue),Be=ue==="automatic"&&Up(Ie);return{...Ze,...Be?{physicsRunning:!0,initialLayoutPending:!0}:{},...c?{focusedNodeId:c}:{}}}),[se,de]=E.useState(),[be,Me]=E.useState(null),[ge,ae]=E.useState(null),xe=E.useRef(null),Re=yF(),j=E.useRef(i);j.current=i;const ce=E.useMemo(()=>new Map(t.nodes.map(Ie=>[Ie.id,Ie])),[t.nodes]),Se=E.useMemo(()=>new Map(t.edges.map(Ie=>[Ie.id,Ie])),[t.edges]),_e=E.useMemo(()=>{const Ie=new Map,Ze=new Map;for(const Be of t.edges){const Jn=Ie.get(Be.source)??new Set;Jn.add(Be.target),Ie.set(Be.source,Jn);const Kr=Ie.get(Be.target)??new Set;Kr.add(Be.source),Ie.set(Be.target,Kr);const ma=Ze.get(Be.source)??[];ma.push(Be),Ze.set(Be.source,ma);const El=Ze.get(Be.target)??[];El.push(Be),Ze.set(Be.target,El)}return{neighborIds:Ie,edges:Ze}},[t.edges]),gt=E.useMemo(()=>{const Ie=O?.nodes??T?.nodes;if(!Ie)return t.nodes;const Ze=new Set(Ie.map(Be=>Be.id));return[...t.nodes.filter(Be=>!Ze.has(Be.id)),...Ie]},[t.nodes,O?.nodes,T?.nodes]),Et=E.useMemo(()=>gt.map(Ie=>({node:Ie,text:[Ie.label,Ie.source?.file,Ie.kind].filter(Ze=>Ze!==void 0).join(` +`).toLocaleLowerCase()})),[gt]),ot=E.useMemo(()=>EN(t).length,[t]),Ce=se??(D.focusedNodeId?ce.get(D.focusedNodeId):void 0),Tt=E.useMemo(()=>Ce&&!se?IB(e,t,Ce,{communityKeyed:n}):void 0,[n,se,e,t,Ce]),Ue=E.useMemo(()=>Ce&&!se?ACe(t,Ce.id,D.neighborhoodDepth,D.edgeDirection):null,[t,Ce,se,D.edgeDirection,D.neighborhoodDepth]),sn=be?ce.get(be.nodeId):void 0,Ai=sn?C1(t,sn,o):void 0,Ot=ge?Se.get(ge.edgeId):void 0,qn=Ot?ce.get(Ot.source):void 0,Jo=Ot?ce.get(Ot.target):void 0,gn=E.useMemo(()=>t.nodes.some(Ie=>Ie.change!==void 0)||t.edges.some(Ie=>Ie.change!==void 0),[t.edges,t.nodes]),jn=E.useMemo(()=>{const Ie=new Map;for(const Ze of t.nodes){const Be=Ze.change??"unchanged";Ie.set(Be,(Ie.get(Be)??0)+1)}return Ie},[t.nodes]),W=E.useMemo(()=>Ce?[..._e.neighborIds.get(Ce.id)??[]].map(Ie=>ce.get(Ie)).filter(Ie=>Ie!==void 0).sort((Ie,Ze)=>Ie.label.localeCompare(Ze.label)):[],[_e.neighborIds,ce,Ce]),Fe=E.useMemo(()=>Ce?_e.edges.get(Ce.id)??[]:[],[_e.edges,Ce]),Ee=E.useDeferredValue(D.query),Ht=E.useMemo(()=>{const Ie=Ee.trim().toLocaleLowerCase();if(!Ie)return[];const Ze=[];for(const Be of Et)if(Be.text.includes(Ie)&&Ze.push(Be.node),Ze.length===20)break;return Ze},[Ee,Et]),pt=E.useCallback(Ie=>{de(void 0),Me(null),ae(null),H({type:"focus",nodeId:Ie})},[]);E.useEffect(()=>{!c||!ce.has(c)||(pt(c),k?.())},[pt,c,ce,k]);const Ke=E.useCallback(Ie=>{j.current.openCommunity?.(Ie)},[]),Xt=E.useCallback(Ie=>{if(ce.has(Ie)){pt(Ie);return}const Ze=O?.nodes.find(Jn=>Jn.id===Ie);if(Ze){if(M?.(Ze))return;H({type:"clearFocus"}),de(Ze);return}const Be=T?.nodes.find(Jn=>Jn.id===Ie);Be&&L&&L(Be.community,Be.id)},[pt,ce,L,M,O,T]),zn=E.useCallback(()=>{D.physicsRunning&&H({type:"setPhysics",running:!1})},[D.physicsRunning]),oo=E.useCallback(()=>{de(void 0),Me(null),ae(null),H({type:"clearFocus"})},[]);E.useEffect(()=>{D.focusedNodeId&&!ce.has(D.focusedNodeId)&&oo()},[oo,ce,D.focusedNodeId]),E.useEffect(()=>{const Ie=Ze=>{if(Ze.metaKey||Ze.ctrlKey||Ze.altKey||Q||Ze.key==="Escape"&&document.querySelector(".compass-explore-panel")||ICe(Ze.target))return;const Be=Ze.key.toLocaleLowerCase();let Jn=!0;if(Be==="f")Ze.shiftKey&&Ue?xe.current?.fitSelection([...Ue.nodeIds]):Ze.shiftKey?Jn=!1:xe.current?.fit();else if(Be==="+"||Be==="=")xe.current?.zoomIn();else if(Be==="-"||Be==="_")xe.current?.zoomOut();else if(Be==="0")xe.current?.resetZoom();else if(Be==="i"&&Ce)H({type:"setIsolation",isolated:!D.isolateSelection});else if(Be==="[")H({type:"setNeighborhoodDepth",depth:Math.max(UN,D.neighborhoodDepth-1)});else if(Be==="]")H({type:"setNeighborhoodDepth",depth:Math.min(HN,D.neighborhoodDepth+1)});else if(Be==="d"){const Kr=$p.indexOf(D.edgeDirection);H({type:"setEdgeDirection",direction:$p[(Kr+1)%$p.length]??"both"})}else Be==="m"?H({type:"setMinimap",visible:!D.showMinimap}):Be==="l"?Ze.shiftKey?H({type:"setEdgeLabels",visible:!D.showEdgeLabels}):H({type:"setLabels",visible:!D.forceLabels}):Be==="escape"&&l?l():Be==="escape"&&Ce?oo():Jn=!1;Jn&&Ze.preventDefault()};return document.addEventListener("keydown",Ie,{capture:!0}),()=>document.removeEventListener("keydown",Ie,{capture:!0})},[oo,l,Ce,Ue,D.edgeDirection,D.forceLabels,Q,D.isolateSelection,D.neighborhoodDepth,D.showEdgeLabels,D.showMinimap]);const dm=E.useCallback(()=>{H({type:"stabilized"})},[]),um=E.useCallback(()=>{H({type:"revealLayout"})},[]),fa=E.useCallback(Ie=>{const Ze=ce.get(Ie);if(!Ze)return;const Be=C1(t,Ze,o);Be.type==="community"&&j.current.openCommunity?.(Be.communityId),Be.type==="source"&&j.current.openSource(Be.source,Ze.change==="removed"?ie?.before:ie?.after)},[o,ce,t.stats.aggregated,ie?.after,ie?.before]),pa=E.useCallback(Ie=>{const Ze=Se.get(Ie);if(!Ze)return;const Be=cw(Ze);Be&&j.current.openSource(Be,Ze.change==="removed"?ie?.before:ie?.after)},[Se,ie?.after,ie?.before]),Yr=o!==void 0?t.communities.find(Ie=>Ie.id===o)?.label??`Community ${o}`:void 0,To=YN.find(Ie=>Ie.value===x)?.label,$r=u??(y?{communities:y.communities.length,symbols:y.symbols}:void 0),Wr=$r?`${x==="bubbles"||!To?"":`${To} · `}${$r.communities.toLocaleString()} communities · ${$r.symbols.toLocaleString()} symbols${D.layoutStyle==="automatic"&&!Up(t)?" · press Layout to arrange":""}`:void 0,hm=se?`Found ${se.label} · outside preview`:Ce&&D.isolateSelection&&Ue?`Isolated ${Ue.nodeIds.size} nodes · ${D.neighborhoodDepth} hop${D.neighborhoodDepth===1?"":"s"}`:Ce?`Inspecting ${Ce.label}`:Yr?`Community ${Yr} · ${t.stats.nodes.toLocaleString()} symbols`:Wr||(D.layoutStyle!=="automatic"?CCe[D.layoutStyle]:D.physicsRunning?"Layout running":Up(t)?"Automatic layout":`Static layout · ${t.nodes.length.toLocaleString()} nodes stay seeded`),xl=x==="bubbles",Sl=s!=null?t.communities.find(Ie=>Ie.id===s):void 0,ro=s!=null?{kind:"community",communityLabel:Sl?.label??`Community ${s}`}:D.initialLayoutPending&&xl?{kind:"layout"}:null;return d.jsxs("div",{className:"compass-workspace",style:{"--compass-inspector-width":`${ve.width}px`},children:[d.jsxs("div",{className:"compass-workspace-content","data-inspector-collapsed":ve.collapsed,inert:ro?!0:void 0,"aria-hidden":ro?!0:void 0,children:[d.jsxs("main",{className:"compass-graph-stage","data-comparison":gn?"true":"false","data-controls":Re?"header":void 0,"data-breadcrumb":u!==void 0||F||b!==void 0&&b.length>0?"true":void 0,children:[y&&x!=="bubbles"?d.jsx("div",{className:"compass-variant-stage",children:x==="matrix"?d.jsx(YB,{data:y,onOpenCommunity:Ke}):x==="treemap"?d.jsx($B,{data:y,onOpenCommunity:Ke}):d.jsx(QB,{data:y,onOpenCommunity:Ke})}):d.jsx(gCe,{ref:xe,model:t,focusedNodeId:se?null:Ce?.id??null,hoveredNodeId:be?.nodeId??null,physicsRunning:D.physicsRunning,layoutStyle:D.layoutStyle,forceLabels:D.forceLabels,showEdgeLabels:D.showEdgeLabels,isolatedNodeIds:D.isolateSelection?Ue?.nodeIds:void 0,isolatedEdgeIds:D.isolateSelection?Ue?.edgeIds:void 0,layoutSpacing:D.layoutSpacing,showMinimap:D.showMinimap,semanticDetail:o!==void 0&&!gn,communityImportance:h,edgeSemanticHints:v,hiddenCommunities:D.hiddenCommunities,hiddenChanges:D.hiddenChanges,onFocus:pt,onOpenSource:fa,onOpenRelationshipSource:pa,onInteractionStart:zn,onHover:Me,onHoverEdge:ae,onClear:oo,onStabilized:dm}),X,b!==void 0&&b.length>0?d.jsx("nav",{className:"compass-graph-breadcrumb compass-glass-panel","aria-label":"Graph path",children:b.map((Ie,Ze)=>d.jsxs("span",{className:"compass-breadcrumb-step",children:[Ze>0?d.jsx("span",{className:"compass-breadcrumb-separator","aria-hidden":"true",children:"▸"}):null,Ze+1===b.length?d.jsx("span",{"aria-current":"page",children:Ie.label}):d.jsx("button",{type:"button",onClick:Ie.onSelect,children:Ie.label})]},`${Ze}-${Ie.label}`))}):u!==void 0||F?d.jsx("nav",{className:"compass-graph-breadcrumb compass-glass-panel","aria-label":"Graph path",children:o===void 0?d.jsx("span",{"aria-current":"page",children:"Repository"}):d.jsxs(d.Fragment,{children:[d.jsx("button",{type:"button",onClick:l,children:"Repository"}),d.jsx("span",{className:"compass-breadcrumb-separator","aria-hidden":"true",children:"▸"}),d.jsx("span",{"aria-current":"page",children:Yr??`Community ${o}`})]})}):null,d.jsx(dCe,{slot:Re,children:d.jsx(vF,{status:hm,physicsRunning:D.physicsRunning&&xl,layoutStyle:D.layoutStyle,forceLabels:D.forceLabels,showEdgeLabels:D.showEdgeLabels,hasSelection:Ce!==void 0&&se===void 0,isolateSelection:D.isolateSelection,neighborhoodDepth:D.neighborhoodDepth,edgeDirection:D.edgeDirection,layoutSpacing:D.layoutSpacing,showMinimap:D.showMinimap,themeControls:pe?d.jsx("div",{className:"compass-scope-toggle compass-theme-toggle",role:"group","aria-label":"Colour theme",children:UB.map(Ie=>d.jsxs("button",{type:"button","aria-label":Ie.label,"aria-pressed":(re??"auto")===Ie.value,title:Ie.hint,onClick:()=>pe(Ie.value),children:[Ie.value==="auto"?d.jsx(B4,{"aria-hidden":"true"}):Ie.value==="light"?d.jsx(tB,{"aria-hidden":"true"}):d.jsx(Z4,{"aria-hidden":"true"}),d.jsx("span",{children:Ie.label})]},Ie.value))}):void 0,scopeControls:G,canvasControls:x==="bubbles",variantControls:y?d.jsx("div",{className:"compass-scope-toggle compass-variant-toggle",role:"group","aria-label":"Overview design",children:YN.map(({value:Ie,label:Ze,hint:Be,Icon:Jn})=>d.jsx("button",{type:"button","aria-label":Ze,"aria-pressed":x===Ie,title:`${Ze} — ${Be}`,onClick:()=>S(Ie),children:d.jsx(Jn,{"aria-hidden":"true"})},Ie))}):void 0,leadingControls:z,leadingPanel:U,leadingPanelOpen:Q,onLeadingPanelClose:le,onTogglePhysics:()=>H({type:"setPhysics",running:!D.physicsRunning}),onLayoutChange:Ie=>H({type:"setLayout",layout:Ie,runPhysics:!1}),onZoomOut:()=>xe.current?.zoomOut(),onResetZoom:()=>xe.current?.resetZoom(),onZoomIn:()=>xe.current?.zoomIn(),onFit:()=>xe.current?.fit(),onFitSelection:()=>{Ue&&xe.current?.fitSelection([...Ue.nodeIds])},onReset:()=>{oo(),H({type:"setIsolation",isolated:!1}),xe.current?.reset()},onToggleLabels:()=>H({type:"setLabels",visible:!D.forceLabels}),onToggleEdgeLabels:()=>H({type:"setEdgeLabels",visible:!D.showEdgeLabels}),onToggleIsolation:()=>{const Ie=!D.isolateSelection;H({type:"setIsolation",isolated:Ie}),Ie&&Ue&&window.requestAnimationFrame(()=>{xe.current?.fitSelection([...Ue.nodeIds])})},onNeighborhoodDepthChange:Ie=>H({type:"setNeighborhoodDepth",depth:Ie}),onEdgeDirectionChange:Ie=>H({type:"setEdgeDirection",direction:Ie}),onLayoutSpacingChange:Ie=>H({type:"setLayoutSpacing",spacing:Ie}),onToggleMinimap:()=>H({type:"setMinimap",visible:!D.showMinimap}),onBack:l})}),gn&&d.jsx("div",{className:"compass-change-legend","aria-label":"Graph change filters",children:lCe.filter(({value:Ie})=>(jn.get(Ie)??0)>0).map(({value:Ie,label:Ze})=>{const Be=!D.hiddenChanges.has(Ie);return d.jsxs("button",{type:"button","data-change":Ie,"aria-pressed":Be,onClick:()=>H({type:"toggleChange",change:Ie}),children:[d.jsx("span",{"aria-hidden":"true"}),Ze,d.jsx("small",{children:jn.get(Ie)??0})]},Ie)})}),o!==void 0&&!gn?d.jsx(xF,{model:t}):null,a&&d.jsx("div",{className:"absolute bottom-4 left-4 z-20 max-w-md rounded-md border border-destructive/50 bg-background/95 px-3 py-2 text-sm text-destructive shadow-lg",role:"alert",children:a}),C&&d.jsx("div",{className:"compass-bounded-notice",role:"status",children:C.scope==="viewer"?d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Most connected symbols first"}),d.jsxs("span",{children:["This community holds ",C.parentMembers.toLocaleString()," symbols; the view shows the ",C.currentMembers.toLocaleString()," most connected. Search for a symbol to open it directly."]})]}):C.scope==="export"?d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Bounded community detail"}),d.jsxs("span",{children:["This standalone document embeds the"," ",C.currentMembers.toLocaleString()," most connected of"," ",C.parentMembers.toLocaleString()," symbols. Open the graph in VS Code or run ",d.jsxs("code",{children:["compass export json --community ",o]})," to inspect every symbol."]})]}):d.jsxs(d.Fragment,{children:[d.jsx("strong",{children:"Partial community comparison"}),d.jsxs("span",{children:["This view is limited to ",C.limit.toLocaleString()," nodes. Increase"," ",d.jsx("code",{children:"compass.graphNodeLimit"})," to inspect all"," ",Math.max(C.parentMembers,C.currentMembers).toLocaleString()," symbols."]})]})}),be&&sn&&Ai&&d.jsx(NF,{node:sn,hover:be,activation:Ai}),ge&&Ot&&qn&&Jo&&d.jsx(jF,{edge:Ot,sourceNode:qn,targetNode:Jo,hover:ge})]}),!ve.collapsed&&d.jsx(TF,{width:ve.width,onResize:Ie=>me({...ve,width:Ie})}),d.jsx(jZ,{model:t,selected:Ce,searchOnly:se!==void 0,searchCoverage:O?{indexed:O.nodes.length,total:O.totalNodes}:void 0,communityFacts:Tt,neighbors:W,connectedEdges:Fe,query:D.query,matches:Ht,communityOrder:m,hiddenCommunities:D.hiddenCommunities,communityDrilldown:o!==void 0,subgraphAvailable:e!==void 0&&Ce!==void 0&&Tt?.level!==void 0&&b0(e,Tt.level,Ce.community)!==void 0,comparisonMode:gn,sourceRevisions:ie,queryResult:J,renderedEdgeCount:ot,showHeader:R,onQueryChange:Ie=>H({type:"search",query:Ie}),onFocus:Xt,onOpenSource:i.openSource,onOpenCommunity:o===void 0?i.openCommunity:void 0,searchSpansCommunities:O||T?!0:void 0,onQueryNode:i.queryNode,onToggleCommunity:Ie=>H({type:"toggleCommunity",communityId:Ie}),onSetAllVisible:Ie=>H({type:"setHiddenCommunities",communityIds:Ie?[]:t.communities.map(Ze=>Ze.id)}),collapsed:ve.collapsed,onToggleCollapsed:()=>me({...ve,collapsed:!ve.collapsed})})]}),ro?.kind==="community"?d.jsx(mw,{kind:"community",communityLabel:ro.communityLabel}):ro?.kind==="layout"?d.jsx(mw,{kind:"layout",onShowGraph:um}):null]})}function dCe({slot:t,children:e}){return t?bs.createPortal(e,t):e}function $N(t,e,n){if(!n)return;const i=t.nodes.find(o=>o.community===e&&o.memberCount!==void 0)?.memberCount;if(!(i===void 0||n.nodes.length>=i))return{limit:n.nodes.length,parentMembers:i,currentMembers:n.nodes.length,scope:"export"}}const Kp=224,uCe=76,Oc=124,Xp=96,ha=96,hCe=288,fCe=112,Qp=12;function pCe(t,e,n={width:1280,height:620},i={},o){const s=t.filter(L=>L.nodeCount>0||L.incomingRelationships>0||L.outgoingRelationships>0);if(s.length===0)return{width:n.width,height:n.height,nodes:[],routes:[],lanes:[]};const a=new Set(s.map(L=>L.id)),l=e.filter(L=>a.has(L.sourceGroup)&&a.has(L.targetGroup)),C=mCe(s,l),c=C.length,u=Math.max(n.width,ha*2+hCe*c),h=(u-ha*2)/c;bCe(C,l);const m=Math.max(...C.map(L=>L.length)),v=Math.max(n.height,Oc+Xp+m*fCe),b=C.findIndex(L=>L.some(F=>F.id===o)),x=Array.from({length:c},(L,F)=>({index:F,x:ha+h*F,width:h,label:TCe(F,c,b<0?void 0:b)})),y=v-Oc-Xp,S=C.flatMap((L,F)=>{const re=y/Math.max(1,L.length);return L.map((pe,ie)=>{const J={x:ha+h*F+h/2,y:Oc+re*ie+re/2},ve=i[pe.id]??J;return{...pe,x:qp(ve.x,ha+Kp/2,u-ha-Kp/2),y:qp(ve.y,Oc,v-Xp),width:Math.min(Kp,h-40),height:uCe,column:ECe(ve.x,x)}})}),T=new Map(S.map(L=>[L.id,L])),O=xCe(l,T),M=QN(l,T,"source"),k=QN(l,T,"target"),G=l.flatMap(L=>{const F=T.get(L.sourceGroup),re=T.get(L.targetGroup);if(!F||!re)return[];const pe=qN(F,re);return[{...L,direction:pe,path:wCe(F,re,pe,O.get(L.id)??0,{height:v},M.get(L.id)??0,k.get(L.id)??0),width:1+Math.min(4.4,Math.log10(L.relationships+1)*1.35)}]});return{width:u,height:v,nodes:S,routes:G,lanes:x}}function mCe(t,e){if(t.length===1)return[[t[0]]];if(e.length===0)return WN(t);const n=vCe(t,e),i=new Map(n.map((c,u)=>[c.id,u])),o=new Map;for(const c of t)o.set(c.id,[]);for(const c of e)(i.get(c.sourceGroup)??0)<(i.get(c.targetGroup)??0)&&c.sourceGroup!==c.targetGroup&&o.get(c.targetGroup)?.push(c);const s=new Map;for(const c of n){const u=(o.get(c.id)??[]).map(h=>(s.get(h.sourceGroup)??0)+1);s.set(c.id,u.length>0?Math.max(...u):0)}const a=Math.max(0,...s.values()),l=Math.min(Qp,a+1);if(l===1)return WN(t);const C=Array.from({length:l},()=>[]);for(const c of n){const u=s.get(c.id)??0,h=ac.length>0)}function vCe(t,e){const n=new Map(t.map(a=>[a.id,a])),i=new Set(n.keys()),o=[],s=[];for(;i.size>0;){const a=yCe(i,e),l=[...i].map(h=>({section:n.get(h),incoming:a.incoming.get(h)??0,outgoing:a.outgoing.get(h)??0})),C=l.filter(h=>h.incoming===0),c=l.filter(h=>h.outgoing===0);if(C.length>0){const h=C.sort((m,v)=>v.outgoing-m.outgoing||yl(m.section,v.section))[0];o.push(h.section),i.delete(h.section.id);continue}if(c.length>0){const h=c.sort((m,v)=>v.incoming-m.incoming||yl(m.section,v.section))[0];s.unshift(h.section),i.delete(h.section.id);continue}const u=l.sort((h,m)=>m.outgoing-m.incoming-(h.outgoing-h.incoming)||m.outgoing+m.incoming-(h.outgoing+h.incoming)||yl(h.section,m.section))[0];o.push(u.section),i.delete(u.section.id)}return[...o,...s]}function yCe(t,e){const n=new Map,i=new Map;for(const o of e){if(o.sourceGroup===o.targetGroup||!t.has(o.sourceGroup)||!t.has(o.targetGroup))continue;const s=1+Math.log10(o.relationships+1);i.set(o.sourceGroup,(i.get(o.sourceGroup)??0)+s),n.set(o.targetGroup,(n.get(o.targetGroup)??0)+s)}return{incoming:n,outgoing:i}}function WN(t){const e=Math.min(6,Math.max(2,Math.ceil(Math.sqrt(t.length)))),n=Array.from({length:e},()=>[]);return[...t].sort(yl).forEach((i,o)=>{n[Math.floor(o*e/t.length)].push(i)}),n}function bCe(t,e){const n=new Map;for(const i of e)KN(n,i.sourceGroup,i.targetGroup,i.relationships),KN(n,i.targetGroup,i.sourceGroup,i.relationships);for(let i=0;i<8;i+=1)for(const o of[1,-1]){const s=o===1?1:t.length-2,a=o===1?t.length:-1;for(let l=s;l!==a;l+=o){const C=new Map,c=o===1?t.slice(0,l):t.slice(l+1);for(const h of c)h.forEach((m,v)=>{C.set(m.id,h.length===1?.5:v/(h.length-1))});const u=new Map(t[l].map((h,m,v)=>[h.id,v.length===1?.5:m/(v.length-1)]));t[l].sort((h,m)=>{const v=XN(h.id,n,C),b=XN(m.id,n,C);return(v??u.get(h.id)??.5)-(b??u.get(m.id)??.5)||yl(h,m)})}}}function KN(t,e,n,i){const o=t.get(e)??new Map;o.set(n,(o.get(n)??0)+i),t.set(e,o)}function XN(t,e,n){let i=0,o=0;for(const[s,a]of e.get(t)??[]){const l=n.get(s);l!==void 0&&(i+=l*a,o+=a)}return o>0?i/o:void 0}function wCe(t,e,n,i,o,s,a){const l=t.y+s,C=e.y+a;if(n==="forward"){const b=t.x+t.width/2,x=e.x-e.width/2,y=Math.max(1,x-b),S=qp(y*.42,42,168),T=OCe(i%9,1.5);return[`M ${b} ${l}`,`C ${b+S} ${l+T}`,`${x-S} ${C+T}`,`${x} ${C}`].join(" ")}if(n==="backward"){const b=t.x-t.width/2,x=e.x+e.width/2,y=(l+C)/2{const l=e.get(s.sourceGroup),C=e.get(a.sourceGroup),c=e.get(s.targetGroup),u=e.get(a.targetGroup);return(l?.column??0)-(C?.column??0)||(c?.column??0)-(u?.column??0)||(l?.y??0)-(C?.y??0)||(c?.y??0)-(u?.y??0)||a.relationships-s.relationships||s.id.localeCompare(a.id)});for(const s of o){const a=e.get(s.sourceGroup),l=e.get(s.targetGroup);if(!a||!l)continue;const C=qN(a,l),c=`${Math.min(a.column,l.column)}:${Math.max(a.column,l.column)}:${C}`,u=i.get(c)??0;n.set(s.id,u),i.set(c,u+1)}return n}function QN(t,e,n){const i=new Map;for(const s of t){const a=n==="source"?s.sourceGroup:s.targetGroup,l=i.get(a)??[];l.push(s),i.set(a,l)}const o=new Map;for(const s of i.values()){s.sort((l,C)=>{const c=e.get(n==="source"?l.targetGroup:l.sourceGroup),u=e.get(n==="source"?C.targetGroup:C.sourceGroup);return(c?.y??0)-(u?.y??0)||(c?.x??0)-(u?.x??0)||l.id.localeCompare(C.id)});const a=Math.min(8,38/Math.max(1,s.length-1));s.forEach((l,C)=>{o.set(l.id,(C-(s.length-1)/2)*a)})}return o}function SCe(t,e,n,i,o){const s=Math.sign(i-e)||1,a=Math.sign(o-n)||1,l=Math.min(12,Math.abs(i-e)/2,Math.abs(n-t)/2);return[`M ${t} ${e}`,`H ${n-Math.sign(n-t)*l}`,`Q ${n} ${e} ${n} ${e+s*l}`,`V ${i-s*l}`,`Q ${n} ${i} ${n+a*l} ${i}`,`H ${o}`].join(" ")}function qN(t,e){return e.column>t.column?"forward":e.columneM(o)),l=E.useRef(s),[C,c]=E.useState(1),[u,h]=E.useState("none"),m=E.useRef("none"),v=E.useRef(0),[b,x]=E.useState(MCe),[y,S]=E.useState("key"),[T,O]=E.useState(),M=E.useRef(null),k=E.useRef(void 0),G=E.useRef(void 0);E.useEffect(()=>{const j=eM(o);l.current=j,a(j),c(1),m.current="start",v.current=0,h("start"),M.current?.scrollTo?.({left:0,top:0}),S("key")},[o]);const L=E.useMemo(()=>DCe(t.routes,e),[t.routes,e]),F=E.useMemo(()=>y==="complete"?{routes:t.routes,reciprocals:new Map}:_Ce(t.routes.filter(j=>L.has(j.id)),e?.kind==="route"?e.id:void 0),[L,t.routes,y,e]),re=F.routes,pe=E.useMemo(()=>{if(y==="complete"||e===void 0)return t.groups;const j=new Set;e.kind==="group"&&j.add(e.id);for(const ce of re)j.add(ce.sourceGroup),j.add(ce.targetGroup);return t.groups.filter(ce=>j.has(ce.id))},[t.groups,y,re,e]),ie=E.useMemo(()=>pCe(pe,re,b,s,y==="key"&&e?.kind==="group"?e.id:void 0),[pe,s,y,re,e,b]),J=ie.routes,ve=E.useMemo(()=>e?.kind!=="group"?new Set:new Set(J.filter(j=>j.sourceGroup===e.id||j.targetGroup===e.id).flatMap(j=>[j.id,j.sourceGroup,j.targetGroup])),[J,e]),me=Math.max(1,...J.map(j=>j.relationships)),ue=t.routes.length-J.length,z={width:Math.round(ie.width*C),height:Math.round(ie.height*C)},U=j=>{n(j)},Q=(j,ce)=>{(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),U(ce))},le=(j,ce)=>{const Se={...l.current,[j]:ce};l.current=Se,a(Se)},X=()=>{try{window.localStorage.setItem(o,JSON.stringify(l.current))}catch{}},R=()=>{l.current={},a({});try{window.localStorage.removeItem(o)}catch{}},D=()=>{c(1),m.current="start",v.current=0,h("start");const j=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;M.current?.scrollTo?.({left:0,top:0,behavior:j?"auto":"smooth"})},H=j=>{const ce=Math.max(0,j.scrollWidth-j.clientWidth),Se=ce<=1?"none":j.scrollLeft<=1?"start":j.scrollLeft>=ce-1?"end":"middle";v.current=ce,m.current=Se,h(_e=>_e===Se?_e:Se)},se=j=>{H(j.currentTarget)},de=j=>{j.target!==j.currentTarget||!M.current||(k.current={x:j.clientX,y:j.clientY,scrollLeft:M.current.scrollLeft,scrollTop:M.current.scrollTop,pointerId:j.pointerId},j.currentTarget.setPointerCapture(j.pointerId))},be=j=>{const ce=k.current,Se=M.current;!ce||!Se||ce.pointerId!==j.pointerId||(Se.scrollLeft=ce.scrollLeft-(j.clientX-ce.x),Se.scrollTop=ce.scrollTop-(j.clientY-ce.y))},Me=j=>{k.current?.pointerId===j.pointerId&&(k.current=void 0,j.currentTarget.hasPointerCapture(j.pointerId)&&j.currentTarget.releasePointerCapture(j.pointerId))},ge=(j,ce)=>{j.stopPropagation();const Se=JN(j.currentTarget.ownerSVGElement,j);Se&&(G.current={id:ce.id,pointerId:j.pointerId,offsetX:Se.x-ce.x,offsetY:Se.y-ce.y,startClientX:j.clientX,startClientY:j.clientY,moved:!1},O(ce.id),j.currentTarget.setPointerCapture(j.pointerId))},ae=(j,ce)=>{const Se=G.current;!Se||Se.id!==ce.id||Se.pointerId!==j.pointerId||(j.currentTarget.hasPointerCapture(j.pointerId)&&j.currentTarget.releasePointerCapture(j.pointerId),G.current=void 0,O(void 0),Se.moved?X():U({kind:"group",id:ce.id}))},xe=j=>{G.current?.pointerId===j.pointerId&&(G.current=void 0,O(void 0))},Re=(j,ce)=>{if(j.key==="Enter"||j.key===" "){j.preventDefault(),U({kind:"group",id:ce.id});return}if(!j.altKey||!j.key.startsWith("Arrow"))return;j.preventDefault();const Se=j.shiftKey?24:8;le(ce.id,{x:ce.x+(j.key==="ArrowRight"?Se:j.key==="ArrowLeft"?-Se:0),y:ce.y+(j.key==="ArrowDown"?Se:j.key==="ArrowUp"?-Se:0)}),X()};return E.useEffect(()=>{const j=M.current;if(!j)return;const ce=()=>{const _e=v.current,gt=Math.max(0,j.scrollWidth-j.clientWidth),Et=_e>1&&j.scrollLeft>=_e-1;if(gt>_e&&(m.current==="end"||Et)&&(j.scrollLeft=gt),H(j),j.clientWidth<=0||j.clientHeight<=0)return;const ot={width:Math.round(j.clientWidth),height:Math.round(j.clientHeight)};x(Ce=>Ce.width===ot.width&&Ce.height===ot.height?Ce:ot)};if(ce(),typeof ResizeObserver>"u")return;const Se=new ResizeObserver(ce);return Se.observe(j),()=>Se.disconnect()},[z.height,z.width]),d.jsxs("section",{className:"architecture-map-panel","aria-labelledby":"architecture-map-title","data-route-mode":y,children:[d.jsxs("header",{className:"architecture-map-header",children:[d.jsxs("div",{className:"architecture-map-intro",children:[d.jsx("span",{children:"Flow canvas"}),d.jsx("strong",{id:"architecture-map-title",children:"Subsystem relationship direction"}),d.jsx("small",{id:"architecture-map-help",children:"Scroll sideways or drag open canvas space to follow the complete architecture."})]}),d.jsxs("div",{className:"architecture-map-actions",children:[d.jsxs("div",{className:"architecture-route-mode",role:"group","aria-label":"Route visibility",children:[d.jsx("button",{type:"button","aria-pressed":y==="key",onClick:()=>S("key"),children:e?.kind==="group"?"Neighbors":"Key routes"}),d.jsxs("button",{type:"button","aria-pressed":y==="complete",onClick:()=>S("complete"),children:["All routes · ",t.routes.length]})]}),d.jsxs("div",{className:"architecture-map-toolbar","aria-label":"Map controls",children:[d.jsx("button",{type:"button","aria-label":"Zoom out",onClick:()=>c(j=>Math.max(.75,j-.25)),children:d.jsx(L4,{"aria-hidden":"true"})}),d.jsxs("span",{"aria-live":"polite",children:[Math.round(C*100),"%"]}),d.jsx("button",{type:"button","aria-label":"Zoom in",onClick:()=>c(j=>Math.min(2,j+.25)),children:d.jsx(u0,{"aria-hidden":"true"})}),d.jsx("button",{type:"button","aria-label":"Reset zoom and scroll position",title:"Reset zoom and scroll position",onClick:D,children:d.jsx(I0,{"aria-hidden":"true"})}),d.jsx("button",{type:"button","aria-label":"Reset subsystem positions",title:"Reset subsystem positions",disabled:Object.keys(s).length===0,onClick:R,children:d.jsx(h0,{"aria-hidden":"true"})})]})]})]}),d.jsx("div",{ref:M,className:"architecture-map-viewport",role:"region","aria-label":"Scrollable architecture flow diagram","aria-describedby":"architecture-map-help",tabIndex:0,"data-scroll-position":u,onScroll:se,children:ie.nodes.length>0?d.jsx("div",{className:"architecture-map-canvas",style:{width:z.width,height:z.height},children:d.jsxs("svg",{className:"architecture-map",viewBox:`0 0 ${ie.width} ${ie.height}`,role:"group","aria-label":zCe(ie.nodes.length,J.length,t.routes.length),onPointerDown:de,onPointerMove:be,onPointerUp:Me,onPointerCancel:()=>{k.current=void 0},children:[d.jsxs("defs",{children:[d.jsx("marker",{id:"architecture-arrow",className:"architecture-arrow architecture-arrow-default",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:d.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})}),d.jsx("marker",{id:"architecture-arrow-incoming",className:"architecture-arrow architecture-arrow-incoming",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:d.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})}),d.jsx("marker",{id:"architecture-arrow-outgoing",className:"architecture-arrow architecture-arrow-outgoing",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto-start-reverse",markerUnits:"userSpaceOnUse",children:d.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})]}),d.jsxs("g",{className:"architecture-map-lanes","aria-hidden":"true",children:[ie.lanes.map(j=>d.jsxs("g",{children:[d.jsx("rect",{x:j.x+8,y:34,width:j.width-16,height:ie.height-76,rx:"12"}),d.jsx("text",{x:j.x+j.width/2,y:61,children:j.label})]},j.index)),d.jsx("text",{className:"architecture-map-direction",x:96,y:24,children:"PRIMARY CALL DIRECTION →"})]}),d.jsx("g",{className:"architecture-routes",children:J.map(j=>{const ce=F.reciprocals.get(j.id),Se=e?.kind==="route"&&e.id===j.id,_e=Se||e===void 0||e.kind==="group"&&ve.has(j.id),gt=j.inferred>j.extracted?"inferred":"extracted",Et=e?.kind==="group"?j.targetGroup===e.id?"incoming":j.sourceGroup===e.id?"outgoing":void 0:void 0,ot=y==="key"?.3+Math.sqrt(j.relationships/me)*.28:.1+Math.sqrt(j.relationships/me)*.2;return d.jsxs("g",{role:"button",tabIndex:0,"aria-label":`${j.sourceGroup} to ${j.targetGroup}, ${j.relationships} ${i}${ce?`; bidirectional, ${ce.relationships} reverse ${i}`:""}${j.direction==="backward"?", feedback route":""}`,"data-direction":j.direction,"data-evidence":gt,"data-reciprocal":ce?"true":void 0,"data-focus-direction":Et,"data-selected":Se||void 0,"data-dimmed":!_e||void 0,onClick:()=>U({kind:"route",id:j.id}),onKeyDown:Ce=>Q(Ce,{kind:"route",id:j.id}),children:[d.jsx("path",{className:"architecture-route-hit",d:j.path}),d.jsx("path",{className:"architecture-route-line",d:j.path,style:{strokeWidth:j.width,"--architecture-route-opacity":ot},markerStart:ce?jCe(Et):void 0,markerEnd:Et==="incoming"?"url(#architecture-arrow-incoming)":Et==="outgoing"?"url(#architecture-arrow-outgoing)":"url(#architecture-arrow)"}),d.jsxs("title",{children:[j.sourceGroup," → ",j.targetGroup,": ",j.relationships," ",i,ce&&` · ${ce.sourceGroup} → ${ce.targetGroup}: ${ce.relationships} ${i}`]})]},j.id)})}),d.jsx("g",{className:"architecture-map-nodes",children:ie.nodes.map(j=>{const ce=e?.kind==="group"&&e.id===j.id,Se=ce||e===void 0||e.kind==="group"&&ve.has(j.id)||e.kind==="route"&&t.routes.some(_e=>_e.id===e.id&&(_e.sourceGroup===j.id||_e.targetGroup===j.id));return d.jsxs("g",{role:"button",tabIndex:0,"aria-label":`${j.name}, ${j.nodeCount} visible symbols, ${j.incomingRelationships} incoming and ${j.outgoingRelationships} outgoing ${i}; drag to reposition`,transform:`translate(${j.x-j.width/2} ${j.y-j.height/2})`,"data-selected":ce||void 0,"data-dimmed":!Se||void 0,"data-dragging":T===j.id||void 0,onPointerDown:_e=>ge(_e,j),onPointerMove:_e=>{const gt=G.current;if(!gt||gt.id!==j.id||gt.pointerId!==_e.pointerId)return;const Et=JN(_e.currentTarget.ownerSVGElement,_e);Et&&((Math.abs(_e.clientX-gt.startClientX)>3||Math.abs(_e.clientY-gt.startClientY)>3)&&(gt.moved=!0),le(j.id,{x:Et.x-gt.offsetX,y:Et.y-gt.offsetY}))},onPointerUp:_e=>ae(_e,j),onPointerCancel:_e=>xe(_e),onKeyDown:_e=>Re(_e,j),children:[d.jsx("rect",{className:"architecture-map-node-shadow",width:j.width,height:j.height,rx:"9"}),d.jsx("rect",{className:"architecture-map-node-card",width:j.width,height:j.height,rx:"9"}),d.jsx("rect",{className:"architecture-map-node-accent",width:"4",height:j.height-16,x:"8",y:"8",rx:"2"}),d.jsx("text",{x:"20",y:"27",className:"architecture-map-node-name",children:kCe(j.name,24)}),d.jsxs("text",{x:"20",y:"48",className:"architecture-map-node-meta",children:[j.nodeCount.toLocaleString()," symbols"," · ","↓",j.incomingRelationships.toLocaleString()," ↑",j.outgoingRelationships.toLocaleString()]}),d.jsxs("g",{className:"architecture-map-node-grip","aria-hidden":"true",children:[d.jsx("circle",{cx:j.width-18,cy:"26",r:"1.2"}),d.jsx("circle",{cx:j.width-13,cy:"26",r:"1.2"}),d.jsx("circle",{cx:j.width-18,cy:"31",r:"1.2"}),d.jsx("circle",{cx:j.width-13,cy:"31",r:"1.2"}),d.jsx("circle",{cx:j.width-18,cy:"36",r:"1.2"}),d.jsx("circle",{cx:j.width-13,cy:"36",r:"1.2"})]}),d.jsxs("title",{children:[j.name," — drag to reposition"]})]},j.id)})})]})}):d.jsxs("div",{className:"architecture-map-empty",children:[d.jsx("strong",{children:"No architecture to draw"}),d.jsx("span",{children:"No subsystems match the current scope and evidence filters."})]})}),d.jsxs("footer",{className:"architecture-map-footer",children:[d.jsxs("div",{className:"architecture-map-legend","aria-label":"Map legend",children:[d.jsxs("span",{children:[d.jsx("i",{"data-evidence":"extracted"})," Extracted"]}),d.jsxs("span",{children:[d.jsx("i",{"data-evidence":"inferred"})," Inferred"]}),d.jsxs("span",{children:[d.jsx("i",{"data-direction":"incoming"})," Incoming"]}),d.jsxs("span",{children:[d.jsx("i",{"data-direction":"outgoing"})," Outgoing"]}),d.jsxs("span",{children:[d.jsx("i",{"data-direction":"bidirectional","aria-hidden":"true",children:"↔"})," Bidirectional"]}),d.jsxs("span",{children:[d.jsx("i",{"data-direction":"feedback"})," Feedback"]}),d.jsxs("span",{children:[d.jsx(G4,{"aria-hidden":"true"})," Drag cards to arrange"]}),ue>0&&d.jsxs("button",{type:"button",onClick:()=>S("complete"),children:[J.length," of ",t.routes.length," routes · Show all"]})]}),d.jsxs("details",{className:"architecture-map-table",children:[d.jsx("summary",{children:"View routes as a table"}),d.jsx("div",{children:d.jsxs("table",{children:[d.jsx("thead",{children:d.jsxs("tr",{children:[d.jsx("th",{children:"From"}),d.jsx("th",{children:"To"}),d.jsx("th",{children:"Relationships"}),d.jsx("th",{children:"Evidence"})]})}),d.jsx("tbody",{children:t.routes.map(j=>d.jsxs("tr",{children:[d.jsx("td",{children:tM(t,j.sourceGroup)}),d.jsx("td",{children:tM(t,j.targetGroup)}),d.jsx("td",{children:j.relationships.toLocaleString()}),d.jsxs("td",{children:[j.extracted," extracted · ",j.inferred," inferred"]})]},j.id))})]})})]})]})]})}function JN(t,e){if(!t)return;const n=t.getScreenCTM();if(!n)return;const i=t.createSVGPoint();i.x=e.clientX,i.y=e.clientY;const o=i.matrixTransform(n.inverse());return{x:o.x,y:o.y}}function eM(t){try{const e=JSON.parse(window.localStorage.getItem(t)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).flatMap(([n,i])=>i&&typeof i=="object"&&"x"in i&&"y"in i&&typeof i.x=="number"&&typeof i.y=="number"&&Number.isFinite(i.x)&&Number.isFinite(i.y)?[[n,{x:i.x,y:i.y}]]:[]))}catch{return{}}}function tM(t,e){return t.groups.find(n=>n.id===e)?.name??e}function kCe(t,e){return t.length<=e?t:`${t.slice(0,e-1)}…`}function DCe(t,e){const n=o=>[...o].sort((s,a)=>a.relationships-s.relationships||s.id.localeCompare(a.id)),i=new Set;if(e?.kind==="route"){const o=t.find(s=>s.id===e.id);if(o){i.add(o.id);const s=t.find(a=>a.sourceGroup===o.targetGroup&&a.targetGroup===o.sourceGroup);s&&i.add(s.id)}return i}else if(e?.kind==="group"){const o=n(t.filter(a=>a.targetGroup===e.id)).slice(0,6),s=n(t.filter(a=>a.sourceGroup===e.id)).slice(0,6);for(const a of n([...o,...s]))i.add(a.id);return i}for(const o of n(t)){if(i.size>=NCe)break;i.add(o.id)}return i}function _Ce(t,e){const n=new Map(t.map(a=>[nM(a.sourceGroup,a.targetGroup),a])),i=new Set,o=[],s=new Map;for(const a of t){if(i.has(a.id))continue;const l=n.get(nM(a.targetGroup,a.sourceGroup));if(!l||l.id===a.id||i.has(l.id)){o.push(a),i.add(a.id);continue}const C=a.id===e?a:l.id===e?l:a.relationships>l.relationships||a.relationships===l.relationships&&a.id.localeCompare(l.id)<=0?a:l,c=C.id===a.id?l:a;o.push(C),s.set(C.id,c),i.add(a.id),i.add(l.id)}return o.sort((a,l)=>l.relationships-a.relationships||a.id.localeCompare(l.id)),{routes:o,reciprocals:s}}function nM(t,e){return`${t}\0${e}`}function jCe(t){return t==="incoming"?"url(#architecture-arrow-outgoing)":t==="outgoing"?"url(#architecture-arrow-incoming)":"url(#architecture-arrow)"}function zCe(t,e,n){return e===n?`${t} subsystems and ${n} directed routes`:`${t} subsystems and ${e} of ${n} directed routes visible`}function PCe(t,e){const n=t.projections.find(y=>y.scope===(e.scope==="all"?"all_code":"production"));if(!n)throw new Error(`Architecture projection is missing scope '${e.scope}'`);const i=new Map(n.groups.map(y=>[y.id,y])),o=new Set(n.overviewGroupIds),s=new Map(n.memberships.map(y=>[t.nodes[y.nodeIndex].id,n.groups[y.groupIndex].id])),a=y=>{const S=s.get(y);return S?i.get(S)?.parentId??S:void 0},l=t.relationships.filter(y=>LCe(e.evidence,y.confidence)&&BCe(e.lens,y.relationClass)&&a(y.source)&&a(y.target)),C=new Map,c=new Map;for(const y of l){const S=a(y.source),T=a(y.target);if(S===T){C.set(S,(C.get(S)??0)+1);continue}if(!o.has(S)||!o.has(T))continue;const O=`${S}->${T}`,M=c.get(O)??[];M.push(y),c.set(O,M)}const u=[...c.entries()].map(([y,S])=>({id:y,sourceGroup:a(S[0].source),targetGroup:a(S[0].target),relationships:S.length,extracted:S.filter(T=>T.confidence==="extracted").length,inferred:S.filter(T=>T.confidence==="inferred").length,ambiguous:S.filter(T=>T.confidence==="ambiguous").length})).sort((y,S)=>S.relationships-y.relationships||y.id.localeCompare(S.id)),h=new Map,m=new Map;for(const y of u)m.set(y.sourceGroup,(m.get(y.sourceGroup)??0)+y.relationships),h.set(y.targetGroup,(h.get(y.targetGroup)??0)+y.relationships);const v=n.overviewGroupIds.flatMap(y=>{const S=i.get(y);return S?[{id:S.id,name:S.name.value,nodeCount:S.nodeCount,totalNodeCount:S.nodeCount,internalRelationshipCount:C.get(S.id)??0,incomingRelationships:h.get(S.id)??0,outgoingRelationships:m.get(S.id)??0,scopes:S.sourceScopes}]:[]}),b=v.reduce((y,S)=>y+S.nodeCount,0),x=v.reduce((y,S)=>y+S.internalRelationshipCount,0)+u.reduce((y,S)=>y+S.relationships,0);return{title:t.title,scope:e.scope,evidence:e.evidence,lens:e.lens,groups:v,routes:u,statistics:{visibleNodes:b,totalNodes:n.quality.metrics.sourceScopes.production+n.quality.metrics.sourceScopes.test+n.quality.metrics.sourceScopes.generated+n.quality.metrics.sourceScopes.vendor+n.quality.metrics.sourceScopes.unknown,visibleRelationships:x,totalRelationships:l.length,communities:t.statistics.communities,extracted:t.statistics.extracted,inferred:t.statistics.inferred,ambiguous:t.statistics.ambiguous},coverage:{internal:n.coverage.internal,crossGroup:n.coverage.crossGroup,unassigned:n.coverage.unassigned},omissions:n.omissions,quality:n.quality,provenance:t.provenance}}function LCe(t,e){return t==="all"||t===e}function BCe(t,e){return t==="all"?e!=="unknown":t==="architecture"?e==="execution"||e==="dependency":t===e}function iM(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,sM=oM,Jp=(t,e)=>n=>{var i;if(e?.variants==null)return sM(t,n?.class,n?.className);const{variants:o,defaultVariants:s}=e,a=Object.keys(o).map(c=>{const u=n?.[c],h=s?.[c];if(u===null)return null;const m=rM(u)||rM(h);return o[c][m]}),l=n&&Object.entries(n).reduce((c,u)=>{let[h,m]=u;return m===void 0||(c[h]=m),c},{}),C=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((c,u)=>{let{class:h,className:m,...v}=u;return Object.entries(v).every(b=>{let[x,y]=b;return Array.isArray(y)?y.includes({...s,...l}[x]):{...s,...l}[x]===y})?[...c,h,m]:c},[]);return sM(t,a,C,n?.class,n?.className)},ZCe=(t,e)=>{const n=new Array(t.length+e.length);for(let i=0;i({classGroupId:t,validator:e}),gM=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Nc="-",aM=[],FCe="arbitrary..",VCe=t=>{const e=HCe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return UCe(a);const l=a.split(Nc),C=l[0]===""&&l.length>1?1:0;return AM(l,C,e)},getConflictingClassGroupIds:(a,l)=>{if(l){const C=i[a],c=n[a];return C?c?ZCe(c,C):C:c||aM}return n[a]||aM}}},AM=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const o=t[e],s=n.nextPart.get(o);if(s){const c=AM(t,e+1,s);if(c)return c}const a=n.validators;if(a===null)return;const l=e===0?t.join(Nc):t.slice(e).join(Nc),C=a.length;for(let c=0;ct.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),i=e.slice(0,n);return i?FCe+i:void 0})(),HCe=t=>{const{theme:e,classGroups:n}=t;return YCe(n,e)},YCe=(t,e)=>{const n=gM();for(const i in t){const o=t[i];em(o,n,i,e)}return n},em=(t,e,n,i)=>{const o=t.length;for(let s=0;s{if(typeof t=="string"){WCe(t,e,n);return}if(typeof t=="function"){KCe(t,e,n,i);return}XCe(t,e,n,i)},WCe=(t,e,n)=>{const i=t===""?e:lM(e,t);i.classGroupId=n},KCe=(t,e,n,i)=>{if(QCe(t)){em(t(i),e,n,i);return}e.validators===null&&(e.validators=[]),e.validators.push(GCe(n,t))},XCe=(t,e,n,i)=>{const o=Object.entries(t),s=o.length;for(let a=0;a{let n=t;const i=e.split(Nc),o=i.length;for(let s=0;s"isThemeGetter"in t&&t.isThemeGetter===!0,qCe=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),i=Object.create(null);const o=(s,a)=>{n[s]=a,e++,e>t&&(e=0,i=n,n=Object.create(null))};return{get(s){let a=n[s];if(a!==void 0)return a;if((a=i[s])!==void 0)return o(s,a),a},set(s,a){s in n?n[s]=a:o(s,a)}}},tm="!",CM=":",JCe=[],IM=(t,e,n,i,o)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:i,isExternal:o}),eIe=t=>{const{prefix:e,experimentalParseClassName:n}=t;let i=o=>{const s=[];let a=0,l=0,C=0,c;const u=o.length;for(let x=0;xC?c-C:void 0;return IM(s,v,m,b)};if(e){const o=e+CM,s=i;i=a=>a.startsWith(o)?s(a.slice(o.length)):IM(JCe,!1,a,void 0,!0)}if(n){const o=i;i=s=>n({className:s,parseClassName:o})}return i},tIe=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,i)=>{e.set(n,1e6+i)}),n=>{const i=[];let o=[];for(let s=0;s0&&(o.sort(),i.push(...o),o=[]),i.push(a)):o.push(a)}return o.length>0&&(o.sort(),i.push(...o)),i}},nIe=t=>({cache:qCe(t.cacheSize),parseClassName:eIe(t),sortModifiers:tIe(t),postfixLookupClassGroupIds:iIe(t),...VCe(t)}),iIe=t=>{const e=Object.create(null),n=t.postfixLookupClassGroups;if(n)for(let i=0;i{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:o,sortModifiers:s,postfixLookupClassGroupIds:a}=e,l=[],C=t.trim().split(oIe);let c="";for(let u=C.length-1;u>=0;u-=1){const h=C[u],{isExternal:m,modifiers:v,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:y}=n(h);if(m){c=h+(c.length>0?" "+c:c);continue}let S=!!y,T;if(S){const L=x.substring(0,y);T=i(L);const F=T&&a[T]?i(x):void 0;F&&F!==T&&(T=F,S=!1)}else T=i(x);if(!T){if(!S){c=h+(c.length>0?" "+c:c);continue}if(T=i(x),!T){c=h+(c.length>0?" "+c:c);continue}S=!1}const O=v.length===0?"":v.length===1?v[0]:s(v).join(":"),M=b?O+tm:O,k=M+T;if(l.indexOf(k)>-1)continue;l.push(k);const G=o(T,S);for(let L=0;L0?" "+c:c)}return c},sIe=(...t)=>{let e=0,n,i,o="";for(;e{if(typeof t=="string")return t;let e,n="";for(let i=0;i{let n,i,o,s;const a=C=>{const c=e.reduce((u,h)=>h(u),t());return n=nIe(c),i=n.cache.get,o=n.cache.set,s=l,l(C)},l=C=>{const c=i(C);if(c)return c;const u=rIe(C,n);return o(C,u),u};return s=a,(...C)=>s(sIe(...C))},aIe=[],bn=t=>{const e=n=>n[t]||aIe;return e.isThemeGetter=!0,e},dM=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,uM=/^\((?:(\w[\w-]*):)?(.+)\)$/i,AIe=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,lIe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,CIe=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,IIe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,cIe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,dIe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vr=t=>AIe.test(t),tt=t=>!!t&&!Number.isNaN(Number(t)),Eo=t=>!!t&&Number.isInteger(Number(t)),nm=t=>t.endsWith("%")&&tt(t.slice(0,-1)),qo=t=>lIe.test(t),hM=()=>!0,uIe=t=>CIe.test(t)&&!IIe.test(t),im=()=>!1,hIe=t=>cIe.test(t),fIe=t=>dIe.test(t),pIe=t=>!Ne(t)&&!ke(t),mIe=t=>t.startsWith("@container")&&(t[10]==="/"&&t[11]!==void 0||t[11]==="s"&&t[16]!==void 0&&t.startsWith("-size/",10)||t[11]==="n"&&t[18]!==void 0&&t.startsWith("-normal/",10)),vIe=t=>Ur(t,bM,im),Ne=t=>dM.test(t),Ws=t=>Ur(t,wM,uIe),fM=t=>Ur(t,OIe,tt),yIe=t=>Ur(t,SM,hM),bIe=t=>Ur(t,xM,im),pM=t=>Ur(t,vM,im),wIe=t=>Ur(t,yM,fIe),Mc=t=>Ur(t,EM,hIe),ke=t=>uM.test(t),bl=t=>Ks(t,wM),xIe=t=>Ks(t,xM),mM=t=>Ks(t,vM),SIe=t=>Ks(t,bM),EIe=t=>Ks(t,yM),Rc=t=>Ks(t,EM,!0),TIe=t=>Ks(t,SM,!0),Ur=(t,e,n)=>{const i=dM.exec(t);return i?i[1]?e(i[1]):n(i[2]):!1},Ks=(t,e,n=!1)=>{const i=uM.exec(t);return i?i[1]?e(i[1]):n:!1},vM=t=>t==="position"||t==="percentage",yM=t=>t==="image"||t==="url",bM=t=>t==="length"||t==="size"||t==="bg-size",wM=t=>t==="length",OIe=t=>t==="number",xM=t=>t==="family-name",SM=t=>t==="number"||t==="weight",EM=t=>t==="shadow",NIe=gIe(()=>{const t=bn("color"),e=bn("font"),n=bn("text"),i=bn("font-weight"),o=bn("tracking"),s=bn("leading"),a=bn("breakpoint"),l=bn("container"),C=bn("spacing"),c=bn("radius"),u=bn("shadow"),h=bn("inset-shadow"),m=bn("text-shadow"),v=bn("drop-shadow"),b=bn("blur"),x=bn("perspective"),y=bn("aspect"),S=bn("ease"),T=bn("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...M(),ke,Ne],G=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],F=()=>[ke,Ne,C],re=()=>[Vr,"full","auto",...F()],pe=()=>[Eo,"none","subgrid",ke,Ne],ie=()=>["auto",{span:["full",Eo,ke,Ne]},Eo,ke,Ne],J=()=>[Eo,"auto",ke,Ne],ve=()=>["auto","min","max","fr",ke,Ne],me=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ue=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...F()],U=()=>[Vr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...F()],Q=()=>[Vr,"screen","full","dvw","lvw","svw","min","max","fit",...F()],le=()=>[Vr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...F()],X=()=>[t,ke,Ne],R=()=>[...M(),mM,pM,{position:[ke,Ne]}],D=()=>["no-repeat",{repeat:["","x","y","space","round"]}],H=()=>["auto","cover","contain",SIe,vIe,{size:[ke,Ne]}],se=()=>[nm,bl,Ws],de=()=>["","none","full",c,ke,Ne],be=()=>["",tt,bl,Ws],Me=()=>["solid","dashed","dotted","double"],ge=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ae=()=>[tt,nm,mM,pM],xe=()=>["","none",b,ke,Ne],Re=()=>["none",tt,ke,Ne],j=()=>["none",tt,ke,Ne],ce=()=>[tt,ke,Ne],Se=()=>[Vr,"full",...F()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[qo],breakpoint:[qo],color:[hM],container:[qo],"drop-shadow":[qo],ease:["in","out","in-out"],font:[pIe],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[qo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[qo],shadow:[qo],spacing:["px",tt],text:[qo],"text-shadow":[qo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Vr,Ne,ke,y]}],container:["container"],"container-type":[{"@container":["","normal","size",ke,Ne]}],"container-named":[mIe],columns:[{columns:[tt,Ne,ke,l]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:k()}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:re()}],"inset-x":[{"inset-x":re()}],"inset-y":[{"inset-y":re()}],start:[{"inset-s":re(),start:re()}],end:[{"inset-e":re(),end:re()}],"inset-bs":[{"inset-bs":re()}],"inset-be":[{"inset-be":re()}],top:[{top:re()}],right:[{right:re()}],bottom:[{bottom:re()}],left:[{left:re()}],visibility:["visible","invisible","collapse"],z:[{z:[Eo,"auto",ke,Ne]}],basis:[{basis:[Vr,"full","auto",l,...F()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tt,Vr,"auto","initial","none",Ne]}],grow:[{grow:["",tt,ke,Ne]}],shrink:[{shrink:["",tt,ke,Ne]}],order:[{order:[Eo,"first","last","none",ke,Ne]}],"grid-cols":[{"grid-cols":pe()}],"col-start-end":[{col:ie()}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":pe()}],"row-start-end":[{row:ie()}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ve()}],"auto-rows":[{"auto-rows":ve()}],gap:[{gap:F()}],"gap-x":[{"gap-x":F()}],"gap-y":[{"gap-y":F()}],"justify-content":[{justify:[...me(),"normal"]}],"justify-items":[{"justify-items":[...ue(),"normal"]}],"justify-self":[{"justify-self":["auto",...ue()]}],"align-content":[{content:["normal",...me()]}],"align-items":[{items:[...ue(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ue(),{baseline:["","last"]}]}],"place-content":[{"place-content":me()}],"place-items":[{"place-items":[...ue(),"baseline"]}],"place-self":[{"place-self":["auto",...ue()]}],p:[{p:F()}],px:[{px:F()}],py:[{py:F()}],ps:[{ps:F()}],pe:[{pe:F()}],pbs:[{pbs:F()}],pbe:[{pbe:F()}],pt:[{pt:F()}],pr:[{pr:F()}],pb:[{pb:F()}],pl:[{pl:F()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":F()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":F()}],"space-y-reverse":["space-y-reverse"],size:[{size:U()}],"inline-size":[{inline:["auto",...Q()]}],"min-inline-size":[{"min-inline":["auto",...Q()]}],"max-inline-size":[{"max-inline":["none",...Q()]}],"block-size":[{block:["auto",...le()]}],"min-block-size":[{"min-block":["auto",...le()]}],"max-block-size":[{"max-block":["none",...le()]}],w:[{w:[l,"screen",...U()]}],"min-w":[{"min-w":[l,"screen","none",...U()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...U()]}],h:[{h:["screen","lh",...U()]}],"min-h":[{"min-h":["screen","lh","none",...U()]}],"max-h":[{"max-h":["screen","lh",...U()]}],"font-size":[{text:["base",n,bl,Ws]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,TIe,yIe]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",nm,Ne]}],"font-family":[{font:[xIe,bIe,e]}],"font-features":[{"font-features":[Ne]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,ke,Ne]}],"line-clamp":[{"line-clamp":[tt,"none",ke,fM]}],leading:[{leading:[s,...F()]}],"list-image":[{"list-image":["none",ke,Ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,Ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:X()}],"text-color":[{text:X()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Me(),"wavy"]}],"text-decoration-thickness":[{decoration:[tt,"from-font","auto",ke,Ws]}],"text-decoration-color":[{decoration:X()}],"underline-offset":[{"underline-offset":[tt,"auto",ke,Ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"tab-size":[{tab:[Eo,ke,Ne]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,Ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:D()}],"bg-size":[{bg:H()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Eo,ke,Ne],radial:["",ke,Ne],conic:[Eo,ke,Ne]},EIe,wIe]}],"bg-color":[{bg:X()}],"gradient-from-pos":[{from:se()}],"gradient-via-pos":[{via:se()}],"gradient-to-pos":[{to:se()}],"gradient-from":[{from:X()}],"gradient-via":[{via:X()}],"gradient-to":[{to:X()}],rounded:[{rounded:de()}],"rounded-s":[{"rounded-s":de()}],"rounded-e":[{"rounded-e":de()}],"rounded-t":[{"rounded-t":de()}],"rounded-r":[{"rounded-r":de()}],"rounded-b":[{"rounded-b":de()}],"rounded-l":[{"rounded-l":de()}],"rounded-ss":[{"rounded-ss":de()}],"rounded-se":[{"rounded-se":de()}],"rounded-ee":[{"rounded-ee":de()}],"rounded-es":[{"rounded-es":de()}],"rounded-tl":[{"rounded-tl":de()}],"rounded-tr":[{"rounded-tr":de()}],"rounded-br":[{"rounded-br":de()}],"rounded-bl":[{"rounded-bl":de()}],"border-w":[{border:be()}],"border-w-x":[{"border-x":be()}],"border-w-y":[{"border-y":be()}],"border-w-s":[{"border-s":be()}],"border-w-e":[{"border-e":be()}],"border-w-bs":[{"border-bs":be()}],"border-w-be":[{"border-be":be()}],"border-w-t":[{"border-t":be()}],"border-w-r":[{"border-r":be()}],"border-w-b":[{"border-b":be()}],"border-w-l":[{"border-l":be()}],"divide-x":[{"divide-x":be()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":be()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Me(),"hidden","none"]}],"divide-style":[{divide:[...Me(),"hidden","none"]}],"border-color":[{border:X()}],"border-color-x":[{"border-x":X()}],"border-color-y":[{"border-y":X()}],"border-color-s":[{"border-s":X()}],"border-color-e":[{"border-e":X()}],"border-color-bs":[{"border-bs":X()}],"border-color-be":[{"border-be":X()}],"border-color-t":[{"border-t":X()}],"border-color-r":[{"border-r":X()}],"border-color-b":[{"border-b":X()}],"border-color-l":[{"border-l":X()}],"divide-color":[{divide:X()}],"outline-style":[{outline:[...Me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tt,ke,Ne]}],"outline-w":[{outline:["",tt,bl,Ws]}],"outline-color":[{outline:X()}],shadow:[{shadow:["","none",u,Rc,Mc]}],"shadow-color":[{shadow:X()}],"inset-shadow":[{"inset-shadow":["none",h,Rc,Mc]}],"inset-shadow-color":[{"inset-shadow":X()}],"ring-w":[{ring:be()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:X()}],"ring-offset-w":[{"ring-offset":[tt,Ws]}],"ring-offset-color":[{"ring-offset":X()}],"inset-ring-w":[{"inset-ring":be()}],"inset-ring-color":[{"inset-ring":X()}],"text-shadow":[{"text-shadow":["none",m,Rc,Mc]}],"text-shadow-color":[{"text-shadow":X()}],opacity:[{opacity:[tt,ke,Ne]}],"mix-blend":[{"mix-blend":[...ge(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ge()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ae()}],"mask-image-linear-to-pos":[{"mask-linear-to":ae()}],"mask-image-linear-from-color":[{"mask-linear-from":X()}],"mask-image-linear-to-color":[{"mask-linear-to":X()}],"mask-image-t-from-pos":[{"mask-t-from":ae()}],"mask-image-t-to-pos":[{"mask-t-to":ae()}],"mask-image-t-from-color":[{"mask-t-from":X()}],"mask-image-t-to-color":[{"mask-t-to":X()}],"mask-image-r-from-pos":[{"mask-r-from":ae()}],"mask-image-r-to-pos":[{"mask-r-to":ae()}],"mask-image-r-from-color":[{"mask-r-from":X()}],"mask-image-r-to-color":[{"mask-r-to":X()}],"mask-image-b-from-pos":[{"mask-b-from":ae()}],"mask-image-b-to-pos":[{"mask-b-to":ae()}],"mask-image-b-from-color":[{"mask-b-from":X()}],"mask-image-b-to-color":[{"mask-b-to":X()}],"mask-image-l-from-pos":[{"mask-l-from":ae()}],"mask-image-l-to-pos":[{"mask-l-to":ae()}],"mask-image-l-from-color":[{"mask-l-from":X()}],"mask-image-l-to-color":[{"mask-l-to":X()}],"mask-image-x-from-pos":[{"mask-x-from":ae()}],"mask-image-x-to-pos":[{"mask-x-to":ae()}],"mask-image-x-from-color":[{"mask-x-from":X()}],"mask-image-x-to-color":[{"mask-x-to":X()}],"mask-image-y-from-pos":[{"mask-y-from":ae()}],"mask-image-y-to-pos":[{"mask-y-to":ae()}],"mask-image-y-from-color":[{"mask-y-from":X()}],"mask-image-y-to-color":[{"mask-y-to":X()}],"mask-image-radial":[{"mask-radial":[ke,Ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":ae()}],"mask-image-radial-to-pos":[{"mask-radial-to":ae()}],"mask-image-radial-from-color":[{"mask-radial-from":X()}],"mask-image-radial-to-color":[{"mask-radial-to":X()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":M()}],"mask-image-conic-pos":[{"mask-conic":[tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ae()}],"mask-image-conic-to-pos":[{"mask-conic-to":ae()}],"mask-image-conic-from-color":[{"mask-conic-from":X()}],"mask-image-conic-to-color":[{"mask-conic-to":X()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:D()}],"mask-size":[{mask:H()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,Ne]}],filter:[{filter:["","none",ke,Ne]}],blur:[{blur:xe()}],brightness:[{brightness:[tt,ke,Ne]}],contrast:[{contrast:[tt,ke,Ne]}],"drop-shadow":[{"drop-shadow":["","none",v,Rc,Mc]}],"drop-shadow-color":[{"drop-shadow":X()}],grayscale:[{grayscale:["",tt,ke,Ne]}],"hue-rotate":[{"hue-rotate":[tt,ke,Ne]}],invert:[{invert:["",tt,ke,Ne]}],saturate:[{saturate:[tt,ke,Ne]}],sepia:[{sepia:["",tt,ke,Ne]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,Ne]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[tt,ke,Ne]}],"backdrop-contrast":[{"backdrop-contrast":[tt,ke,Ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tt,ke,Ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tt,ke,Ne]}],"backdrop-invert":[{"backdrop-invert":["",tt,ke,Ne]}],"backdrop-opacity":[{"backdrop-opacity":[tt,ke,Ne]}],"backdrop-saturate":[{"backdrop-saturate":[tt,ke,Ne]}],"backdrop-sepia":[{"backdrop-sepia":["",tt,ke,Ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":F()}],"border-spacing-x":[{"border-spacing-x":F()}],"border-spacing-y":[{"border-spacing-y":F()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,Ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tt,"initial",ke,Ne]}],ease:[{ease:["linear","initial",S,ke,Ne]}],delay:[{delay:[tt,ke,Ne]}],animate:[{animate:["none",T,ke,Ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,ke,Ne]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:Re()}],"rotate-x":[{"rotate-x":Re()}],"rotate-y":[{"rotate-y":Re()}],"rotate-z":[{"rotate-z":Re()}],scale:[{scale:j()}],"scale-x":[{"scale-x":j()}],"scale-y":[{"scale-y":j()}],"scale-z":[{"scale-z":j()}],"scale-3d":["scale-3d"],skew:[{skew:ce()}],"skew-x":[{"skew-x":ce()}],"skew-y":[{"skew-y":ce()}],transform:[{transform:[ke,Ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Se()}],"translate-x":[{"translate-x":Se()}],"translate-y":[{"translate-y":Se()}],"translate-z":[{"translate-z":Se()}],"translate-none":["translate-none"],zoom:[{zoom:[Eo,ke,Ne]}],accent:[{accent:X()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:X()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ke,Ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":X()}],"scrollbar-track-color":[{"scrollbar-track":X()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mbs":[{"scroll-mbs":F()}],"scroll-mbe":[{"scroll-mbe":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pbs":[{"scroll-pbs":F()}],"scroll-pbe":[{"scroll-pbe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ke,Ne]}],fill:[{fill:["none",...X()]}],"stroke-w":[{stroke:[tt,bl,Ws,fM]}],stroke:[{stroke:["none",...X()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function wl(...t){return NIe(oM(t))}const MIe=Jp("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"}},defaultVariants:{variant:"default"}});function om({className:t,variant:e,...n}){return d.jsx("div",{"data-slot":"alert",role:"alert",className:wl(MIe({variant:e}),t),...n})}function rm({className:t,...e}){return d.jsx("div",{"data-slot":"alert-title",className:wl("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground",t),...e})}function sm({className:t,...e}){return d.jsx("div",{"data-slot":"alert-description",className:wl("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",t),...e})}const RIe=Jp("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});function Hr({className:t,variant:e="default",asChild:n=!1,...i}){const o=n?yw:"span";return d.jsx(o,{"data-slot":"badge","data-variant":e,className:wl(RIe({variant:e}),t),...i})}const kIe=Jp("group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",outline:"border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",ghost:"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",destructive:"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",xs:"h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg:"h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon:"size-8","icon-xs":"size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg","icon-lg":"size-9"}},defaultVariants:{variant:"default",size:"default"}});function gm({className:t,variant:e="default",size:n="default",asChild:i=!1,...o}){const s=i?yw:"button";return d.jsx(s,{"data-slot":"button","data-variant":e,"data-size":n,className:wl(kIe({variant:e,size:n,className:t})),...o})}const am={resolved:0,inferred:1,ambiguous:2,unresolved:3};function DIe({graph:t,host:e}){const n=new Map,i=_Ie(t);for(const s of t.edges){const a=n.get(s.target);(!a||am[s.resolution]>am[a])&&n.set(s.target,s.resolution)}const o={schema:"compass.viewer.graph/1",title:`Calls from ${t.nodes.find(s=>s.id===t.rootSymbol)?.name??t.rootSymbol}`,stats:{nodes:t.nodes.length,edges:t.edges.length,communities:4,aggregated:!1},nodes:t.nodes.map(s=>({id:s.id,label:s.name,kind:s.unresolved?"Unresolved call":"Function",community:am[n.get(s.id)??"resolved"],communityName:n.get(s.id)??"resolved",depth:i.get(s.id),root:s.id===t.rootSymbol,source:jIe(s)})),edges:t.edges.map(s=>({id:s.id,source:s.source,target:s.target,relation:`${s.callee} · ${s.resolution}`,confidence:s.resolution==="resolved"?"extracted":s.resolution==="inferred"?"inferred":"ambiguous"})),communities:[{id:0,label:"Resolved",color:"#59A14F",hidden:!1},{id:1,label:"Inferred",color:"#4E79A7",hidden:!1},{id:2,label:"Ambiguous",color:"#F28E2B",hidden:!1},{id:3,label:"Unresolved",color:"#E15759",hidden:!1}],hyperedges:[]};return d.jsx(Wp,{model:o,host:e,preferredLayout:"hierarchical"})}function _Ie(t){const e=new Map;for(const o of t.edges){const s=e.get(o.source)??[];s.push(o.target),e.set(o.source,s);const a=e.get(o.target)??[];a.push(o.source),e.set(o.target,a)}const n=new Map([[t.rootSymbol,0]]),i=[t.rootSymbol];for(;i.length>0;){const o=i.shift();if(o===void 0)break;const s=n.get(o)??0;for(const a of e.get(o)??[])n.has(a)||(n.set(a,s+1),i.push(a))}return n}function jIe(t){if(t.anchor)return{file:t.anchor.source_file,startByte:t.anchor.start_byte,endByte:t.anchor.end_byte};if(t.file)return{file:t.file,...t.startLine!=null?{startLine:t.startLine}:{},...t.endLine!=null?{endLine:t.endLine}:{},...t.startByte!=null?{startByte:t.startByte}:{},...t.endByte!=null?{endByte:t.endByte}:{}}}function zIe({coverage:t}){return!t.partial&&t.unresolved===0&&t.ambiguous===0?null:d.jsxs(om,{children:[d.jsx(rm,{children:"Partial call coverage"}),d.jsx(sm,{children:t.warning})]})}function PIe({graph:t,host:e}){const[n,i]=E.useState(!1),o=n?t.continuations:t.continuations.slice(0,20),s=t.direction==="callers"?"No callers found":t.direction==="callees"?"No callees found":"No calls found";return d.jsxs("div",{className:"call-graph-view relative h-screen",children:[d.jsx(DIe,{graph:t,host:e}),d.jsx("div",{className:"call-graph-direction absolute top-2 left-1/2 z-20 flex -translate-x-1/2 gap-1 rounded-md border bg-popover/95 p-1 shadow-lg backdrop-blur",role:"group","aria-label":"Call graph direction",children:[["callers","Callers"],["both","Both"],["callees","Callees"]].map(([a,l])=>d.jsx(gm,{size:"sm",variant:t.direction===a?"secondary":"ghost","aria-pressed":t.direction===a,disabled:!e.changeDirection,onClick:()=>{t.direction!==a&&e.changeDirection?.(a)},children:l},a))}),d.jsxs("section",{className:"call-graph-summary absolute bottom-3 left-3 z-20 flex max-w-[min(44rem,calc(100%-1.5rem))] flex-col gap-2 rounded-md border bg-popover/95 p-3 text-popover-foreground shadow-xl backdrop-blur",children:[d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d.jsxs(Hr,{variant:"outline",children:[d.jsx(fu,{})," depth ",t.depth]}),d.jsxs(Hr,{variant:"outline",children:[t.nodes.length," ",t.nodes.length===1?"node":"nodes"]}),d.jsxs(Hr,{variant:"outline",children:[t.edges.length," ",t.edges.length===1?"edge":"edges"]}),d.jsxs(Hr,{variant:"secondary",children:[t.coverage.resolved," resolved"]}),d.jsxs(Hr,{variant:"outline",children:[t.coverage.inferred," inferred"]}),d.jsxs(Hr,{variant:"outline",children:[t.coverage.ambiguous," ambiguous"]}),d.jsxs(Hr,{variant:"destructive",children:[t.coverage.unresolved," unresolved"]}),t.coverage.evidenceLayer&&d.jsx(Hr,{variant:"outline",children:LIe(t.coverage.evidenceLayer)})]}),t.edges.length===0&&d.jsxs(om,{children:[d.jsx(rm,{children:s}),d.jsx(sm,{children:"Compass found the root function but no represented relationships in this direction."})]}),t.truncated&&d.jsxs(om,{children:[d.jsx(IA,{}),d.jsx(rm,{children:"Partial call graph"}),d.jsx(sm,{children:"Compass reached the configured graph limit. Counts and paths may be incomplete."})]}),d.jsx(zIe,{coverage:t.coverage}),t.continuations.length>0&&d.jsxs("div",{children:[d.jsx("div",{className:"flex max-h-24 flex-wrap gap-1 overflow-auto","aria-label":"Call graph continuations",children:o.map(a=>d.jsxs(gm,{size:"xs",variant:"outline",disabled:!e.expand,onClick:()=>e.expand?.(a.symbol,a.direction,a.nextDepth),children:[a.direction==="callers"?d.jsx(f4,{}):a.direction==="callees"?d.jsx(u4,{}):d.jsx(u0,{}),"Expand ",a.direction]},`${a.symbol}:${a.direction}:${a.nextDepth}`))}),!n&&t.continuations.length>o.length&&d.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2",children:[d.jsxs("p",{className:"text-xs text-muted-foreground",role:"status",children:["Showing ",o.length," of ",t.continuations.length," continuations"]}),d.jsxs(gm,{size:"xs",variant:"outline",onClick:()=>i(!0),children:["Show all ",t.continuations.length," continuations"]})]})]})]})]})}function LIe(t){return t.split("_").map((e,n)=>n===0?`${e.slice(0,1).toUpperCase()}${e.slice(1)}`:e).join(" ")}const TM=0;function BIe(t,e){const n=new Set(t.nodes.map(C=>C.id)),i=t.edges.filter(C=>n.has(C.source)&&n.has(C.target)).map(GIe),o=new Map;for(const C of i)o.set(C.source,(o.get(C.source)??0)+1),o.set(C.target,(o.get(C.target)??0)+1);const s=VIe(t),a=new Set(t.paths.flatMap(C=>C.nodeIds.slice(0,1))),l=t.nodes.map(C=>ZIe(C,o.get(C.id)??0,s.get(C.id),a.has(C.id)));return{schema:"compass.viewer.graph/1",title:e,stats:{nodes:l.length,edges:i.length,communities:l.length>0?1:0,aggregated:!1},nodes:l,edges:i,communities:l.length>0?[{id:TM,label:"Query result",color:"#6f7bf7",hidden:!1}]:[],hyperedges:[]}}function ZIe(t,e,n,i){const o=t.details?.type==="symbol"?t.details.data.signature??void 0:void 0;return{id:t.id,label:t.name,kind:t.kind,community:TM,communityName:"Query result",degree:e,...n!==void 0?{depth:n}:{},...i?{root:!0}:{},...t.language?{language:t.language}:{},...o?{signature:o}:{},...t.source?{source:t.source}:{},codeEvidence:t.evidence}}function GIe(t){const e=FIe(t);return{id:t.id,source:t.source,target:t.target,relation:t.kind,...t.relationshipSite?{relationshipSite:t.relationshipSite}:{},...t.details?{details:t.details}:{},...e?{confidence:e}:{},codeEvidence:t.evidence}}function FIe(t){return t.evidence.some(e=>e.confidence==="ambiguous")?"ambiguous":t.evidence.some(e=>e.confidence==="inferred")?"inferred":t.evidence.length>0?"extracted":void 0}function VIe(t){const e=new Map;for(const n of t.paths)n.nodeIds.forEach((i,o)=>{const s=e.get(i);(s===void 0||o[y.id,y])),i=new Map(e.nodes.map(y=>[y.id,y])),o=new Map,s=[],a=OM(i,n),l=OM(n,i),C=new Map(HIe(i,n).map(y=>[y,W0(n.get(y),i.get(y),"node")])),c=[...C.entries()].filter(([,y])=>y.fields.length>0).map(([y])=>y),u=$Ie(t.edges,e.edges),h=u.matched.map(({before:y,after:S})=>({before:y,after:S,evidence:YIe(y,S)})).filter(({evidence:y})=>y.fields.length>0);for(const y of a)Am(o,i.get(y),"added",jC(void 0,i.get(y)));for(const y of l)Am(o,n.get(y),"removed",jC(n.get(y),void 0));for(const y of c)Am(o,i.get(y),"changed",C.get(y));for(const y of u.added)s.push({...y,change:"added",evidence:jC(void 0,y)}),lm(o,y,n,i);for(const y of u.removed)s.push({...y,change:"removed",evidence:jC(y,void 0)}),lm(o,y,n,i);for(const{after:y,evidence:S}of h)s.push({...y,change:"changed",evidence:S}),lm(o,y,n,i);const m=[...o.values()].sort((y,S)=>y.id.localeCompare(S.id));s.sort((y,S)=>y.id.localeCompare(S.id));const v=WIe(s),b=new Set(m.map(y=>y.community)),x=[...e.communities,...t.communities.filter(y=>!e.communities.some(S=>S.id===y.id))].filter(y=>b.has(y.id));return{addedNodes:a.length,removedNodes:l.length,changedNodes:c.length,addedEdges:u.added.length,removedEdges:u.removed.length,changedEdges:h.length,graph:{...e,title:`Graph delta · ${e.title}`,stats:{...e.stats,nodes:m.length,edges:v.length,communities:x.length,aggregated:t.stats.aggregated||e.stats.aggregated},nodes:m,edges:v,communities:x,hyperedges:[]}}}function OM(t,e){return[...t.keys()].filter(n=>!e.has(n))}function HIe(t,e){return[...t.keys()].filter(n=>e.has(n))}function Am(t,e,n,i){e&&t.set(e.id,{...e,change:n,...i?{evidence:i}:{}})}function NM(t,e,n,i){if(t.has(e))return;const o=i.get(e)??n.get(e);o&&t.set(e,{...o,change:"unchanged"})}function lm(t,e,n,i){NM(t,e.source,n,i),NM(t,e.target,n,i)}function YIe(t,e){return W0({...t,id:e.id},e,"edge")}function $Ie(t,e){const n=new Set,i=new Set,o=[],s=(l,C)=>{n.add(l),i.add(C),o.push({before:t[l],after:e[C]})};MM(t,e,n,i,s,l=>Dc(l.id)?void 0:l.id),MM(t,e,n,i,s,l=>Dc(l.id)?Cm(l):void 0);const a=new Map;t.forEach((l,C)=>{if(n.has(C)||!Dc(l.id))return;const c=a.get(kc(l))??{parent:[],current:[]};c.parent.push(C),a.set(kc(l),c)}),e.forEach((l,C)=>{if(i.has(C)||!Dc(l.id))return;const c=a.get(kc(l))??{parent:[],current:[]};c.current.push(C),a.set(kc(l),c)});for(const l of a.values()){l.parent.sort((c,u)=>RM(t[c],t[u])),l.current.sort((c,u)=>RM(e[c],e[u]));const C=Math.min(l.parent.length,l.current.length);for(let c=0;c!i.has(C)),removed:t.filter((l,C)=>!n.has(C))}}function MM(t,e,n,i,o,s){const a=new Map;e.forEach((l,C)=>{if(i.has(C))return;const c=s(l);if(c===void 0)return;const u=a.get(c)??[];u.push(C),a.set(c,u)}),t.forEach((l,C)=>{if(n.has(C))return;const c=s(l);if(c===void 0)return;const h=a.get(c)?.shift();h!==void 0&&o(C,h)})}function Cm(t){return JSON.stringify(JB(t,"edge"))}function kc(t){return JSON.stringify([t.source,t.target,t.relation])}function RM(t,e){return Cm(t).localeCompare(Cm(e))||t.id.localeCompare(e.id)}function Dc(t){return/^edge-\d+-/.test(t)}function WIe(t){const e=new Map;return t.map(n=>{const i=e.get(n.id)??0;return e.set(n.id,i+1),i===0?n:{...n,id:`${n.id}::${n.change}-${i}`}})}function KIe({workbench:t,host:e,communityDetail:n,communityLoading:i,communityError:o,onBackToOverview:s,initialInspectorLayout:a,onInspectorLayoutChange:l,themePreference:C,onThemePreferenceChange:c}){const[u,h]=E.useState(()=>DM(t)??t.defaultView),m=t.views.length<=1,[v,b]=E.useState(m),[x,y]=E.useState(null),S=t.views.find(O=>O.id===u)??t.views[0];E.useEffect(()=>{const O=()=>{const M=DM(t);M&&h(M)};return window.addEventListener("hashchange",O),()=>window.removeEventListener("hashchange",O)},[t]);const T=O=>{h(O);const M=`view=${encodeURIComponent(O)}`;window.location.hash.slice(1)!==M&&(window.location.hash=M)};return S?d.jsxs("div",{className:"visualization-workbench","data-navigation-collapsed":v,children:[d.jsxs("aside",{className:"visualization-rail","data-collapsed":v,"aria-label":"Compass navigation",children:[d.jsxs("header",{children:[d.jsx("span",{className:"visualization-bearing","aria-hidden":"true",children:d.jsx(pw,{className:"compass-navigation-logo",variant:"app"})}),d.jsxs("span",{children:[d.jsx("strong",{children:"Compass"}),d.jsx("small",{title:t.title,children:t.title})]}),d.jsx("button",{className:"visualization-rail-disclosure",type:"button","aria-label":v?"Expand graph navigation":"Collapse graph navigation",title:v?"Expand graph navigation":"Collapse graph navigation",onClick:()=>b(O=>!O),children:v?d.jsx(V4,{"aria-hidden":"true"}):d.jsx(F4,{"aria-hidden":"true"})})]}),m?d.jsx("nav",{"aria-label":"Graph views"}):d.jsx("nav",{"aria-label":"Graph views",children:t.views.map(O=>d.jsxs("button",{type:"button","aria-current":O.id===S.id?"page":void 0,onClick:()=>T(O.id),children:[d.jsx(tce,{view:O}),d.jsxs("span",{children:[d.jsx("strong",{children:O.title}),d.jsx("small",{children:O.description})]}),d.jsx("i",{"data-status":O.coverage.status,title:`${O.coverage.status} view`})]},O.id))}),d.jsxs("footer",{children:[d.jsx("span",{children:"Snapshot"}),d.jsx("code",{children:nce(t.graphIdentity)})]})]}),d.jsxs("main",{className:"visualization-main",children:[d.jsxs("header",{className:"visualization-context",children:[S.kind!=="code"&&d.jsxs("div",{className:"visualization-context-title",children:[d.jsx("span",{children:ice(S)}),d.jsx("strong",{children:S.title})]}),d.jsx("div",{className:"visualization-controls",ref:y}),d.jsxs("div",{className:"visualization-coverage","data-status":S.coverage.status,children:[S.kind!=="call"&&d.jsxs(d.Fragment,{children:[d.jsxs("span",{children:[S.coverage.nodes.toLocaleString()," nodes"]}),d.jsxs("span",{children:[S.coverage.edges.toLocaleString()," relationships"]})]}),d.jsx("strong",{children:oce(S)})]})]}),d.jsx(s1.Provider,{value:x,children:d.jsx("section",{className:"visualization-stage","aria-label":`${S.title} visualization`,children:d.jsx(XIe,{view:S,host:e,communityDetail:n,communityLoading:i,communityError:o,onBackToOverview:s,initialInspectorLayout:a,onInspectorLayoutChange:l,themePreference:C,onThemePreferenceChange:c},S.id)})})]})]}):null}function XIe({view:t,host:e,communityDetail:n,communityLoading:i,communityError:o,onBackToOverview:s,initialInspectorLayout:a,onInspectorLayoutChange:l,themePreference:C,onThemePreferenceChange:c}){if(t.kind==="call")return d.jsx(PIe,{graph:t.graph,host:{openSource:e.openSource,...e.expandCall?{expand:e.expandCall}:{},...e.changeCallDirection?{changeDirection:e.changeCallDirection}:{}}});if(t.kind==="architecture")return d.jsx(qIe,{model:t.model,host:e});if(t.kind==="impact")return d.jsx(Im,{model:BIe(t.result,t.title),host:e,queryResult:t.result,preferredLayout:"hierarchical"});if(t.kind==="history"){const h=UIe(t.before,t.after);return d.jsxs("div",{className:"workbench-history-view",children:[d.jsxs("div",{className:"workbench-history-banner",children:[d.jsx(C0,{"aria-hidden":"true"}),d.jsxs("span",{children:[d.jsxs("strong",{children:[t.baseRevision," → ",t.targetRevision]}),d.jsxs("small",{children:["+",h.addedNodes," / −",h.removedNodes," / Δ",h.changedNodes," nodes"]}),t.hierarchyDiff!==void 0?d.jsx("small",{"data-hierarchy-diff":"true",children:QIe(t.hierarchyDiff)}):null]})]}),d.jsx(Im,{model:h.graph,host:e,preferredLayout:"grid",sourceRevisions:{before:t.baseRevision,after:t.targetRevision}})]})}const u=t.kind==="affected"?"hierarchical":t.kind==="artifact"?t.lens==="routes"?"hierarchical":"grid":"automatic";return d.jsx(Im,{model:t.model,host:e,preferredLayout:u,communityDetails:t.kind==="code"?t.communityDetails:void 0,searchIndex:t.kind==="code"?t.searchIndex:void 0,hierarchy:t.kind==="code"?t.hierarchy:void 0,initialLevel:t.kind==="code"?t.hierarchy?.initialLevel:void 0,communityDetail:t.kind==="code"?n:void 0,communityLoading:t.kind==="code"?i:void 0,communityError:t.kind==="code"?o:void 0,onBackToOverview:t.kind==="code"?s:void 0,initialInspectorLayout:a,onInspectorLayoutChange:l,themePreference:C,onThemePreferenceChange:c})}function QIe(t){return t.split===0&&t.merged===0&&t.appeared===0&&t.disappeared===0&&t.ambiguous===0?`${t.stable} community groups unchanged`:`Community structure: ${[t.split>0?`${t.split} split`:void 0,t.merged>0?`${t.merged} merged`:void 0,t.appeared>0?`${t.appeared} new`:void 0,t.disappeared>0?`${t.disappeared} gone`:void 0,t.ambiguous>0?`${t.ambiguous} ambiguous`:void 0].filter(n=>n!==void 0).join(" · ")}${t.omittedEvents>0?` · ${t.omittedEvents} more omitted`:""}`}function Im({model:t,host:e,queryResult:n,sourceRevisions:i,preferredLayout:o,communityDetails:s,searchIndex:a,hierarchy:l,initialLevel:C,communityDetail:c,communityLoading:u,communityError:h,onBackToOverview:m,initialInspectorLayout:v,onInspectorLayoutChange:b,themePreference:x,onThemePreferenceChange:y}){const[S,T]=E.useState(""),[O,M]=E.useState(""),[k,G]=E.useState(""),[L,F]=E.useState(""),[re,pe]=E.useState(),[ie,J]=E.useState(!1),ve=E.useId(),me=E.useRef(null),ue=E.useRef(null),z=E.useRef(!1),U=re===void 0?void 0:s?.[String(re)],le=(re===void 0?void 0:{communityId:re,model:U??t,bounded:$N(t,re,U)})??c,X=le?.model??t,R=le?`community-${le.communityId}`:"overview",D=E.useMemo(()=>JIe(X),[X]),H=E.useMemo(()=>ece(X,{relation:S,evidence:O,kind:k,language:L}),[X,O,k,L,S]);E.useEffect(()=>{T(""),M(""),G(""),F(""),J(!1)},[R]),E.useEffect(()=>{ie||!z.current||(z.current=!1,me.current?.focus())},[ie]),E.useEffect(()=>{if(!ie)return;const ge=xe=>{xe.key==="Escape"&&(z.current=!0,J(!1))},ae=xe=>{const Re=xe.target;me.current?.contains(Re)||ue.current?.contains(Re)||J(!1)};return document.addEventListener("keydown",ge),document.addEventListener("pointerdown",ae),()=>{document.removeEventListener("keydown",ge),document.removeEventListener("pointerdown",ae)}},[ie]),E.useLayoutEffect(()=>{if(!ie)return;const ge=()=>{const Re=me.current,j=ue.current;if(!Re||!j)return;const ce=Re.getBoundingClientRect(),Se=12,_e=Math.min(310,window.innerWidth-Se*2),gt=Math.min(ce.bottom+8,window.innerHeight-Se);j.style.width=`${_e}px`,j.style.left=`${Math.max(Se,Math.min(ce.left,window.innerWidth-_e-Se))}px`,j.style.top=`${gt}px`,j.style.maxHeight=`${Math.max(0,window.innerHeight-gt-Se)}px`};ge();const ae=typeof ResizeObserver>"u"?void 0:new ResizeObserver(ge);me.current&&ae?.observe(me.current);const xe=me.current?.closest(".compass-graph-toolbar");return xe&&ae?.observe(xe),window.addEventListener("resize",ge),document.addEventListener("scroll",ge,!0),()=>{ae?.disconnect(),window.removeEventListener("resize",ge),document.removeEventListener("scroll",ge,!0)}},[ie,R]);const se=E.useCallback(()=>{T(""),M(""),G(""),F("")},[]),de=E.useCallback(()=>J(!1),[]),be=[S,O,k,L].filter(Boolean).length,Me=be>0&&H.nodes.length===0;return d.jsx("div",{className:"workbench-graph-lens",children:d.jsx(Wp,{model:le?t:H,searchIndex:a,onClearSearchFilters:se,hierarchy:l,initialLevel:C,communityDetail:le?{...le,model:H}:void 0,communityLoading:u,communityError:h,onBackToOverview:re===void 0?m:()=>pe(void 0),initialInspectorLayout:v,onInspectorLayoutChange:b,themePreference:x,onThemePreferenceChange:y,host:{...e,openCommunity:ge=>{s?.[String(ge)]?pe(ge):e.openCommunity?.(ge)}},queryResult:n,sourceRevisions:i,showInspectorHeader:!1,preferredLayout:o,toolbarLeading:d.jsxs("button",{ref:me,className:"workbench-filter-trigger",type:"button","aria-label":"Graph filters","aria-expanded":ie,"aria-controls":ve,onClick:()=>J(ge=>!ge),children:[d.jsx(eB,{"aria-hidden":"true"}),d.jsx("span",{children:"Filters"}),be>0?d.jsx("b",{children:be}):null,d.jsxs("small",{children:[H.nodes.length.toLocaleString()," / ",X.nodes.length.toLocaleString()]})]}),toolbarLeadingPanel:ie?d.jsxs("div",{ref:ue,id:ve,className:"workbench-filter-popover",role:"region","aria-label":"Graph filter options",children:[d.jsxs("header",{children:[d.jsxs("span",{children:[d.jsx("strong",{children:"Filter graph"}),d.jsx("small",{children:"Refine visible nodes and relationships"})]}),d.jsx("button",{type:"button",disabled:be===0,onClick:se,children:"Clear filters"})]}),d.jsx(Xs,{label:"Relationship",value:S,values:D.relations,onChange:T}),d.jsx(Xs,{label:"Evidence",value:O,values:D.evidence,onChange:M}),d.jsx(Xs,{label:"Node kind",value:k,values:D.kinds,onChange:G}),d.jsx(Xs,{label:"Language",value:L,values:D.languages,onChange:F}),d.jsx("footer",{role:"status",children:Me?"No nodes match these filters":`Showing ${H.nodes.length.toLocaleString()} of ${X.nodes.length.toLocaleString()} nodes`})]}):void 0,toolbarLeadingOpen:ie,onToolbarLeadingClose:de,stageOverlay:X.nodes.length===0?d.jsx(kM,{title:"This view has no graph nodes",detail:"The exported graph lens did not contain any nodes to visualize."}):Me&&!ie?d.jsx(kM,{title:"No nodes match these filters",detail:"Clear one or more filters to restore the graph.",onClear:se}):void 0})})}function kM({title:t,detail:e,onClear:n}){return d.jsxs("div",{className:"workbench-graph-empty",role:"status",children:[d.jsx(kC,{"aria-hidden":"true"}),d.jsx("strong",{children:t}),d.jsx("span",{children:e}),n?d.jsx("button",{type:"button",onClick:n,children:"Clear filters"}):null]})}function Xs({label:t,value:e,values:n,onChange:i}){return d.jsxs("label",{children:[d.jsx("span",{children:t}),d.jsxs("select",{value:e,onChange:o=>i(o.target.value),children:[d.jsx("option",{value:"",children:"All"}),n.map(o=>d.jsx("option",{value:o,children:cm(o)},o))]})]})}function qIe({model:t,host:e}){const[n,i]=E.useState("production"),[o,s]=E.useState("all"),[a,l]=E.useState("architecture"),C=E.useMemo(()=>PCe(t,{scope:n,evidence:o,lens:a}),[o,a,t,n]),c=C.groups.find(T=>T.nodeCount>0),[u,h]=E.useState(c?{kind:"group",id:c.id}:void 0),m=t.projections.find(T=>T.scope===(n==="all"?"all_code":"production")),v=u?.kind==="group"?m?.groups.find(T=>T.id===u.id):void 0,b=new Set(m?.groups.filter(T=>T.parentId===v?.id).map(T=>T.id)??[]),x=new Set(m?.memberships.filter(T=>{const O=m.groups[T.groupIndex]?.id;return O===v?.id||O!==void 0&&b.has(O)}).map(T=>t.nodes[T.nodeIndex]?.id).filter(T=>T!==void 0)??[]),y=t.nodes.filter(T=>x.has(T.id)),S=u?.kind==="route"?C.routes.find(T=>T.id===u.id):void 0;return d.jsxs("div",{className:"workbench-architecture",children:[d.jsxs("div",{className:"workbench-filter-strip","aria-label":"Architecture filters",children:[d.jsx(Xs,{label:"Source scope",value:n,values:["production","all"],onChange:T=>i(T)}),d.jsx(Xs,{label:"Evidence",value:o,values:["all","extracted","inferred","ambiguous"],onChange:T=>s(T)}),d.jsx(Xs,{label:"Lens",value:a,values:["architecture","execution","dependency","type","structure","all"],onChange:T=>l(T)}),d.jsxs("label",{children:["Subsystem directory",d.jsxs("select",{"aria-label":"Subsystem directory",value:v?.id??"",onChange:T=>T.target.value&&h({kind:"group",id:T.target.value}),children:[d.jsx("option",{value:"",children:"Select a subsystem"}),m?.groups.map(T=>d.jsxs("option",{value:T.id,children:[T.name.value," · ",T.nodeCount.toLocaleString()," symbols"]},T.id))]})]}),d.jsxs("span",{role:"status",children:[C.statistics.visibleRelationships.toLocaleString()," visible relationships"]}),d.jsxs("span",{role:"status",children:["Architecture quality: ",C.quality.status]}),d.jsxs("span",{role:"status",children:[C.omissions.shownGroups.toLocaleString()," of ",C.omissions.totalGroups.toLocaleString()," groups shown",C.omissions.omittedGroups>0?` · ${C.omissions.omittedGroups.toLocaleString()} available in directory`:""]})]}),d.jsxs("div",{className:"workbench-architecture-body",children:[d.jsx(RCe,{overview:C,selection:u,onSelect:h}),d.jsx("aside",{"aria-label":"Architecture details",children:v?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Subsystem"}),d.jsx("h2",{children:v.name.value}),d.jsxs("p",{children:[y.length.toLocaleString()," symbols · ",v.relationshipCount.toLocaleString()," related relationships"]}),d.jsxs("small",{children:["Name source: ",v.name.provenance," · quality ",v.name.quality,"/100"]}),d.jsx("div",{className:"workbench-symbol-list",children:y.slice(0,100).map(T=>d.jsxs("button",{type:"button",disabled:!T.sourceFile,onClick:()=>T.sourceFile&&e.openSource({file:T.sourceFile}),children:[d.jsx("strong",{children:T.label}),d.jsxs("small",{children:[T.kind,T.sourceFile?` · ${T.sourceFile}`:""]})]},T.id))})]}):S?d.jsxs(d.Fragment,{children:[d.jsx("span",{children:"Subsystem route"}),d.jsxs("h2",{children:[_M(C,S.sourceGroup)," → ",_M(C,S.targetGroup)]}),d.jsxs("p",{children:[S.relationships.toLocaleString()," relationships cross this boundary."]})]}):d.jsx("p",{children:"Select a subsystem or route."})})]})]})}function JIe(t){const e=n=>[...new Set(n.filter(i=>!!i))].sort();return{relations:e(t.edges.map(n=>n.relation)),evidence:e(t.edges.map(n=>n.confidence)),kinds:e(t.nodes.map(n=>n.kind)),languages:e(t.nodes.map(n=>n.language))}}function ece(t,e){const n=t.nodes.filter(l=>(!e.kind||l.kind===e.kind)&&(!e.language||l.language===e.language));let i=new Set(n.map(l=>l.id));const o=t.edges.filter(l=>i.has(l.source)&&i.has(l.target)&&(!e.relation||l.relation===e.relation)&&(!e.evidence||l.confidence===e.evidence));if(e.relation||e.evidence){const l=new Set(o.flatMap(C=>[C.source,C.target]));for(const C of n)C.root&&l.add(C.id);i=l}const s=n.filter(l=>i.has(l.id)),a=new Set(s.map(l=>l.community));return{...t,stats:{...t.stats,nodes:s.length,edges:o.length,communities:a.size},nodes:s,edges:o,communities:t.communities.filter(l=>a.has(l.id))}}function tce({view:t}){const e=t.kind==="code"?kC:t.kind==="call"?fu:t.kind==="impact"?S4:t.kind==="architecture"?g0:t.kind==="history"?C0:t.kind==="affected"?q4:t.lens==="routes"?f0:t.lens==="provenance"?uu:W4;return d.jsx(e,{"aria-hidden":"true"})}function DM(t){const e=new URLSearchParams(window.location.hash.slice(1)).get("view");return e&&t.views.some(n=>n.id===e)?e:void 0}function nce(t){const e=t.startsWith("sha256:")?t.slice(7):t;return e.length>12?e.slice(0,12):e}function ice(t){return t.kind==="artifact"?`${cm(t.lens)} lens`:`${cm(t.kind)} graph`}function oce(t){return t.kind==="architecture"?t.coverage.status==="complete"?"Extraction complete":t.coverage.status==="summary"?"Extraction summary":"Extraction bounded":t.coverage.status==="complete"?"Complete":t.coverage.status==="summary"?"Community summary":"Bounded result"}function cm(t){return t.replaceAll("_"," ").replace(/\b\w/g,e=>e.toUpperCase())}function _M(t,e){return t.groups.find(n=>n.id===e)?.name??e}const rce=ye({provider:Ve(["github","gitlab","bitbucket"]),repositoryUrl:_().url(),revision:_().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i)});function sce(t,e,n=t.revision){if(!ace(n))return;const i=Ace(e.file);if(!i)return;const o=t.repositoryUrl.replace(/\/$/,""),s=lce(t.provider,e);return t.provider==="gitlab"?`${o}/-/blob/${n}/${i}${s}`:t.provider==="bitbucket"?`${o}/src/${n}/${i}${s}`:`${o}/blob/${n}/${i}${s}`}function gce(t,e,n){if(window.dispatchEvent(new CustomEvent("compass:open-source",{detail:e})),!t)return{kind:"unavailable"};const i=sce(t,e,n??t.revision);if(!i)return{kind:"unavailable"};const o=document.createElement("a");return o.href=i,o.target="_blank",o.rel="noopener noreferrer",o.click(),{kind:"opened",url:i}}function ace(t){return/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/i.test(t)}function Ace(t){if(!t||t.startsWith("/")||t.startsWith("\\")||t.includes("\0"))return;const e=t.replaceAll("\\","/").split("/");if(!e.some(n=>!n||n==="."||n===".."))return e.map(encodeURIComponent).join("/")}function lce(t,e){const n=e.startLine;if(n===void 0)return"";const i=Math.max(n,e.endLine??n);return t==="gitlab"?i===n?`#L${n}`:`#L${n}-${i}`:t==="bitbucket"?i===n?`#lines-${n}`:`#lines-${n}:${i}`:i===n?`#L${n}`:`#L${n}-L${i}`}function jM(){const t=document.getElementById("compass-viewer-root"),e=document.getElementById("compass-viewer-model");if(!t||!e)throw new Error("Compass viewer root or model is missing");const n=JSON.parse(e.textContent??""),i=Ice(),o=B_.createRoot(t);let s="auto";P0(s);let a=()=>{};const l=y=>{s=y,P0(y),a()},C=A4.safeParse(n);if(C.success){a=()=>o.render(d.jsx(KIe,{workbench:C.data,host:{openSource(y,S){zM(i,y,S)}},themePreference:s,onThemePreferenceChange:l})),a();return}const c=jo.parse(n),u=Cce(),h=new Map;let m,v=null,b;const x=()=>{o.render(d.jsx(Wp,{model:c,hierarchy:u,initialLevel:u?.initialLevel,themePreference:s,onThemePreferenceChange:l,communityDetail:m,communityLoading:v,communityError:b,onBackToOverview:m?()=>{m=void 0,b=void 0,x()}:void 0,host:{openSource(y,S){zM(i,y,S)},openCommunity(y){v===null&&(v=y,b=void 0,x(),window.setTimeout(()=>{try{let S=h.get(y);if(!S){const T=document.querySelector(`script[data-compass-community="${y}"]`);if(!T)throw new Error(`Community ${y} detail is unavailable in this export.`);S=jo.parse(JSON.parse(T.textContent??"")),h.set(y,S)}m={communityId:y,model:S,bounded:$N(c,y,S)},window.dispatchEvent(new CustomEvent("compass:open-community",{detail:{communityId:y}}))}catch(S){b=S instanceof Error?S.message:String(S)}finally{v=null,x()}},0))}}}))};a=x,x()}function Cce(){const t=document.getElementById("compass-viewer-hierarchy");if(!t?.textContent)return;const e=i0.safeParse(JSON.parse(t.textContent));return e.success?e.data:void 0}function Ice(){const t=document.getElementById("compass-source-navigation");if(!t?.textContent)return;const e=rce.safeParse(JSON.parse(t.textContent));return e.success?e.data:void 0}function zM(t,e,n){gce(t,e,n).kind==="unavailable"&&cce(e.file)}function cce(t){const e=document.getElementById("compass-source-notice"),n=e??document.createElement("div");n.id="compass-source-notice",n.className="compass-source-notice",n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.textContent=["Source link unavailable.",`The exported revision for ${t} is not published by the configured remote.`,"Open this graph in VS Code to navigate to the local source."].join(" "),e||document.body.append(n)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",jM,{once:!0}):jM()})(); diff --git a/crates/compass-output/assets/viewer/manifest.json b/crates/compass-output/assets/viewer/manifest.json index 26c87b20..306726ea 100644 --- a/crates/compass-output/assets/viewer/manifest.json +++ b/crates/compass-output/assets/viewer/manifest.json @@ -3,8 +3,8 @@ "viewerSchema": "compass.viewer.graph/1", "files": { "graph.js": { - "bytes": 1249676, - "sha256": "edfed545135e7bd8bf9cfac91e7170e73ba9941096f0c61e8fc87e5eb8ea414b" + "bytes": 1250083, + "sha256": "70e55a78819c246fa640d89544ef40ebe8d842e14101813d97767740c5879dba" }, "viewer.css": { "bytes": 297754, diff --git a/crates/compass-output/src/agent_query.rs b/crates/compass-output/src/agent_query.rs index bedef38b..babcb62d 100644 --- a/crates/compass-output/src/agent_query.rs +++ b/crates/compass-output/src/agent_query.rs @@ -2952,6 +2952,24 @@ fn answer_for_code( display_label(selected) ); } + if let Some(matched) = response.concept_matches.iter().find(|matched| { + response + .results + .first() + .is_none_or(|first| matched.node_id == first.node_id) + }) { + let method = match matched.method { + compass_model::query_contract::ConceptMatchMethod::Synonym => "synonym", + compass_model::query_contract::ConceptMatchMethod::DocumentLink => "document link", + compass_model::query_contract::ConceptMatchMethod::SemanticLsa => { + "local semantic embedding" + } + }; + headline = format!( + "Approximate: matched {:?} → {:?} via {method}. {headline}", + matched.query, matched.matched + ); + } let mut basis = Vec::new(); if let Some(entity) = primary_results.first() { basis.push(AgentBasis { diff --git a/crates/compass-query/examples/query_batch.rs b/crates/compass-query/examples/query_batch.rs index c75c4398..e01834e3 100644 --- a/crates/compass-query/examples/query_batch.rs +++ b/crates/compass-query/examples/query_batch.rs @@ -9,6 +9,8 @@ use std::path::PathBuf; struct Request { operation: String, symbol: String, + #[serde(default)] + semantic_search: bool, } fn main() -> Result<(), Box> { @@ -16,8 +18,12 @@ fn main() -> Result<(), Box> { let graph = PathBuf::from(arguments.next().ok_or("graph path required")?); let requests_path = PathBuf::from(arguments.next().ok_or("requests path required")?); let output = PathBuf::from(arguments.next().ok_or("output path required")?); + let cache = arguments + .next() + .map(PathBuf::from) + .unwrap_or_else(|| output.with_extension("query-cache")); if arguments.next().is_some() { - return Err("expected graph, requests, output paths".into()); + return Err("expected graph, requests, output and optional cache paths".into()); } let requests: Vec = serde_json::from_slice(&compass_files::read_bytes_bounded( &requests_path, @@ -26,22 +32,28 @@ fn main() -> Result<(), Box> { if requests.is_empty() || requests.len() > 32 { return Err("request count must be 1 to 32".into()); } - let cache = output.with_extension("query-cache"); let (document, identity) = compass_model::code_graph::GraphDocument::load_with_artifact_digest(&graph)?; - let engine = + let mut engine = compass_query::open_with_verified_document(document, identity, &graph, None, &cache)?; let mut responses = Vec::new(); let mut bytes = 0_usize; - for request in requests { + for (ordinal, request) in requests.into_iter().enumerate() { + engine.set_semantic_search(request.semantic_search); + let concept = request.operation == "ask"; let limits = CodeQueryLimits { - max_nodes: 2000, - max_edges: 10000, + max_nodes: if concept { 32 } else { 2000 }, + max_edges: if concept { 1000 } else { 10000 }, max_depth: if request.operation == "callees" { 8 } else { 1 }, max_response_bytes: 32 * 1024 * 1024, ..CodeQueryLimits::default() }; let response = match request.operation.as_str() { + "ask" => engine.query_natural(compass_query::NaturalQueryRequest { + question: request.symbol, + include_heuristic: false, + limits, + })?, "callees" => engine.callees(CallRequest { symbol: request.symbol, include_heuristic: false, @@ -52,13 +64,14 @@ fn main() -> Result<(), Box> { include_heuristic: false, limits, })?, - _ => return Err("only callees and impact are supported".into()), + _ => return Err("only ask, callees and impact are supported".into()), }; bytes = bytes.saturating_add(serde_json::to_vec(&response)?.len()); if bytes > 64 * 1024 * 1024 { return Err("batch output exceeds 64 MiB".into()); } responses.push(response); + eprintln!("completed query {}", ordinal + 1); } // A qualification report is written only after every native query succeeds. compass_files::write_bytes_atomic(&output, &serde_json::to_vec(&responses)?)?; diff --git a/crates/compass-query/src/code_query.rs b/crates/compass-query/src/code_query.rs index 5eda30fa..c7569815 100644 --- a/crates/compass-query/src/code_query.rs +++ b/crates/compass-query/src/code_query.rs @@ -357,6 +357,8 @@ pub struct CodeQueryEngine { pub(crate) search_query_cache: Mutex, pub(crate) fuzzy_lookup_cache: Mutex, pub(crate) deadline: Option, + pub(crate) semantic_search: bool, + pub(crate) semantic_index: Mutex>, } #[derive(Clone, Debug, Eq, PartialEq)] @@ -910,7 +912,7 @@ impl CodeGraphBackend { } } - fn store_term_candidates( + pub(crate) fn store_term_candidates( &self, terms: &[String], limit: usize, @@ -1609,6 +1611,19 @@ impl CodeQueryEngine { Ok(response) } + /// Enable local corpus-trained latent-semantic fallback. No network or model + /// download is performed; exact structured lookup remains unchanged. + #[must_use] + pub fn with_semantic_search(mut self, enabled: bool) -> Self { + self.semantic_search = enabled; + self + } + + /// Configure one request while holding exclusive access to a cached engine. + pub fn set_semantic_search(&mut self, enabled: bool) { + self.semantic_search = enabled; + } + /// Bound every following typed query with an absolute deadline. /// /// The CLI arms one deadline per command and reuses it across retries so a @@ -1736,7 +1751,7 @@ impl CodeQueryEngine { self.finish_response(&mut response) } - pub(crate) fn search_instrumented( + pub(crate) fn search_lexical_instrumented( &self, request: SearchRequest, instrumentation: &mut QueryInstrumentation, @@ -1764,7 +1779,7 @@ impl CodeQueryEngine { } let candidate_limit = usize::try_from(request.limits.max_candidates).unwrap_or(usize::MAX); let admit = |_: &NodeRecord| true; - let mut check = || Ok(()); + let mut check = || self.check_deadline(); let assembly = self.assemble_search_candidates( &request.query, &terms, @@ -1773,7 +1788,8 @@ impl CodeQueryEngine { max_candidates: candidate_limit, source_lookup_limit: candidate_limit, max_candidate_reads: usize::try_from( - compass_model::query_contract::MAX_INDEXED_CANDIDATE_NODES_READ, + compass_model::query_contract::MAX_INDEXED_CANDIDATE_NODES_READ + .saturating_sub(instrumentation.work.candidates_read), ) .unwrap_or(usize::MAX), max_candidate_probes: usize::try_from( diff --git a/crates/compass-query/src/concepts.rs b/crates/compass-query/src/concepts.rs new file mode 100644 index 00000000..dff6c5be --- /dev/null +++ b/crates/compass-query/src/concepts.rs @@ -0,0 +1,722 @@ +//! Bounded approximate concept recall over the published native graph. +use std::collections::{BTreeMap, BTreeSet, VecDeque}; + +use crate::QueryError; +use crate::code_query::{CodeQueryEngine, normalize_symbol, query_edge, query_node}; +use crate::telemetry::QueryInstrumentation; +use compass_model::code_graph::{EdgeKind, NodeDetails, NodeKind, ResourceKind}; +use compass_model::query_contract::{ + CodeQueryResponse, ConceptMatch, ConceptMatchMethod, QueryDiagnostic, QueryDiagnosticCode, + QueryNode, SearchHit, SearchRequest, +}; + +const MAX_EXPANSIONS: usize = 12; +const MAX_CONCEPT_CANDIDATES: u32 = 64; +const MAX_CONCEPT_POSTINGS: usize = 768; +const MAX_DOCUMENT_ROOTS: usize = 8; +const MAX_DOCUMENT_PROBES: usize = 64; + +// These are recall alternatives, never assertions of equivalent code meaning. +const SYNONYMS: &[(&[&str], &[&str])] = &[ + ( + &["authorization", "access control", "permissions"], + &["authz", "permission", "policy", "access", "auth"], + ), + ( + &["authentication", "sign in", "log in"], + &["authn", "login", "credential", "oauth", "token"], + ), + ( + &["configuration", "config", "environment variables"], + &["settings", "env", "config"], + ), + ( + &["persistence", "data storage", "database access"], + &["repository", "dao", "database", "store", "db"], + ), + ( + &["validation", "input checking"], + &["validate", "validator", "validation", "schema"], + ), + ( + &["rate limiting", "rate limit", "request throttling"], + &["rate limit", "ratelimit", "limiter", "throttle", "quota"], + ), + ( + &[ + "background jobs", + "background work", + "job scheduling", + "recurring jobs", + ], + &["scheduler", "schedule", "worker", "queue", "task"], + ), + ( + &["caching", "cache invalidation"], + &["cache", "evict", "ttl"], + ), + ( + &["database transactions", "unit of work"], + &["transaction", "uow", "session"], + ), + ( + &["feature flags", "feature toggles"], + &["feature", "flag", "toggle", "launchdarkly"], + ), + ( + &["error handling", "exceptions"], + &["error", "exception", "handler"], + ), + ( + &["observability", "monitoring"], + &["telemetry", "metrics", "tracing", "logging"], + ), + (&["logging", "audit trail"], &["logger", "log", "audit"]), + ( + &["concurrency", "synchronization", "simultaneous"], + &["mutex", "lock", "semaphore"], + ), + ( + &["serialization", "encoding"], + &["serialize", "serializer", "codec", "encode"], + ), + ( + &[ + "retry", + "retries", + "transient failures", + "transient database failures", + ], + &["backoff", "retry", "attempt"], + ), + (&["timeouts", "request timeout"], &["timeout", "deadline"]), + ( + &["encryption", "cryptography", "encrypted"], + &["encrypt", "crypto", "cipher", "encrypter", "rsa"], + ), + ( + &["file uploads", "file upload"], + &["upload", "multipart", "attachment", "file"], + ), + ( + &["email delivery", "sending email"], + &["smtp", "mail", "email"], + ), + ( + &["pagination", "result paging"], + &["pagination", "paginate", "cursor", "page"], + ), + ( + &["notifications", "event delivery"], + &["notify", "notification", "event"], + ), + ( + &["subscription payments", "billing", "payments"], + &["billing", "invoice", "payment", "stripe", "subscription"], + ), + ( + &["deployment", "container orchestration"], + &["deploy", "kubernetes", "k8s", "docker"], + ), + ( + &["routing", "http endpoints"], + &["router", "route", "controller", "endpoint"], + ), + ( + &["dependency injection"], + &["inject", "provider", "container"], + ), + ( + &["search indexing", "full text search"], + &["index", "fts", "search"], + ), + ( + &["database migrations", "schema changes"], + &["migration", "alembic", "revision"], + ), + ( + &["health checks", "service health"], + &["health", "healthcheck", "readiness", "liveness"], + ), + ( + &["data deletion", "retention policy", "data retention"], + &["retention", "delete", "purge", "gc"], + ), +]; + +pub(crate) fn expansions(question: &str) -> Vec<(String, String)> { + // Match whole words/phrases, not identifier substrings (authorship != auth). + let words = question + .to_ascii_lowercase() + .split(|c: char| !c.is_alphanumeric()) + .filter(|part| !part.is_empty()) + .collect::>() + .join(" "); + let padded = format!(" {words} "); + let mut result = BTreeSet::new(); + for (phrases, alternatives) in SYNONYMS { + if let Some(phrase) = phrases + .iter() + .find(|phrase| padded.contains(&format!(" {phrase} "))) + { + for alternative in *alternatives { + result.insert(((*phrase).to_owned(), (*alternative).to_owned())); + } + } + } + result.into_iter().take(MAX_EXPANSIONS).collect() +} + +fn document_content(node: &QueryNode) -> Option<&str> { + match &node.details { + Some(NodeDetails::Document(details)) => details.content.as_deref(), + Some(NodeDetails::Resource(details)) => details.content.as_deref(), + _ => None, + } +} + +fn is_document(node: &QueryNode) -> bool { + matches!(&node.details, Some(NodeDetails::Document(_))) + || matches!(&node.details, Some(NodeDetails::Resource(details)) if matches!(details.resource_kind, ResourceKind::Document | ResourceKind::Rationale)) +} + +fn terms(value: &str) -> BTreeSet { + compass_model::search::identifier_search_terms(value) + .into_iter() + .map(compass_model::canonical_code_token) + .collect() +} + +fn name_matches(node: &QueryNode, query: &[String]) -> bool { + let mut node_terms = terms(&node.name); + node_terms.extend(terms(&node.qualified_name)); + if let Some(source) = &node.source { + node_terms.extend(terms(&source.file)); + } + query + .iter() + .all(|term| node_terms.contains(&compass_model::canonical_code_token(term.clone()))) +} + +fn implementation_candidate(node: &compass_model::code_graph::NodeRecord) -> bool { + !matches!( + node.kind, + NodeKind::Parameter + | NodeKind::Property + | NodeKind::Field + | NodeKind::Variable + | NodeKind::Constant + | NodeKind::Import + | NodeKind::Export + ) +} + +fn kind_signal(node: &QueryNode) -> f64 { + match node.kind { + NodeKind::Class + | NodeKind::Struct + | NodeKind::Interface + | NodeKind::Trait + | NodeKind::Protocol => 250_000.0, + NodeKind::Function | NodeKind::Method | NodeKind::Constructor => 200_000.0, + NodeKind::Module | NodeKind::Package | NodeKind::Namespace | NodeKind::File => 150_000.0, + NodeKind::Enum | NodeKind::TypeAlias => 100_000.0, + NodeKind::Resource => -300_000.0, + _ => -600_000.0, + } +} + +fn context_terms(question_terms: &[String], phrase: &str) -> BTreeSet { + let phrase_terms = terms(phrase); + question_terms + .iter() + .filter(|term| { + (!phrase_terms.contains(*term) + || matches!( + term.as_str(), + "database" | "file" | "request" | "workspace" | "application" + )) + && !matches!( + term.as_str(), + "handle" + | "handles" + | "handled" + | "check" + | "checks" + | "checked" + | "enforce" + | "enforced" + | "load" + | "loaded" + | "read" + | "configure" + | "configured" + | "run" + | "implement" + | "prevents" + | "stored" + | "result" + | "user" + ) + }) + .map(|term| match term.as_str() { + "database" => "db".into(), + "uploaded" => "upload".into(), + "application" => "app".into(), + _ => term.clone(), + }) + .collect() +} + +fn configuration_intent(question_terms: &[String]) -> bool { + question_terms.iter().any(|term| { + matches!( + term.as_str(), + "configure" | "configuration" | "setting" | "config" | "env" + ) + }) +} + +fn synonym_score( + node: &QueryNode, + phrase: &str, + alternative: &str, + question_terms: &[String], +) -> f64 { + let synonyms = SYNONYMS + .iter() + .find(|(phrases, _)| phrases.contains(&phrase)) + .map(|(_, alternatives)| *alternatives) + .unwrap_or_default(); + let priority = synonyms + .iter() + .position(|candidate| *candidate == alternative) + .map_or(0, |index| synonyms.len().saturating_sub(index)); + let alternative_terms = crate::search_tokens(alternative); + let names = terms(&node.name); + let qualified = terms(&node.qualified_name); + let path = node + .source + .as_ref() + .map_or("", |source| source.file.as_str()); + let source_terms = terms(path); + let direct = alternative_terms.iter().all(|term| names.contains(term)); + let owner = alternative_terms + .iter() + .all(|term| qualified.contains(term)); + let file = path.rsplit('/').next().unwrap_or_default(); + let file_terms = terms(file); + let file_words = + compass_model::identifier_tokens(file.rsplit_once('.').map_or(file, |(stem, _)| stem)); + let file_match = alternative_terms + .iter() + .all(|term| file_terms.contains(term)); + let mut all = names.clone(); + all.extend(qualified); + all.extend(source_terms); + if all.contains("database") { + all.insert("db".into()); + } + let context_count = context_terms(question_terms, phrase) + .iter() + .filter(|term| all.contains(*term)) + .take(4) + .count(); + let test = path + .split('/') + .any(|part| matches!(part, "tests" | "test" | "fixtures" | "generated")); + let data_path = path + .split('/') + .any(|part| matches!(part, "models" | "entities" | "contracts" | "fields")); + let data_signature = matches!(&node.details, Some(NodeDetails::Symbol(details)) if details.signature.as_deref().is_some_and(|signature| signature.contains("NamedTuple") || signature.contains("TypedDict"))); + let utility = path.split('/').count() <= 2 + && path + .split('/') + .next() + .is_some_and(|part| matches!(part, "libs" | "lib" | "utils" | "extensions")); + let config_source = path + .split('/') + .any(|part| matches!(part, "configs" | "config" | "settings" | "extensions")); + let data_type = matches!( + node.kind, + NodeKind::Class | NodeKind::Struct | NodeKind::Interface | NodeKind::TypeAlias + ) && (data_path + || data_signature + || names.iter().any(|term| { + matches!( + term.as_str(), + "error" + | "exception" + | "response" + | "request" + | "payload" + | "params" + | "entity" + | "record" + | "contract" + ) + })); + // Compact identifiers and a concept-bearing filename favor a reusable + // implementation over incidental methods and data-transfer declarations. + 2_000_000.0 + + kind_signal(node) + + priority as f64 * 25_000.0 + + if direct { + 300_000.0 + } else if owner { + 150_000.0 + } else { + 0.0 + } + + if file_match { + 350_000.0 * alternative_terms.len() as f64 + / file_words.len().max(alternative_terms.len()).max(1) as f64 + } else { + 0.0 + } + + if utility { 300_000.0 } else { 0.0 } + + if configuration_intent(question_terms) && config_source { + 800_000.0 + } else { + 0.0 + } + + context_count as f64 * 300_000.0 + + 200_000.0 / names.len().max(1) as f64 + - path.split('/').count() as f64 * 20_000.0 + - if data_type { 500_000.0 } else { 0.0 } + - if test || node.source.is_none() { + 500_000.0 + } else { + 0.0 + } +} + +impl CodeQueryEngine { + pub(crate) fn search_instrumented( + &self, + request: SearchRequest, + instrumentation: &mut QueryInstrumentation, + ) -> Result { + self.search_concepts_instrumented(request, instrumentation, &|_| true) + } + + pub(crate) fn search_concepts_instrumented( + &self, + request: SearchRequest, + instrumentation: &mut QueryInstrumentation, + admit: &dyn Fn(&compass_model::code_graph::NodeRecord) -> bool, + ) -> Result { + let mut response = self.search_lexical_instrumented(request.clone(), instrumentation)?; + // Scoped discovery applies admission before concept ranking/capping. + // Keep document roots available so an in-scope target can still be + // reached from an out-of-scope design note. + let mut admitted_ids = BTreeSet::new(); + for node in &response.nodes { + if is_document(node) + || self + .backend + .node_by_id(&node.id)? + .is_some_and(|record| admit(&record)) + { + admitted_ids.insert(node.id.clone()); + } + } + let normalized = normalize_symbol(&request.query); + if response.nodes.iter().any(|node| { + admitted_ids.contains(&node.id) + && !is_document(node) + && (node.id == request.query + || normalize_symbol(&node.name) == normalized + || normalize_symbol(&node.qualified_name) == normalized) + }) { + return Ok(response); + } + response + .results + .retain(|hit| admitted_ids.contains(&hit.node_id)); + let mut original_terms = crate::query_terms(&request.query); + // Preserve acronym spellings (OAuth -> oauth) alongside subwords. + for word in request.query.split(|c: char| !c.is_alphanumeric()) { + if word.chars().filter(|c| c.is_uppercase()).count() >= 2 && word.len() >= 3 { + original_terms.push(compass_model::canonical_code_token(word.to_lowercase())); + } + } + original_terms.sort(); + original_terms.dedup(); + let mut nodes = response + .nodes + .iter() + .cloned() + .map(|node| (node.id.clone(), node)) + .collect::>(); + let mut hits = response + .results + .iter() + .cloned() + .map(|hit| (hit.node_id.clone(), hit)) + .collect::>(); + let mut matches = Vec::new(); + let variants = expansions(&request.query); + for (concept, alternative) in &variants { + self.check_deadline()?; + // Read a bounded posting envelope before ranking. Truncating an + // ID-ordered posting list to 64 first makes important declarations + // disappear behind fields, parameters and data-transfer types. + let remaining = compass_model::query_contract::MAX_INDEXED_CANDIDATE_NODES_READ + .saturating_sub(instrumentation.work.candidates_read); + let terms = crate::search_tokens(alternative); + let posting_limit = MAX_CONCEPT_POSTINGS.min(remaining as usize / terms.len().max(1)); + if posting_limit < compass_graph::GRAPH_TERM_POSTING_CHUNK_ITEMS { + response.truncated = true; + break; + } + let fts = terms + .iter() + .map(|term| format!("\"{}\"*", term.replace('"', "\"\""))) + .collect::>() + .join(" AND "); + let (recalled, limited, decoded) = if let Some(read) = self + .backend + .store_term_candidates(&terms, posting_limit, true)? + { + (read.nodes, read.truncated, read.node_ids_decoded) + } else { + let (nodes, limited) = self.materialized_term_candidates(&fts, posting_limit)?; + let decoded = nodes.len() as u64; + (nodes, limited, decoded) + }; + response.truncated |= limited; + instrumentation.work.candidates_read = + instrumentation.work.candidates_read.saturating_add(decoded); + instrumentation.work.postings_decoded = instrumentation + .work + .postings_decoded + .saturating_add(decoded); + let mut ranked = recalled + .iter() + .filter(|node| { + admit(node) + && (implementation_candidate(node) + || (configuration_intent(&original_terms) + && matches!(node.kind, NodeKind::Field | NodeKind::ConfigKey) + && node.source.as_ref().is_some_and(|source| { + source.file.split('/').any(|part| { + matches!(part, "configs" | "config" | "settings") + }) + }))) + }) + .map(query_node) + .filter(|node| name_matches(node, &terms)) + .map(|node| { + let score = synonym_score(&node, concept, alternative, &original_terms); + (node, score) + }) + .collect::>(); + ranked.sort_by(|a, b| b.1.total_cmp(&a.1).then_with(|| a.0.id.cmp(&b.0.id))); + let cap = request.limits.max_candidates.min(MAX_CONCEPT_CANDIDATES) as usize; + response.truncated |= ranked.len() > cap; + for (node, score) in ranked.into_iter().take(cap) { + nodes.insert(node.id.clone(), node.clone()); + let candidate = hits.entry(node.id.clone()).or_insert(SearchHit { + node_id: node.id.clone(), + score, + matched_fields: vec!["synonym".to_owned()], + }); + candidate.score = candidate.score.max(score); + matches.push(ConceptMatch { + node_id: node.id.clone(), + method: ConceptMatchMethod::Synonym, + query: concept.clone(), + matched: alternative.clone(), + via: Vec::new(), + }); + } + } + let has_name_match = nodes.values().any(|node| { + hits.contains_key(&node.id) && !is_document(node) && name_matches(node, &original_terms) + }); + if self.semantic_search && !has_name_match && matches.is_empty() { + for (node, similarity) in + self.semantic_candidates(&request.query, request.limits.max_nodes)? + { + if !admit(&node) { + continue; + } + let node = query_node(&node); + hits.insert( + node.id.clone(), + SearchHit { + node_id: node.id.clone(), + score: 1_000_000.0 + similarity * 1000.0, + matched_fields: vec!["semantic_lsa".to_owned()], + }, + ); + matches.push(ConceptMatch { + node_id: node.id.clone(), + method: ConceptMatchMethod::SemanticLsa, + query: request.query.clone(), + matched: "local-lsa/1 (corpus co-occurrence; approximate)".to_owned(), + via: Vec::new(), + }); + nodes.insert(node.id.clone(), node); + } + } + // Follow only witnessed document relationships. Containment reaches a + // paragraph from a matching heading; it never fabricates a code edge. + let mut documents = nodes + .values() + .filter(|node| { + if is_document(node) { + let text = document_content(node) + .unwrap_or_default() + .chars() + .take(8192) + .collect::(); + let terms = crate::query_terms(&text); + name_matches(node, &original_terms) + || original_terms.iter().any(|term| terms.contains(term)) + || matches.iter().any(|matched| matched.node_id == node.id) + } else { + false + } + }) + .map(|node| node.id.clone()) + .collect::>(); + documents.sort_by(|left, right| { + hits[right] + .score + .total_cmp(&hits[left].score) + .then_with(|| left.cmp(right)) + }); + if documents.len() > MAX_DOCUMENT_ROOTS { + response.truncated = true; + } + let mut pending = documents + .into_iter() + .take(MAX_DOCUMENT_ROOTS) + .map(|id| (id.clone(), vec![id], 0_u32)) + .collect::>(); + let mut visited = BTreeSet::new(); + let mut edges = BTreeMap::new(); + let mut expanded_edges = 0_usize; + while let Some((owner, via, depth)) = pending.pop_front() { + self.check_deadline()?; + if !visited.insert(owner.clone()) { + continue; + } + if visited.len() > MAX_DOCUMENT_PROBES { + response.truncated = true; + break; + } + let remaining = usize::try_from(request.limits.max_edges) + .unwrap_or(usize::MAX) + .saturating_sub(expanded_edges); + if remaining == 0 { + response.truncated = true; + break; + } + let (outgoing, limited) = self.backend.matching_bounded( + &owner, + false, + &[ + EdgeKind::Documents, + EdgeKind::References, + EdgeKind::Contains, + ], + false, + remaining, + )?; + response.truncated |= limited; + expanded_edges = expanded_edges.saturating_add(outgoing.len()); + instrumentation.work.edges_expanded += + u64::try_from(outgoing.len()).unwrap_or(u64::MAX); + for edge in outgoing { + let Some(target) = self.backend.node_by_id(&edge.target)? else { + continue; + }; + let admitted = admit(&target); + let target = query_node(&target); + let target_is_document = is_document(&target); + if target_is_document && edge.kind == EdgeKind::Contains { + if depth >= request.limits.max_depth.min(2) { + response.truncated = true; + continue; + } + nodes.insert(target.id.clone(), target.clone()); + edges.insert(edge.id.clone(), query_edge(&edge)); + let mut path = via.clone(); + path.push(target.id.clone()); + pending.push_back((target.id, path, depth + 1)); + } else if admitted + && !target_is_document + && edge.kind != EdgeKind::Contains + && target.kind != NodeKind::Resource + { + nodes.insert(target.id.clone(), target.clone()); + let score = hits.get(&via[0]).map_or(0.0, |hit| hit.score) + 100_000.0; + hits.entry(target.id.clone()).or_insert(SearchHit { + node_id: target.id.clone(), + score, + matched_fields: vec!["document_link".to_owned()], + }); + edges.insert(edge.id.clone(), query_edge(&edge)); + matches.push(ConceptMatch { + node_id: target.id, + method: ConceptMatchMethod::DocumentLink, + query: request.query.clone(), + matched: target.qualified_name, + via: via.clone(), + }); + } + } + } + if matches.is_empty() { + return Ok(response); + } + response.results = hits.into_values().collect(); + response.results.sort_by(|a, b| { + b.score + .total_cmp(&a.score) + .then_with(|| a.node_id.cmp(&b.node_id)) + }); + let cap = usize::try_from(request.limits.max_nodes).unwrap_or(usize::MAX); + response.truncated |= response.results.len() > cap; + response.results.truncate(cap); + let mut retained = response + .results + .iter() + .map(|hit| hit.node_id.clone()) + .collect::>(); + // Retain the provenance path only when it fits, keeping endpoints coherent. + for item in &matches { + if retained.contains(&item.node_id) { + for id in &item.via { + if retained.len() < cap { + retained.insert(id.clone()); + } else if !retained.contains(id) { + response.truncated = true; + } + } + } + } + response.nodes = nodes + .into_values() + .filter(|node| retained.contains(&node.id)) + .collect(); + response.edges = edges + .into_values() + .filter(|edge| retained.contains(&edge.source) && retained.contains(&edge.target)) + .collect(); + matches.retain(|item| retained.contains(&item.node_id)); + response.concept_matches = matches; + response + .diagnostics + .retain(|d| d.code != QueryDiagnosticCode::NoMatch); + if let Some(first) = response.results.first() { + response.diagnostics.push(QueryDiagnostic { code: QueryDiagnosticCode::NoMatch, + message: "Approximate concept recall; synonym, document and semantic matches do not prove implementation equivalence. Exact structural evidence is unchanged.".to_owned(), + node_id: Some(first.node_id.clone()), path: None }); + } + self.finish_natural_response(response) + } +} diff --git a/crates/compass-query/src/discovery.rs b/crates/compass-query/src/discovery.rs index ddd23c60..23759cb0 100644 --- a/crates/compass-query/src/discovery.rs +++ b/crates/compass-query/src/discovery.rs @@ -150,12 +150,11 @@ impl CodeQueryEngine { let Ok(plan) = plan_natural_query(&request.question) else { return Ok(None); }; - if !plan.routes_to_typed_query() - || matches!( - plan.intent(), - NaturalQueryIntent::Search | NaturalQueryIntent::Fallback - ) - { + let concept_search = matches!( + plan.intent(), + NaturalQueryIntent::Search | NaturalQueryIntent::Fallback + ); + if !concept_search && !plan.routes_to_typed_query() { return Ok(None); } if plan.intent() == NaturalQueryIntent::NodeTrail && request.limits.max_seeds < 2 { @@ -173,8 +172,25 @@ impl CodeQueryEngine { ..CodeQueryLimits::default() }, })?; - let typed = profiled.response; - if typed.nodes.is_empty() { + let mut typed = profiled.response; + for matched in &typed.concept_matches { + if typed + .results + .first() + .is_some_and(|hit| hit.node_id == matched.node_id) + { + typed.diagnostics.push(QueryDiagnostic { + code: QueryDiagnosticCode::NoMatch, + message: format!( + "Approximate: matched {:?} → {:?} via {:?}; document path {:?}", + matched.query, matched.matched, matched.method, matched.via + ), + node_id: Some(matched.node_id.clone()), + path: None, + }); + } + } + if typed.nodes.is_empty() || (concept_search && typed.concept_matches.is_empty()) { return Ok(None); } if profiled.profile.work.edges_expanded > request.limits.max_expanded_relationships { @@ -186,7 +202,18 @@ impl CodeQueryEngine { } let mut seeds = Vec::new(); let backend = self.backend.pin_discovery()?; - for operand in plan.operands() { + let concept_operands = typed + .results + .iter() + .take(usize::try_from(request.limits.max_seeds).unwrap_or(usize::MAX)) + .map(|hit| hit.node_id.clone()) + .collect::>(); + let seed_operands = if concept_search { + &concept_operands[..] + } else { + plan.operands() + }; + for operand in seed_operands { let normalized = normalize_symbol(operand); let selected = selections .iter() @@ -202,10 +229,11 @@ impl CodeQueryEngine { let Some(selected) = selected else { continue; }; - let id_match = selected.id == *operand; - let exact = id_match - || normalize_symbol(&selected.name) == normalized - || normalize_symbol(&selected.qualified_name) == normalized; + let id_match = !concept_search && selected.id == *operand; + let exact = !concept_search + && (id_match + || normalize_symbol(&selected.name) == normalized + || normalize_symbol(&selected.qualified_name) == normalized); let (others, truncated) = backend.nodes_by_normalized_name(&normalized, 5)?; let alternatives = others .into_iter() @@ -230,7 +258,15 @@ impl CodeQueryEngine { }, rank: u32::try_from(seeds.len() + 1).unwrap_or(u32::MAX), matched_terms: vec![operand.clone()], - matched_fields: vec![format!("intent:{:?}", plan.intent())], + matched_fields: if concept_search { + typed + .results + .iter() + .find(|hit| hit.node_id == selected.id) + .map_or_else(Vec::new, |hit| hit.matched_fields.clone()) + } else { + vec![format!("intent:{:?}", plan.intent())] + }, source: selected.source.clone(), candidate_source: if id_match { DiscoverySeedSource::ExactId @@ -608,6 +644,108 @@ impl CodeQueryEngine { direction: DiscoveryDirection, limits: &DiscoveryLimits, guard: &DiscoveryGuard<'_>, + ) -> Result { + let mut selected = + self.indexed_lexical_candidates(backend, question, scope, direction, limits, guard)?; + if selected.candidates.iter().any(|candidate| { + matches!( + candidate.source, + DiscoverySeedSource::ExactId | DiscoverySeedSource::ExactName + ) + }) { + return Ok(selected); + } + let remaining = limits + .max_expanded_relationships + .saturating_sub(selected.expanded_relationships); + if remaining == 0 { + return Ok(selected); + } + guard.check()?; + let mut instrumentation = crate::telemetry::QueryInstrumentation::default(); + instrumentation.work.candidates_read = selected.nodes_read; + let recalled = self.search_concepts_instrumented( + compass_model::query_contract::SearchRequest { + query: question.to_owned(), + limits: compass_model::query_contract::CodeQueryLimits { + max_nodes: limits.max_candidates.min(64), + max_candidates: limits.max_candidates.min(64), + max_depth: limits.max_depth, + max_edges: u32::try_from(remaining.min(u64::from(limits.max_edges))) + .unwrap_or(u32::MAX), + max_response_bytes: limits.max_response_bytes, + ..Default::default() + }, + }, + &mut instrumentation, + &|node| discovery_scope_matches(node, scope), + )?; + guard.check()?; + selected.nodes_read = instrumentation.work.candidates_read; + selected.expanded_relationships = selected + .expanded_relationships + .saturating_add(instrumentation.work.edges_expanded); + let mut concepts = Vec::new(); + for hit in &recalled.results { + guard.check()?; + let matched = recalled + .concept_matches + .iter() + .filter(|item| item.node_id == hit.node_id) + .collect::>(); + if matched.is_empty() { + continue; + } + let Some(node) = backend.node_by_id(&hit.node_id)? else { + continue; + }; + if !discovery_scope_matches(&node, scope) { + continue; + } + let mut fields = hit.matched_fields.clone(); + fields.extend(matched.iter().map(|item| { + format!( + "approximate:{:?}:{}→{}", + item.method, item.query, item.matched + ) + })); + concepts.push(RankedDiscoveryCandidate { + node, + score: hit.score, + channel_rank: 0, + relation_evidence: None, + operation_root: None, + matched_terms: matched.iter().map(|item| item.matched.clone()).collect(), + matched_fields: fields, + source: DiscoverySeedSource::Fuzzy, + }); + } + if !concepts.is_empty() { + let ids = concepts + .iter() + .map(|candidate| candidate.node.id.clone()) + .collect::>(); + selected + .candidates + .retain(|candidate| !ids.contains(&candidate.node.id)); + concepts.extend(selected.candidates); + selected.truncated |= recalled.truncated + || concepts.len() > usize::try_from(limits.max_candidates).unwrap_or(usize::MAX); + concepts.truncate(usize::try_from(limits.max_candidates).unwrap_or(usize::MAX)); + selected.candidates = concepts; + selected.ambiguity_complete &= !recalled.truncated; + } + Ok(selected) + } + + fn indexed_lexical_candidates( + &self, + backend: &PinnedDiscoveryBackend<'_>, + question: &str, + scope: &[DiscoveryScope], + direction: DiscoveryDirection, + limits: &DiscoveryLimits, + guard: &DiscoveryGuard<'_>, ) -> Result { guard.check()?; let prepared = self.prepare_discovery_query(question)?; @@ -2819,6 +2957,8 @@ mod tests { search_query_cache: std::sync::Mutex::new(SearchQueryCache::default()), fuzzy_lookup_cache: std::sync::Mutex::new(FuzzyLookupCache::default()), deadline: None, + semantic_search: false, + semantic_index: std::sync::Mutex::new(None), } } diff --git a/crates/compass-query/src/index.rs b/crates/compass-query/src/index.rs index 1be0a654..56a2159e 100644 --- a/crates/compass-query/src/index.rs +++ b/crates/compass-query/src/index.rs @@ -27,7 +27,7 @@ use crate::graph_engine::{ read_store_ref, }; -const INDEX_FORMAT_VERSION: &str = "compass-code-index/1"; +const INDEX_FORMAT_VERSION: &str = "compass-code-index/2"; /// Selects the source used to hydrate the typed query engine. #[derive(Clone, Copy, Debug, Eq, PartialEq)] @@ -349,22 +349,16 @@ fn open_from_graph_engine( let index_dir = cache_root.join("code-query").join(&key); fs::create_dir_all(&index_dir).map_err(|error| io_error("create_index_dir", error))?; let index_path = index_dir.join("index.sqlite3"); - if index_path.exists() && !valid_index(&index_path, &key) { - fs::remove_file(&index_path).map_err(|error| io_error("remove_invalid_index", error))?; - } if !valid_index(&index_path, &key) { - build_with_lock(&index_path, &key, &graph, program.as_ref())?; - } - let connection = Connection::open_with_flags(&index_path, OpenFlags::SQLITE_OPEN_READ_ONLY) - .map_err(sql_error)?; - if !valid_connection(&connection, &key) { - drop(connection); if index_path.exists() { fs::remove_file(&index_path) - .map_err(|error| io_error("remove_corrupt_index", error))?; + .map_err(|error| io_error("remove_invalid_index", error))?; } build_with_lock(&index_path, &key, &graph, program.as_ref())?; } + // FTS5's integrity-check virtual-table operation needs a writable handle, + // even though it does not change the index. Validate the disposable cache + // before opening the query connection read-only. let connection = Connection::open_with_flags(&index_path, OpenFlags::SQLITE_OPEN_READ_ONLY) .map_err(sql_error)?; let adjacency = crate::code_query::CodeAdjacencyIndex::build(&graph); @@ -397,6 +391,8 @@ fn open_from_graph_engine( search_query_cache: std::sync::Mutex::new(Default::default()), fuzzy_lookup_cache: std::sync::Mutex::new(Default::default()), deadline: None, + semantic_search: false, + semantic_index: std::sync::Mutex::new(None), }) } @@ -423,6 +419,8 @@ fn open_from_local_store( search_query_cache: std::sync::Mutex::new(Default::default()), fuzzy_lookup_cache: std::sync::Mutex::new(Default::default()), deadline: None, + semantic_search: false, + semantic_index: std::sync::Mutex::new(None), }) } @@ -617,6 +615,7 @@ fn build_index( .copied(), ) .flat_map(identifier_search_terms) + .chain(compass_model::search::document_search_terms(node)) .collect::>() .into_iter() .collect::>() @@ -804,7 +803,7 @@ fn valid_index(path: &Path, key: &str) -> bool { if !path.is_file() { return false; } - Connection::open_with_flags(path, OpenFlags::SQLITE_OPEN_READ_ONLY) + Connection::open_with_flags(path, OpenFlags::SQLITE_OPEN_READ_WRITE) .ok() .is_some_and(|connection| valid_connection(&connection, key)) } diff --git a/crates/compass-query/src/intent.rs b/crates/compass-query/src/intent.rs index 0d28fe40..6f4a18e7 100644 --- a/crates/compass-query/src/intent.rs +++ b/crates/compass-query/src/intent.rs @@ -123,6 +123,7 @@ impl CodeQueryEngine { let mut operands = plan.operands.clone(); let mut selections = Vec::new(); let mut match_diagnostics = Vec::new(); + let mut concept_matches = Vec::new(); let mut match_truncated = false; if plan.routes_to_typed_query() && !matches!( @@ -131,7 +132,7 @@ impl CodeQueryEngine { ) { for operand in &mut operands { - let (selected, diagnostics, truncated) = self.select_natural_symbol( + let (selected, diagnostics, truncated, matched) = self.select_natural_symbol( operand, &request.question, &request.limits, @@ -142,6 +143,7 @@ impl CodeQueryEngine { *operand = selected; } match_diagnostics.extend(diagnostics); + concept_matches.extend(matched); match_truncated |= truncated; } } @@ -206,6 +208,9 @@ impl CodeQueryEngine { ) } }?; + concept_matches + .retain(|matched| response.nodes.iter().any(|node| node.id == matched.node_id)); + response.concept_matches.extend(concept_matches); response.diagnostics.extend(match_diagnostics); response.truncated |= match_truncated; let response = self.finish_natural_response(response)?; diff --git a/crates/compass-query/src/lib.rs b/crates/compass-query/src/lib.rs index 1502b6c4..c11a5f28 100644 --- a/crates/compass-query/src/lib.rs +++ b/crates/compass-query/src/lib.rs @@ -6,6 +6,7 @@ mod affected; mod benchmark; mod bm25; mod code_query; +mod concepts; mod cql; mod discovery; mod discovery_text; @@ -21,6 +22,7 @@ mod ranking; mod recall; mod relevance; mod score; +mod semantic_search; mod source; mod telemetry; mod text; diff --git a/crates/compass-query/src/natural_answers.rs b/crates/compass-query/src/natural_answers.rs index 9f7b41fe..38ee2714 100644 --- a/crates/compass-query/src/natural_answers.rs +++ b/crates/compass-query/src/natural_answers.rs @@ -5,8 +5,8 @@ use std::time::Instant; use compass_model::code_graph::{EdgeKind, NodeKind}; use compass_model::query_contract::{ - CodeQueryLimits, CodeQueryOperation, CodeQueryResponse, QueryDiagnostic, QueryDiagnosticCode, - QueryNode, SearchRequest, + CodeQueryLimits, CodeQueryOperation, CodeQueryResponse, ConceptMatch, QueryDiagnostic, + QueryDiagnosticCode, QueryNode, SearchRequest, }; use crate::QueryError; @@ -17,6 +17,13 @@ const NATURAL_ALTERNATIVES: usize = 4; const CONNECTIVITY_PROBE: usize = 32; const NATURAL_RANK_CANDIDATES: usize = 32; +type NaturalSymbolResolution = ( + Option, + Vec, + bool, + Vec, +); + impl CodeQueryEngine { pub(crate) fn select_natural_symbol( &self, @@ -24,11 +31,11 @@ impl CodeQueryEngine { question: &str, limits: &CodeQueryLimits, instrumentation: &mut QueryInstrumentation, - ) -> Result<(Option, Vec, bool), QueryError> { + ) -> Result { self.check_deadline()?; if let Some(node) = self.backend.node_by_id(operand)? { instrumentation.work.candidates_read += 1; - return Ok((Some(node.id), Vec::new(), false)); + return Ok((Some(node.id), Vec::new(), false, Vec::new())); } let normalized = normalize_symbol(operand); let (mut exact_nodes, exact_truncated) = self.backend.nodes_by_normalized_name( @@ -60,6 +67,7 @@ impl CodeQueryEngine { path: None, }], true, + Vec::new(), )); } if qualified.nodes.is_empty() && qualified.has_leaf_candidates { @@ -72,10 +80,12 @@ impl CodeQueryEngine { path: None, }], false, + Vec::new(), )); } exact_nodes = qualified.nodes; } + let mut concept_matches = Vec::new(); let has_exact = !exact_nodes.is_empty(); let (mut candidates, mut diagnostics, mut candidate_truncated) = if has_exact { ( @@ -94,6 +104,7 @@ impl CodeQueryEngine { }, instrumentation, )?; + concept_matches = search.concept_matches.clone(); let candidates = search .results .iter() @@ -102,7 +113,13 @@ impl CodeQueryEngine { .nodes .iter() .find(|node| node.id == hit.node_id) - .filter(|node| natural_fuzzy_relevant(operand, node)) + .filter(|node| { + natural_fuzzy_relevant(operand, node) + || search + .concept_matches + .iter() + .any(|matched| matched.node_id == node.id) + }) .map(|node| (node.clone(), hit.score)) }) .collect(); @@ -171,7 +188,7 @@ impl CodeQueryEngine { .then_with(|| left.0.id.cmp(&right.0.id)) }); let Some((selected, ..)) = ranked.first() else { - return Ok((None, diagnostics, candidate_truncated)); + return Ok((None, diagnostics, candidate_truncated, Vec::new())); }; let alternatives = ranked .iter() @@ -199,7 +216,13 @@ impl CodeQueryEngine { node_id: Some(selected.id.clone()), path: None, }); } - Ok((Some(selected.id.clone()), diagnostics, candidate_truncated)) + concept_matches.retain(|matched| matched.node_id == selected.id); + Ok(( + Some(selected.id.clone()), + diagnostics, + candidate_truncated, + concept_matches, + )) } pub(crate) fn natural_dependencies( diff --git a/crates/compass-query/src/semantic_search.rs b/crates/compass-query/src/semantic_search.rs new file mode 100644 index 00000000..8492e443 --- /dev/null +++ b/crates/compass-query/src/semantic_search.rs @@ -0,0 +1,381 @@ +//! Optional native latent-semantic analysis (LSA), learned from this graph only. +//! TF-IDF rows are projected onto deterministic truncated-SVD directions. No +//! hash vectors, remote model, credentials or runtime download are involved. +use crate::code_query::{CodeGraphBackend, CodeQueryEngine}; +use crate::{QueryError, QueryErrorKind}; +use compass_model::code_graph::{NodeDetails, NodeRecord}; +use std::collections::{BTreeMap, BTreeSet}; + +const MAX_NODES: usize = 32_768; +const MAX_BYTES: usize = 64 * 1024 * 1024; +const MAX_TERMS: usize = 8_192; +const MAX_NONZERO: usize = 1_000_000; +const MAX_TEXT_CHARS: usize = 8_192; +const DIMENSIONS: usize = 16; +const ITERATIONS: usize = 12; +const MIN_SIMILARITY: f64 = 0.25; + +struct BoundedCounter(usize); +impl std::io::Write for BoundedCounter { + fn write(&mut self, buffer: &[u8]) -> std::io::Result { + self.0 = self.0.saturating_add(buffer.len()); + if self.0 > MAX_BYTES { + return Err(std::io::Error::other("semantic corpus exceeds 64 MiB")); + } + Ok(buffer.len()) + } + fn flush(&mut self) -> std::io::Result<()> { + Ok(()) + } +} + +pub(crate) struct SemanticIndex { + nodes: Vec, + vocabulary: BTreeMap, + directions: Vec>, + embeddings: Vec>, + rows: Vec>, +} + +fn limit(detail: &str) -> QueryError { + QueryError::new( + QueryErrorKind::ExpansionLimit, + "semantic_corpus_limit", + format!( + "Local semantic index {detail}; extract a smaller scoped graph or omit --semantic-search" + ), + ) +} + +fn corpus_text(node: &NodeRecord) -> String { + let mut text = format!("{} {}", node.name, node.qualified_name); + // Python's published rationale names retain bounded docstring excerpts; + // document content retains full source-backed Markdown prose within caps. + if let Some(NodeDetails::Document(details)) = &node.details { + if let Some(section) = &details.section { + text.push(' '); + text.push_str(section); + } + if let Some(content) = &details.content { + text.push(' '); + text.extend(content.chars().take(MAX_TEXT_CHARS)); + } + } + if let Some(NodeDetails::Resource(details)) = &node.details + && let Some(content) = &details.content + { + text.push(' '); + text.extend(content.chars().take(MAX_TEXT_CHARS)); + } + text +} + +fn norm(vector: &mut [f64]) -> bool { + let size = vector.iter().map(|v| v * v).sum::().sqrt(); + if size <= 1e-10 || !size.is_finite() { + return false; + } + for v in vector { + *v /= size; + } + true +} + +fn orthogonalize(vector: &mut [f64], directions: &[Vec]) { + for basis in directions { + let dot = vector.iter().zip(basis).map(|(a, b)| a * b).sum::(); + for (value, basis) in vector.iter_mut().zip(basis) { + *value -= dot * basis; + } + } +} + +impl SemanticIndex { + fn build( + nodes: Vec, + check: impl Fn() -> Result<(), QueryError>, + ) -> Result { + let mut frequencies = BTreeMap::::new(); + let mut documents = Vec::new(); + let mut nonzero = 0; + for node in &nodes { + check()?; + let tokens = crate::query_terms(&corpus_text(node)) + .into_iter() + .take(512) + .collect::>(); + nonzero += tokens.len(); + if nonzero > MAX_NONZERO { + return Err(limit("exceeds 1,000,000 sparse entries")); + } + for token in &tokens { + *frequencies.entry(token.clone()).or_default() += 1; + } + documents.push(tokens); + } + if frequencies.len() > MAX_TERMS { + return Err(limit("exceeds 8,192 terms")); + } + let vocabulary = frequencies + .into_iter() + .enumerate() + .map(|(index, (term, count))| { + let idf = ((nodes.len() as f64 + 1.0) / (count as f64 + 1.0)).ln() + 1.0; + (term, (index, idf)) + }) + .collect::>(); + let matrix = documents + .into_iter() + .map(|terms| { + let mut row = terms + .into_iter() + .filter_map(|term| vocabulary.get(&term).copied()) + .collect::>(); + let size = row.iter().map(|(_, v)| v * v).sum::().sqrt(); + if size > 0.0 { + for (_, value) in &mut row { + *value /= size; + } + } + row + }) + .collect::>(); + let mut directions: Vec> = Vec::new(); + // Power iteration of A^T A with reorthogonalization. Integer seed + // arithmetic and ordered sparse rows make equivalent inputs stable. + for component in 0..DIMENSIONS + .min(vocabulary.len()) + .min(nodes.len().isqrt().max(1)) + { + let mut vector = (0..vocabulary.len()) + .map(|index| { + let seed = (index as u64 + 1) + .wrapping_mul(6364136223846793005) + .wrapping_add((component as u64).wrapping_mul(1442695040888963407)); + ((seed >> 32) as f64 / u32::MAX as f64) - 0.5 + }) + .collect::>(); + orthogonalize(&mut vector, &directions); + if !norm(&mut vector) { + break; + } + for _ in 0..ITERATIONS { + check()?; + let mut next = vec![0.0; vocabulary.len()]; + for row in &matrix { + let dot = row + .iter() + .map(|(index, weight)| vector[*index] * weight) + .sum::(); + for (index, weight) in row { + next[*index] += dot * weight; + } + } + orthogonalize(&mut next, &directions); + if !norm(&mut next) { + break; + } + vector = next; + } + // Degenerate directions do not supply arbitrary similarity. + let energy = matrix + .iter() + .map(|row| row.iter().map(|(i, w)| vector[*i] * w).sum::().powi(2)) + .sum::(); + if energy <= 1e-8 { + continue; + } + directions.push(vector); + } + let embeddings = matrix + .iter() + .map(|row| { + let mut embedding = directions + .iter() + .map(|basis| row.iter().map(|(i, w)| basis[*i] * w).sum()) + .collect::>(); + norm(&mut embedding); + embedding + }) + .collect(); + Ok(Self { + nodes, + vocabulary, + directions, + embeddings, + rows: matrix, + }) + } + + fn search(&self, query: &str, max_nodes: u32) -> Vec<(NodeRecord, f64)> { + let terms = crate::query_terms(query) + .into_iter() + .filter_map(|term| self.vocabulary.get(&term).copied()) + .collect::>(); + let query_indices = terms.keys().copied().collect::>(); + let bridges = self + .rows + .iter() + .filter(|row| row.iter().any(|(index, _)| query_indices.contains(index))) + .flat_map(|row| row.iter().map(|(index, _)| *index)) + .collect::>(); + let mut vector = self + .directions + .iter() + .map(|basis| terms.iter().map(|(i, w)| basis[*i] * w).sum()) + .collect::>(); + if !norm(&mut vector) { + return Vec::new(); + } + let mut scores = self + .embeddings + .iter() + .enumerate() + .filter_map(|(index, embedding)| { + if !self.rows[index] + .iter() + .any(|(index, _)| bridges.contains(index)) + { + return None; + } + let similarity = vector + .iter() + .zip(embedding) + .map(|(a, b)| a * b) + .sum::(); + let similarity = (similarity.clamp(-1.0, 1.0) * 1_000_000.0).round() / 1_000_000.0; + (similarity >= MIN_SIMILARITY).then_some((index, similarity)) + }) + .collect::>(); + scores.sort_by(|(a, ascore), (b, bscore)| { + bscore + .total_cmp(ascore) + .then_with(|| self.nodes[*a].id.cmp(&self.nodes[*b].id)) + }); + scores + .into_iter() + .take(usize::try_from(max_nodes).unwrap_or(usize::MAX).min(8)) + .map(|(index, score)| (self.nodes[index].clone(), score)) + .collect() + } +} + +impl CodeQueryEngine { + pub(crate) fn semantic_candidates( + &self, + query: &str, + max_nodes: u32, + ) -> Result, QueryError> { + self.check_deadline()?; + let mut cache = self + .semantic_index + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner); + if cache.is_none() { + let mut nodes = match &self.backend { + CodeGraphBackend::Materialized { graph, .. } => { + if graph.nodes.len() > MAX_NODES { + return Err(limit("exceeds 32,768 nodes")); + } + serde_json::to_writer(BoundedCounter(0), &graph.nodes) + .map_err(|error| limit(&error.to_string()))?; + graph.nodes.clone() + } + CodeGraphBackend::Store(snapshot) => snapshot + .reader()? + .nodes(compass_graph::SnapshotReadLimits { + max_items: MAX_NODES, + max_objects: MAX_NODES, + max_bytes: MAX_BYTES, + ..Default::default() + }) + .map_err(|error| limit(&format!("cannot read bounded corpus: {error}")))?, + }; + nodes.sort_by(|a, b| a.id.cmp(&b.id)); + // Publish the cache only after successful, bounded construction. + let index = SemanticIndex::build(nodes, || self.check_deadline())?; + self.check_deadline()?; + *cache = Some(index); + } + Ok(cache + .as_ref() + .map_or_else(Vec::new, |index| index.search(query, max_nodes))) + } +} + +#[cfg(test)] +mod tests { + use super::*; + use compass_model::code_graph::NodeKind; + + fn node(id: &str, text: &str) -> NodeRecord { + NodeRecord { + id: id.into(), + kind: NodeKind::Class, + roles: Vec::new(), + name: text.into(), + qualified_name: text.into(), + language: None, + framework: None, + source: None, + details: None, + evidence: Vec::new(), + coverage: Vec::new(), + diagnostics: Vec::new(), + community: None, + } + } + + #[test] + fn latent_embeddings_bridge_corpus_terms_but_not_disconnected_or_unknown_concepts() + -> Result<(), QueryError> { + let corpus = vec![ + node("orchard", "orchard apples harvest"), + node("fruit", "fruit apples harvest"), + node("billing", "invoice payment refund"), + ]; + let index = SemanticIndex::build(corpus.clone(), || Ok(()))?; + let result = index.search("orchard", 3); + assert!( + result.iter().any(|(node, _)| node.id == "fruit"), + "{result:?}" + ); + assert!(result.iter().all(|(node, _)| node.id != "billing")); + assert!(index.search("absentvocabulary", 3).is_empty()); + let repeated = SemanticIndex::build(corpus, || Ok(()))?; + assert_eq!(index.directions, repeated.directions); + assert_eq!(index.embeddings, repeated.embeddings); + Ok(()) + } + + #[test] + fn excessive_vocabulary_is_an_explicit_limit_error() { + let corpus = (0..20) + .map(|row| { + node( + &format!("node{row}"), + &(0..500) + .map(|term| format!("v{}x", row * 500 + term)) + .collect::>() + .join(" "), + ) + }) + .collect(); + let result = SemanticIndex::build(corpus, || Ok(())); + assert!( + matches!(result, Err(error) if error.kind() == QueryErrorKind::ExpansionLimit && error.code() == "semantic_corpus_limit") + ); + } + + #[test] + fn semantic_build_deadline_failure_does_not_return_an_empty_index() { + let error = SemanticIndex::build(vec![node("fruit", "fruit apples")], || { + Err(QueryError::new( + QueryErrorKind::Timeout, + "timeout", + "expired", + )) + }); + assert!(matches!(error, Err(error) if error.kind() == QueryErrorKind::Timeout)); + } +} diff --git a/crates/compass-query/tests/concept_search.rs b/crates/compass-query/tests/concept_search.rs new file mode 100644 index 00000000..b2a26049 --- /dev/null +++ b/crates/compass-query/tests/concept_search.rs @@ -0,0 +1,441 @@ +mod support; +use compass_model::code_graph::{GraphDocument, NodeKind}; +use compass_model::query_contract::{CodeQueryLimits, ConceptMatchMethod, SearchRequest}; +use compass_query::{EngineSelection, NaturalQueryRequest, open_with_engine}; +use std::{error::Error, fs}; + +fn request(question: &str) -> NaturalQueryRequest { + NaturalQueryRequest { + question: question.into(), + include_heuristic: false, + limits: CodeQueryLimits::default(), + } +} + +#[test] +fn thirty_business_questions_find_expected_modules() -> Result<(), Box> { + let dir = tempfile::tempdir()?; + let path = dir.path().join("graph.json"); + support::write_graph(&path)?; + let mut graph = GraphDocument::load(&path)?; + // Business vocabulary is deliberately absent from these code identifiers. + // The oracle names the intended declaration, not just a nonempty response. + let cases = [ + ("How does authorization work?", "AuthzGate"), + ("Where is access control enforced?", "AuthzGate"), + ("What handles permissions?", "PermissionDeniedError"), + ("How does authentication work?", "LoginHandler"), + ("Where can a user sign in?", "LoginHandler"), + ("Where is configuration read?", "SettingsLoader"), + ("How are environment variables read?", "SettingsLoader"), + ("What handles persistence?", "RecordRepository"), + ("Where is database access implemented?", "RecordRepository"), + ("What handles input checking?", "SchemaValidator"), + ("Where does validation happen?", "SchemaValidator"), + ("How does rate limiting work?", "QuotaLimiter"), + ("What implements request throttling?", "QuotaLimiter"), + ("Where do background jobs run?", "QueueWorker"), + ("What handles job scheduling?", "QueueWorker"), + ("How is caching implemented?", "CacheEvictor"), + ("Where does cache invalidation happen?", "CacheEvictor"), + ("What handles database transactions?", "UowSession"), + ("Where are feature flags checked?", "ToggleReader"), + ("How does observability work?", "TelemetryMetrics"), + ("Where is synchronization implemented?", "MutexLock"), + ("What handles serialization?", "WireCodec"), + ("What handles transient failures?", "BackoffRetry"), + ("How are timeouts handled?", "DeadlineGuard"), + ("Where is encryption implemented?", "CipherBox"), + ("What handles file uploads?", "MultipartUpload"), + ("How does email delivery work?", "SmtpMail"), + ("What implements pagination?", "CursorPage"), + ("Where are payments handled?", "StripeInvoice"), + ("What handles container orchestration?", "KubernetesDeploy"), + ]; + for (_, name) in cases { + if graph.nodes.iter().all(|node| node.id != name) { + graph.nodes.push(support::node( + name, + NodeKind::Class, + name, + &format!("production.{name}"), + )); + } + } + fs::write(&path, serde_json::to_vec(&graph)?)?; + let engine = open_with_engine( + &path, + None, + &dir.path().join("cache"), + EngineSelection::Json, + )?; + let mut failures = vec![]; + for (question, expected) in cases { + let response = engine.query_natural(request(question))?; + if !response + .results + .iter() + .take(5) + .any(|hit| hit.node_id == expected) + { + failures.push(format!( + "{question}: expected {expected}; hits={:?}", + response.results + )); + } + assert!( + response + .concept_matches + .iter() + .any(|matched| matched.method == ConceptMatchMethod::Synonym), + "{question}" + ); + assert_eq!( + response, + engine.query_natural(request(question))?, + "{question}" + ); + } + assert!( + failures.is_empty(), + "{} / 30 missed:\n{}", + failures.len(), + failures.join("\n") + ); + // Strict lookup never admits concept alternatives, even with semantic opt-in. + let exact = engine.with_semantic_search(true).search_exact( + SearchRequest { + query: "authorization".into(), + limits: Default::default(), + }, + Default::default(), + )?; + assert!(exact.nodes.is_empty()); + assert!(exact.concept_matches.is_empty()); + Ok(()) +} + +#[test] +fn markdown_prose_reaches_only_witnessed_code_mentions_with_backend_parity() +-> Result<(), Box> { + use compass_graph::{ + GraphSnapshotBuilder, RawNodeRecord, build_from_extraction, normalize_document_v1, + }; + use compass_languages::Engine; + use compass_store::{STORE_FILE_NAME, STORE_REF_FILE_NAME, SqliteStore}; + use serde_json::{Map, json}; + let dir = tempfile::tempdir()?; + let root = dir.path(); + let doc = root.join("README.md"); + fs::write(root.join("impl.rs"), "pub struct DeactivationEvaluator;\n")?; + // The concept occurs past the display-name limit and must be indexed from + // source-backed Markdown content rather than the paragraph's short label. + fs::write( + &doc, + format!( + "# Account lifecycle\n\n{} Account suspension is implemented by `DeactivationEvaluator`. Unavailable `GhostEvaluator` is not linked.\n", + "Context. ".repeat(75) + ), + )?; + let mut raw = Engine::default().extract(&doc)?; + raw.nodes.push(RawNodeRecord { id: "implementation".into(), attributes: Map::from_iter([ + ("label".into(), json!("DeactivationEvaluator")), ("qualified_name".into(), json!("app::DeactivationEvaluator")), + ("symbol_kind".into(), json!("struct")), ("file_type".into(), json!("code")), + ("language".into(), json!("rust")), ("extractor".into(), json!("test.rust")), + ("source_file".into(), json!("impl.rs")), + ("source_anchor".into(), json!({"file":"impl.rs","startByte":11,"endByte":32,"startLine":1,"startColumn":11,"endLine":1,"endColumn":32})), + ]) }); + let document = build_from_extraction(&raw, true, Some(root)); + let graph = normalize_document_v1(&document, root, "sha256:test", None)?; + let target = graph + .nodes + .iter() + .find(|node| node.name == "DeactivationEvaluator") + .ok_or("missing code")? + .id + .clone(); + assert!( + graph.links.iter().any(|edge| edge.target == target), + "published links missing: {:?}", + graph.links + ); + let path = root.join("graph.json"); + fs::write(&path, serde_json::to_vec(&graph)?)?; + let store = SqliteStore::open(root.join(STORE_FILE_NAME))?; + let prepared = GraphSnapshotBuilder::new().prepare(&store, &graph)?; + GraphSnapshotBuilder::new().activate(&store, &prepared)?; + fs::write( + root.join(STORE_REF_FILE_NAME), + serde_json::to_vec(&store.snapshot_reference()?)?, + )?; + store.checkpoint()?; + let mut responses = vec![]; + for kind in [EngineSelection::Json, EngineSelection::Store] { + let engine = open_with_engine(&path, None, &root.join(format!("{kind:?}-cache")), kind)?; + let response = engine.query_natural(request("How does account suspension work?"))?; + assert!( + response + .results + .iter() + .take(3) + .any(|hit| hit.node_id == target), + "{:?}", + response.results + ); + assert!( + response + .concept_matches + .iter() + .any(|matched| matched.node_id == target + && matched.method == ConceptMatchMethod::DocumentLink + && !matched.via.is_empty()) + ); + assert!(response.edges.iter().any(|edge| edge.target == target)); + assert!( + !response + .results + .iter() + .any(|hit| hit.node_id.contains("GhostEvaluator")) + ); + responses.push(response); + } + assert_eq!(responses[0], responses[1]); + Ok(()) +} + +#[test] +fn semantic_fallback_is_opt_in_cached_and_follows_document_evidence() -> Result<(), Box> +{ + use compass_model::code_graph::{EdgeKind, NodeDetails, ResourceKind, ResourceNodeDetails}; + let dir = tempfile::tempdir()?; + let path = dir.path().join("graph.json"); + support::write_graph(&path)?; + let mut graph = GraphDocument::load(&path)?; + let mut edge = graph.links.first().ok_or("missing fixture edge")?.clone(); + graph.nodes.clear(); + graph.links.clear(); + for (id, content) in [ + ("doc-a", "orchard apples harvest"), + ("doc-b", "fruit apples harvest"), + ] { + let mut doc = support::node(id, NodeKind::Resource, "Notes", id); + doc.details = Some(NodeDetails::Resource(ResourceNodeDetails { + resource_kind: ResourceKind::Document, + uri: None, + media_type: Some("text/markdown".into()), + content: Some(content.into()), + })); + graph.nodes.push(doc); + } + graph.nodes.push(support::node( + "impl", + NodeKind::Class, + "FruitHandler", + "production.FruitHandler", + )); + graph.nodes.push(support::node( + "other", + NodeKind::Class, + "InvoicePayment", + "production.InvoicePayment", + )); + edge.kind = EdgeKind::References; + edge.source = "doc-b".into(); + edge.target = "impl".into(); + edge.details = None; + edge.occurrence_rule = None; + edge.id = compass_model::identity::edge_id( + "doc-b", + EdgeKind::References, + "impl", + edge.relationship_site.as_ref(), + None, + ); + edge.key = edge.id.clone(); + graph.links.push(edge); + fs::write(&path, serde_json::to_vec(&graph)?)?; + let mut engine = open_with_engine( + &path, + None, + &dir.path().join("cache"), + EngineSelection::Json, + )?; + let default = engine.query_natural(request("orchard"))?; + assert!(!default.results.iter().any(|hit| hit.node_id == "impl")); + assert!(default.concept_matches.is_empty()); + engine.set_semantic_search(true); + let approximate = engine.query_natural(request("orchard"))?; + assert!( + approximate.results.iter().any(|hit| hit.node_id == "impl"), + "{approximate:?}" + ); + assert!( + approximate + .concept_matches + .iter() + .any(|item| item.method == ConceptMatchMethod::SemanticLsa) + ); + assert!( + approximate + .concept_matches + .iter() + .any(|item| item.node_id == "impl" && item.method == ConceptMatchMethod::DocumentLink) + ); + assert!(approximate.results.iter().all(|hit| hit.node_id != "other")); + assert_eq!(approximate, engine.query_natural(request("orchard"))?); + engine.set_semantic_search(false); + assert_eq!(default, engine.query_natural(request("orchard"))?); + engine.set_semantic_search(true); + assert!( + engine + .query_natural(request("absentvocabulary"))? + .results + .is_empty() + ); + Ok(()) +} + +#[test] +fn scoped_discovery_retains_filters_and_labels_concept_seeds() -> Result<(), Box> { + use compass_model::query_contract::{ + DiscoveryDirection, DiscoveryLimits, DiscoveryQueryRequest, DiscoveryScope, + DiscoveryScopeKind, DiscoveryTraversal, + }; + let dir = tempfile::tempdir()?; + let path = dir.path().join("graph.json"); + support::write_graph(&path)?; + let mut graph = GraphDocument::load(&path)?; + graph.nodes.push(support::node( + "gate", + NodeKind::Class, + "AuthzGate", + "production.AuthzGate", + )); + for i in 0..100 { + let mut competitor = support::node( + &format!("other-{i:03}"), + NodeKind::Class, + "AuthzGate", + "unrelated.AuthzGate", + ); + if let Some(source) = &mut competitor.source { + source.file = "src/payments/gateway.rs".into(); + } + graph.nodes.push(competitor); + } + fs::write(&path, serde_json::to_vec(&graph)?)?; + let engine = open_with_engine( + &path, + None, + &dir.path().join("cache"), + EngineSelection::Json, + )?; + let response = engine.discover(DiscoveryQueryRequest { + question: "How does authorization work?".into(), + direction: DiscoveryDirection::Outgoing, + include_heuristic: false, + scope: vec![DiscoveryScope { + kind: DiscoveryScopeKind::Source, + value: "src/lib.rs".into(), + }], + relation_contexts: vec![], + traversal: DiscoveryTraversal::Bfs, + limits: DiscoveryLimits::default(), + })?; + assert!( + response.seeds.iter().any(|seed| seed.node_id == "gate" + && seed + .matched_fields + .iter() + .any(|field| field.contains("Synonym"))), + "{response:?}" + ); + assert_eq!(response.selected_direction, DiscoveryDirection::Outgoing); + assert!(response.nodes.iter().all(|node| { + node.source + .as_ref() + .is_some_and(|source| source.file == "src/lib.rs") + })); + Ok(()) +} + +#[test] +fn concept_recall_prefers_implementations_over_fields_and_incidental_doc_links() +-> Result<(), Box> { + use compass_model::code_graph::{EdgeKind, NodeDetails, ResourceKind, ResourceNodeDetails}; + let dir = tempfile::tempdir()?; + let path = dir.path().join("graph.json"); + support::write_graph(&path)?; + let mut graph = GraphDocument::load(&path)?; + for i in 0..80 { + graph.nodes.push(support::node( + &format!("parameter-{i}"), + NodeKind::Parameter, + "auth", + &format!("fixture.{i}.auth"), + )); + } + for name in ["AuthzGate", "DbConnection", "RateLimit"] { + graph.nodes.push(support::node( + name, + NodeKind::Class, + name, + &format!("production.{name}"), + )); + } + let mut doc = support::node( + "incidental-doc", + NodeKind::Resource, + "A tool-specific policy authorization status", + "Notes", + ); + doc.details = Some(NodeDetails::Resource(ResourceNodeDetails { + resource_kind: ResourceKind::Rationale, + uri: None, + media_type: None, + content: Some(doc.name.clone()), + })); + graph.nodes.push(doc); + let mut edge = graph.links[0].clone(); + edge.kind = EdgeKind::Documents; + edge.source = "incidental-doc".into(); + edge.target = "n:listing".into(); + edge.occurrence_rule = None; + edge.details = None; + edge.id = compass_model::identity::edge_id( + &edge.source, + edge.kind, + &edge.target, + edge.relationship_site.as_ref(), + None, + ); + edge.key = edge.id.clone(); + graph.links.push(edge); + fs::write(&path, serde_json::to_vec(&graph)?)?; + let engine = open_with_engine( + &path, + None, + &dir.path().join("cache"), + EngineSelection::Json, + )?; + for (question, expected) in [ + ("How does authorization work?", "AuthzGate"), + ("What handles persistence?", "DbConnection"), + ("How does rate limiting work?", "RateLimit"), + ] { + let response = engine.query_natural(request(question))?; + assert_eq!( + response.results.first().map(|hit| hit.node_id.as_str()), + Some(expected), + "{question}: {:?}", + response.results + ); + assert!( + response + .concept_matches + .iter() + .any(|item| item.node_id == expected && item.method == ConceptMatchMethod::Synonym) + ); + } + Ok(()) +} diff --git a/crates/compass-query/tests/store_engine.rs b/crates/compass-query/tests/store_engine.rs index 19fb309b..1c214951 100644 --- a/crates/compass-query/tests/store_engine.rs +++ b/crates/compass-query/tests/store_engine.rs @@ -1578,7 +1578,7 @@ fn explicit_json_selection_survives_a_corrupt_store_sidecar() } #[test] -fn provisional_json_index_is_rebuilt_to_v1() -> Result<(), Box> { +fn unknown_json_index_is_rebuilt_to_current_format() -> Result<(), Box> { let directory = tempfile::tempdir()?; let graph_path = directory.path().join("graph.json"); support::write_graph(&graph_path)?; @@ -1601,7 +1601,7 @@ fn provisional_json_index_is_rebuilt_to_v1() -> Result<(), Box Result<(), Box Result<(), Box> { + let directory = tempfile::tempdir()?; + let graph_path = directory.path().join("graph.json"); + support::write_graph(&graph_path)?; + let cache = directory.path().join("cache"); + let engine = open_with_engine(&graph_path, None, &cache, EngineSelection::Json)?; + let index_path = engine.index_path().to_path_buf(); + drop(engine); + let connection = rusqlite::Connection::open(&index_path)?; + connection.execute( + "INSERT INTO metadata VALUES('reuse_marker', 'preserved')", + [], + )?; + drop(connection); + let reopened = open_with_engine(&graph_path, None, &cache, EngineSelection::Json)?; + assert_eq!(reopened.index_path(), index_path); + let connection = rusqlite::Connection::open(index_path)?; + let marker: String = connection.query_row( + "SELECT value FROM metadata WHERE key='reuse_marker'", + [], + |row| row.get(0), + )?; + assert_eq!(marker, "preserved"); + Ok(()) +} diff --git a/docs/README.md b/docs/README.md index c3542c50..56b17ea9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -115,6 +115,7 @@ They are not evidence that an uncompleted design has shipped. | [Community detection quality technical design](implementation/community-detection-quality-technical-design.md) | Versioned topology, shared quality evidence, native Leiden, bounded selection, and incremental rollout | | [Community detection quality qualification](implementation/community-detection-quality-qualification.md) | Fixture results, performance decision, and remaining corpus evidence | | [Python call and impact qualification](implementation/python-call-impact-qualification.md) | Pinned Dify source-call capture and direct-connection audits | +| [Concept search qualification](implementation/concept-search-qualification.md) | Pinned novice-style module retrieval, approximate provenance, and local semantic fixtures | | [Agent query evaluation](implementation/agent-query-evaluation-2026-09-23.md) | Five-repository Compass/Graphify question suite, graph-anchor results, token cost, and remaining gaps | | [Query recall and accuracy design](implementation/query-recall-accuracy/query-performance-accuracy-recall-phased-technical-design.md) | Phased query-quality architecture, evidence, and rollout boundaries | | [Query implementation plans](plans/README.md) | Ordered, independently executable query-quality work plans | diff --git a/docs/implementation/concept-search-qualification.json b/docs/implementation/concept-search-qualification.json new file mode 100644 index 00000000..630502b5 --- /dev/null +++ b/docs/implementation/concept-search-qualification.json @@ -0,0 +1,341 @@ +{ + "schema": "compass.concept-qualification-report/1", + "repository": "https://github.com/langgenius/dify", + "commit": "1a918ea407990ecd2156af2614932db8c9c43091", + "correct_top_one": 16, + "correct_top_three": 26, + "questions": 30, + "minimum_correct": 24, + "cases": [ + { + "question": "How does authorization work?", + "top_paths": [ + "libs/workspace_permission.py", + "services/plugin/plugin_permission_service.py", + "extensions/storage/clickzetta_volume/volume_permissions.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "Where is access control enforced?", + "top_paths": [ + "libs/workspace_permission.py", + "services/plugin/plugin_permission_service.py", + "extensions/storage/clickzetta_volume/volume_permissions.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "What checks workspace permissions?", + "top_paths": [ + "libs/workspace_permission.py", + "services/knowledge/dataset_access.py", + "services/workspace/service.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "How does authentication work?", + "top_paths": [ + "extensions/ext_login.py", + "libs/login.py", + "libs/oauth.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "Where does a user sign in?", + "top_paths": [ + "extensions/ext_login.py", + "libs/login.py", + "libs/oauth.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "What handles OAuth authentication?", + "top_paths": [ + "libs/oauth_bearer.py", + "libs/oauth.py", + "repositories/oauth_access_token_repository.py" + ], + "top_one": false, + "top_three": true, + "truncated": true + }, + { + "question": "Where is configuration loaded?", + "top_paths": [ + "configs/app_config.py", + "configs/middleware/vdb/elasticsearch_config.py", + "configs/middleware/vdb/opengauss_config.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "How are environment variables read?", + "top_paths": [ + "configs/app_config.py", + "configs/middleware/vdb/elasticsearch_config.py", + "migrations/env.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "What handles persistence?", + "top_paths": [ + "libs/db_migration_lock.py", + "extensions/ext_database.py", + "repositories/explore_banner_query_repository.py" + ], + "top_one": false, + "top_three": true, + "truncated": true + }, + { + "question": "Where is database access implemented?", + "top_paths": [ + "libs/db_migration_lock.py", + "extensions/ext_database.py", + "services/rag_pipeline/pipeline_template/database/database_retrieval.py" + ], + "top_one": false, + "top_three": true, + "truncated": true + }, + { + "question": "Where is uploaded file validation implemented?", + "top_paths": [ + "libs/validators.py", + "core/workflow/nodes/agent_v2/file_tenant_validator.py", + "factories/file_factory/validation.py" + ], + "top_one": false, + "top_three": true, + "truncated": true + }, + { + "question": "What implements request throttling?", + "top_paths": [ + "libs/rate_limit.py", + "core/app/features/rate_limiting/rate_limit.py", + "migrations/versions/2025_01_14_0617-f051706725cc_add_rate_limit_logs.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "How does rate limiting work?", + "top_paths": [ + "libs/rate_limit.py", + "core/app/features/rate_limiting/rate_limit.py", + "migrations/versions/2025_01_14_0617-f051706725cc_add_rate_limit_logs.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "Where do background jobs run?", + "top_paths": [ + "libs/schedule_utils.py", + "services/workflow/scheduler.py", + "services/trigger/schedule_service.py" + ], + "top_one": false, + "top_three": false, + "truncated": true + }, + { + "question": "How are recurring jobs scheduled?", + "top_paths": [ + "libs/schedule_utils.py", + "services/trigger/schedule_service.py", + "schedule/workflow_schedule_task.py" + ], + "top_one": false, + "top_three": true, + "truncated": true + }, + { + "question": "How does caching work?", + "top_paths": [ + "extensions/ext_redis.py", + "core/helper/provider_cache.py", + "core/helper/tool_parameter_cache.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "What handles database transactions?", + "top_paths": [ + "core/db/session_factory.py", + "extensions/ext_oauth_bearer.py", + "core/app/apps/advanced_chat/generate_task_pipeline.py" + ], + "top_one": false, + "top_three": false, + "truncated": true + }, + { + "question": "Where are feature flags checked?", + "top_paths": [ + "services/feature_service.py", + "services/feature_query_service.py", + "controllers/console/feature.py" + ], + "top_one": false, + "top_three": true, + "truncated": true + }, + { + "question": "How does observability work?", + "top_paths": [ + "extensions/ext_enterprise_telemetry.py", + "services/telemetry_service.py", + "tasks/enterprise_telemetry_task.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "Where is application logging configured?", + "top_paths": [ + "extensions/ext_request_logging.py", + "extensions/ext_logging.py", + "extensions/logstore/aliyun_logstore.py" + ], + "top_one": false, + "top_three": true, + "truncated": true + }, + { + "question": "What prevents simultaneous database migrations?", + "top_paths": [ + "libs/db_migration_lock.py", + "extensions/ext_redis.py", + "services/legacy_model_type_migration.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "What handles transient database failures?", + "top_paths": [ + "services/retention/workflow_run/db_retry.py", + "core/app/workflow/retry_history.py", + "tasks/retry_document_indexing_task.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "How are request timeouts configured?", + "top_paths": [ + "extensions/ext_redis.py", + "tasks/human_input_timeout_tasks.py", + "configs/enterprise/__init__.py" + ], + "top_one": false, + "top_three": true, + "truncated": true + }, + { + "question": "Where are stored credentials encrypted?", + "top_paths": [ + "libs/gmpy2_pkcs10aep_cipher.py", + "libs/rsa.py", + "services/data_source/credential_adapters.py" + ], + "top_one": false, + "top_three": true, + "truncated": true + }, + { + "question": "What handles file uploads?", + "top_paths": [ + "libs/file_utils.py", + "services/upload_file_delivery_service.py", + "services/plugin_file_upload_gateway.py" + ], + "top_one": false, + "top_three": false, + "truncated": true + }, + { + "question": "How does email delivery work?", + "top_paths": [ + "extensions/ext_mail.py", + "libs/smtp.py", + "libs/email_i18n.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "What implements result paging?", + "top_paths": [ + "libs/infinite_scroll_pagination.py", + "libs/pagination.py", + "services/enterprise/rbac_service.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + }, + { + "question": "Where are subscription payments handled?", + "top_paths": [ + "services/trigger/trigger_subscription_operator_service.py", + "services/trigger/trigger_subscription_builder_service.py", + "libs/broadcast_channel/redis/_subscription.py" + ], + "top_one": false, + "top_three": false, + "truncated": true + }, + { + "question": "Where are health checks implemented?", + "top_paths": [ + "extensions/ext_app_metrics.py", + "celery_healthcheck.py", + "extensions/ext_redis.py" + ], + "top_one": false, + "top_three": true, + "truncated": true + }, + { + "question": "How does data retention work?", + "top_paths": [ + "tasks/delete_conversation_task.py", + "events/event_handlers/clean_when_dataset_deleted.py", + "services/retention/workflow_run/delete_archived_workflow_run.py" + ], + "top_one": true, + "top_three": true, + "truncated": true + } + ] +} diff --git a/docs/implementation/concept-search-qualification.md b/docs/implementation/concept-search-qualification.md new file mode 100644 index 00000000..2d130032 --- /dev/null +++ b/docs/implementation/concept-search-qualification.md @@ -0,0 +1,95 @@ +# Concept search qualification + +Native concept recall reached the expected module among the first three +production source paths for **26 / 30 questions (86.7%)** on a freshly rebuilt pinned Dify graph. +The first path was correct for **16 / 30 questions (53.3%)**. This is module +retrieval evidence; it does not establish implementation equivalence or runtime +behavior, and approximate matches remain labelled as such. + +Input: [Dify at `1a918ea407990ecd2156af2614932db8c9c43091`](https://github.com/langgenius/dify/tree/1a918ea407990ecd2156af2614932db8c9c43091/api). +The checkout was read-only. The 30 novice-style questions were agent-authored; +the source-derived expected modules were fixed before the first query run. +They are not an independent human evaluation or a competitor comparison. +The checked-in [corpus](../../tests/qualification/concept-search-dify.json) +contains every question, expected path prefix, and the 24/30 acceptance threshold. +The [machine report](concept-search-qualification.json) retains each returned +module path, correctness judgment and truncation flag. + +## Measurements + +The criterion takes the first three distinct production source paths in native +result order, excluding tests, fixtures and mocks. A path must match a pinned +expected prefix. Nonempty results alone do not count as correct. First-path +accuracy is reported separately so the top-three criterion does not conceal +ranking limitations. + +The initial implementation found 4/30 expected modules. Ranking only the first +64 ID-ordered candidates improved this to 12/30, but still lost implementation +code behind parameters and data types. Bounded posting recall followed by +context, filename, implementation-kind and acronym-aware ranking reached 26/30. +No questions or expected modules were changed between these runs. A fresh +AST-v15 rebuild with retained rationale prose reproduced 26/30 and 16/30. + +Four questions still miss their expected module in the first three paths: + +- Background jobs: scheduler utilities and services outrank task execution. +- Database transactions: session factories outrank the expected database extension + or repositories. +- File uploads: utilities and plugin upload adapters outrank the general file + service/factory. +- Subscription payments: event-subscription code outranks the financial modules. + +Every answer disclosed candidate/response truncation under 32 retained nodes, +64 candidates per alternative, depth one and 1,000 relationship records. +Responses also disclose the published graph's partial coverage. The graph used native code-only extraction, maximum inference, +excluded `tests/**`, and omitted clustering and visualization. Optional semantic +search was disabled for this public-repository run. These results do not claim +performance, token-cost parity, transitive completeness or precise structural +resolution for approximate matches. + +## Native regression evidence + +`concept_search` tests check 30 business questions against intended declarations, +strict lookup, deterministic repeated responses, scoped discovery, and ranking +with distracting parameters. A fresh Markdown publication test puts the concept +past the short display label and follows only witnessed references to code, +with JSON/store parity and no fabricated missing-symbol target. + +The optional semantic fixture learns TF-IDF/truncated-SVD embeddings from a small +local corpus. It checks a vocabulary bridge, disconnected and unknown terms, +explicit opt-in, cache reuse, and resetting a cached engine to the default. +Unit tests cover deadline and vocabulary-limit errors. No remote model, credentials, +network service or vector database is used. Large corpora fail with a typed limit +error; this is not qualification of semantic quality on all of Dify. + +CLI and MCP regressions verify approximate provenance and strict lookup. Rust and +viewer decoders enforce the same 4 KiB UTF-8 prose boundary. The FTS cache test +preserves a marker across reopen, proving a valid index was reused rather than +silently rebuilt during validation. + +## Reproduce + +Set `CARGO_TARGET_DIR` to this checkout's external target directory as required by +`AGENTS.md`, `DIFY_API` to the pinned checkout's `api/`, and `QUALIFICATION_OUT` to +an artifact directory outside the source checkout. + +```bash +CARGO_TARGET_DIR="$CARGO_TARGET_DIR" cargo build --release --locked \ + -p compass-core --example republish_qualification \ + -p compass-query --example query_batch +"$CARGO_TARGET_DIR/release/examples/republish_qualification" \ + "$DIFY_API" "$QUALIFICATION_OUT" +python3 scripts/qualify_concept_search.py \ + tests/qualification/concept-search-dify.json > "$QUALIFICATION_OUT/requests.json" +"$CARGO_TARGET_DIR/release/examples/query_batch" \ + "$QUALIFICATION_OUT/compass-out/graph.json" \ + "$QUALIFICATION_OUT/requests.json" "$QUALIFICATION_OUT/responses.json" \ + "$QUALIFICATION_OUT/query-cache" +python3 scripts/qualify_concept_search.py \ + tests/qualification/concept-search-dify.json \ + --responses "$QUALIFICATION_OUT/responses.json" > "$QUALIFICATION_OUT/report.json" +``` + +The batch helper publishes its bounded response artifact atomically only after +all queries succeed. The evaluator exits unsuccessfully below the pinned +threshold. Source checkout and generated graph contents are not committed. diff --git a/docs/reference/commands.md b/docs/reference/commands.md index 2a668dcb..ba527b19 100644 --- a/docs/reference/commands.md +++ b/docs/reference/commands.md @@ -375,6 +375,40 @@ operation and returns `compass.query/1`. `--at REV` reads one immutable trusted revision graph; it does not fall back to a legacy projection. Rebuild a revision whose realization does not contain the current trusted graph contract. +Concept recall is enabled for `ask`, non-exact `search`, and bounded MCP +`query_graph` / `search_symbols`. Engineering synonyms such as authorization → +authz/permission/policy are ranked alternatives. Matching Markdown sections +follow published containment and reference edges to code; missing or ambiguous +mentions never invent a target. The optional `conceptMatches` array in +`compass.query/1` records `nodeId`, `method`, `query`, `matched`, and the document +ID path `via`. Text headlines label these results approximate. Strict +`search --exact` and exact structured symbol resolution retain their contracts. + +`compass ask QUESTION --semantic-search` and `compass search QUERY +--semantic-search` opt into an offline latent-semantic fallback after name and +synonym recall fail. MCP uses `semantic_search: true` on `query_graph` or +`search_symbols`; each request defaults to false. This cannot be combined with +exact lookup or legacy traversal controls. The graph's names, retained +Python rationale/docstring excerpts, and document excerpts provide the corpus. +TF-IDF and deterministic truncated-SVD embeddings are learned locally and cached +for that immutable engine. There is no model download, credential, network call, +or vector database. It can bridge vocabulary that co-occurs in the graph; an +unknown corpus term has no semantic match. Results use `semantic_lsa` provenance +and never change structural evidence confidence. + +Synonym recall uses at most 12 alternatives and 768 posting candidates per +alternative, with a shared indexed-read ceiling. Ranking precedes the retained +candidate cap; truncation is reported. Compact code names, matching filenames, +question context and implementation kinds are ranking hints, not proof of +meaning. Data-transfer/error declarations and test code rank lower. + +Semantic construction fails explicitly above 32,768 nodes, 64 MiB of canonical +node payload, 8,192 terms, or one million sparse entries. Build a smaller scoped +graph or omit the flag when a limit is reached. Document/rationale excerpts are +bounded to 4 KiB; prose indexes retain at most 512 normalized terms per node. +Older graphs retain their existing names/links until rebuilt; see +[MIGRATION.md](../../MIGRATION.md). + CompassQL: ```text diff --git a/fixtures/contracts/compass-query-v1.fingerprint b/fixtures/contracts/compass-query-v1.fingerprint index 6d3bdbb2..8ecbfd19 100644 --- a/fixtures/contracts/compass-query-v1.fingerprint +++ b/fixtures/contracts/compass-query-v1.fingerprint @@ -1 +1 @@ -sha256:e5dd8bf0ad65e1ce5e4a159ee0d8cd43d74fc1fe39ac58d7107025ad0d3481cf +sha256:2581180a6b63706c403447e6ee5355a14524ab4bdadac7d1858f844a1533b7f0 diff --git a/fixtures/contracts/compass-query-v1.manifest.json b/fixtures/contracts/compass-query-v1.manifest.json index 37392909..fa4f9869 100644 --- a/fixtures/contracts/compass-query-v1.manifest.json +++ b/fixtures/contracts/compass-query-v1.manifest.json @@ -10,13 +10,15 @@ "evidenceOrigin": ["ast", "config", "convention", "artifact", "heuristic"], "confidence": ["exact", "inferred", "ambiguous"], "resolution": ["exact", "ambiguous", "unresolved"], + "conceptMatchMethod": ["synonym", "document_link", "semantic_lsa"], "diagnosticCode": ["no_match", "ambiguous_match", "relationship_inconsistency", "direction_mismatch", "unresolved_handler", "incomplete_coverage", "stale_source_digest", "bounded_truncation", "program_orphan", "program_conflict", "program_unavailable"] }, "fields": { - "response": ["schema", "operation", "results", "nodes", "edges", "files", "paths", "diagnostics", "limits", "truncated"], + "response": ["schema", "operation", "results", "nodes", "edges", "files", "paths", "diagnostics", "limits", "truncated", "conceptMatches"], "limits": ["maxDepth", "maxNodes", "maxEdges", "maxPaths", "maxCandidates", "maxSourceBytes", "maxResponseBytes"], "sourceAnchor": ["file", "startByte", "endByte", "startLine", "startColumn", "endLine", "endColumn"], "evidence": ["layer", "origin", "extractor", "confidence", "anchor", "rule", "wiringSite", "resolution", "candidates"], + "conceptMatch": ["nodeId", "method", "query", "matched", "via"], "candidate": ["nodeId", "reason", "confidence", "score", "anchor"], "node": ["id", "kind", "roles", "name", "qualifiedName", "language", "framework", "source", "details", "evidence"], "edge": ["id", "source", "target", "kind", "relationshipSite", "details", "evidence"], diff --git a/packages/compass-viewer/src/contracts/codeQuery.test.ts b/packages/compass-viewer/src/contracts/codeQuery.test.ts index ce8d190e..ed9d308f 100644 --- a/packages/compass-viewer/src/contracts/codeQuery.test.ts +++ b/packages/compass-viewer/src/contracts/codeQuery.test.ts @@ -4,6 +4,7 @@ import { resolve } from "node:path"; import { describe, expect, it } from "vitest"; import { CODE_QUERY_CONTRACT_MANIFEST, + CodeNodeDetailsSchema, CodeRouteStageSchema, CodeQueryResponseSchema, decodeCodeQueryResponse @@ -16,6 +17,14 @@ function example(): unknown { } describe("compass.query/1", () => { + it("bounds resource prose in UTF-8 bytes and rejects other resource kinds", () => { + const resource = (resourceKind: string, content: string) => ({ + type: "resource", data: { resourceKind, content } + }); + expect(CodeNodeDetailsSchema.safeParse(resource("document", "界".repeat(1365))).success).toBe(true); + expect(CodeNodeDetailsSchema.safeParse(resource("rationale", "界".repeat(1366))).success).toBe(false); + expect(CodeNodeDetailsSchema.safeParse(resource("image", "prose")).success).toBe(false); + }); it("decodes the checked-in Rust example and fingerprints the shared manifest", () => { expect(decodeCodeQueryResponse(example()).schema).toBe("compass.query/1"); const manifestBytes = readFileSync(`${contracts}/compass-query-v1.manifest.json`); @@ -59,6 +68,14 @@ describe("compass.query/1", () => { expect(CodeRouteStageSchema.safeParse("authorization").success).toBe(false); }); + it("accepts typed concept provenance while rejecting unknown methods", () => { + const value = example() as Record; + value.conceptMatches = [{ nodeId: "n", method: "synonym", query: "authorization", matched: "authz", via: [] }]; + expect(decodeCodeQueryResponse(value).conceptMatches?.[0]?.method).toBe("synonym"); + value.conceptMatches = [{ nodeId: "n", method: "future", query: "q", matched: "x", via: [] }]; + expect(CodeQueryResponseSchema.safeParse(value).success).toBe(false); + }); + it("accepts dependency and security route stages", () => { expect(CodeRouteStageSchema.parse("dependency")).toBe("dependency"); expect(CodeRouteStageSchema.parse("security")).toBe("security"); diff --git a/packages/compass-viewer/src/contracts/codeQuery.ts b/packages/compass-viewer/src/contracts/codeQuery.ts index d89f6887..e56b9bb3 100644 --- a/packages/compass-viewer/src/contracts/codeQuery.ts +++ b/packages/compass-viewer/src/contracts/codeQuery.ts @@ -50,6 +50,7 @@ export const CODE_QUERY_CONTRACT_MANIFEST = { evidenceOrigin: ["ast", "config", "convention", "artifact", "heuristic"], confidence: ["exact", "inferred", "ambiguous"], resolution: ["exact", "ambiguous", "unresolved"], + conceptMatchMethod: ["synonym", "document_link", "semantic_lsa"], diagnosticCode: [ "no_match", "ambiguous_match", "relationship_inconsistency", "direction_mismatch", "unresolved_handler", "incomplete_coverage", "stale_source_digest", "bounded_truncation", "program_orphan", @@ -59,7 +60,7 @@ export const CODE_QUERY_CONTRACT_MANIFEST = { fields: { response: [ "schema", "operation", "results", "nodes", "edges", "files", "paths", - "diagnostics", "limits", "truncated" + "diagnostics", "limits", "truncated", "conceptMatches" ], limits: [ "maxDepth", "maxNodes", "maxEdges", "maxPaths", "maxCandidates", @@ -73,6 +74,7 @@ export const CODE_QUERY_CONTRACT_MANIFEST = { "layer", "origin", "extractor", "confidence", "anchor", "rule", "wiringSite", "resolution", "candidates" ], + conceptMatch: ["nodeId", "method", "query", "matched", "via"], candidate: ["nodeId", "reason", "confidence", "score", "anchor"], node: [ "id", "kind", "roles", "name", "qualifiedName", "language", "framework", @@ -200,8 +202,15 @@ const ResourceNodeDetailsSchema = z.strictObject({ data: z.strictObject({ resourceKind: z.enum(["document", "paper", "image", "concept", "rationale"]), uri: z.string().nullable().optional(), - mediaType: z.string().nullable().optional() - }) + mediaType: z.string().nullable().optional(), + content: z.string().max(4096).refine( + (value) => new TextEncoder().encode(value).length <= 4096, + "Resource content exceeds 4096 UTF-8 bytes" + ).nullable().optional() + }).refine( + (data) => data.content == null || ["document", "rationale"].includes(data.resourceKind), + "Only document and rationale resources contain prose" + ) }); const MessagingNodeDetailsSchema = z.strictObject({ type: z.literal("messaging"), @@ -379,6 +388,13 @@ export const CodeQueryResponseSchema = z.strictObject({ edges: z.array(CodeQueryEdgeSchema), files: z.array(CodeQueryFileSchema), paths: z.array(CodeQueryPathSchema), + conceptMatches: z.array(z.strictObject({ + nodeId: z.string(), + method: z.enum(["synonym", "document_link", "semantic_lsa"]), + query: z.string(), + matched: z.string(), + via: z.array(z.string()) + })).optional(), diagnostics: z.array(CodeQueryDiagnosticSchema), limits: CodeQueryLimitsSchema, truncated: z.boolean() diff --git a/scripts/qualify_concept_search.py b/scripts/qualify_concept_search.py new file mode 100644 index 00000000..98969540 --- /dev/null +++ b/scripts/qualify_concept_search.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python3 +"""Evaluate pinned concept questions against native query_batch responses.""" +import argparse +import json +from pathlib import Path + +MAX_BYTES = 64 * 1024 * 1024 + + +def read(path): + with path.open("rb") as source: + data = source.read(MAX_BYTES + 1) + if len(data) > MAX_BYTES: + raise ValueError(f"{path}: input exceeds 64 MiB") + return json.loads(data) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("corpus", type=Path) + parser.add_argument("--responses", type=Path) + args = parser.parse_args() + corpus = read(args.corpus) + cases = corpus["cases"] + if corpus["schema"] != "compass.concept-qualification/1" or not 1 <= len(cases) <= 32: + raise ValueError("unsupported corpus schema or question count") + if args.responses is None: + print(json.dumps([{"operation": "ask", "symbol": case["question"]} for case in cases])) + return 0 + responses = read(args.responses) + if len(responses) != len(cases): + raise ValueError("response count does not match pinned question count") + rows = [] + for case, response in zip(cases, responses): + if response["schema"] != "compass.query/1": + raise ValueError("unsupported native response schema") + nodes = {node["id"]: node for node in response["nodes"]} + paths = [] + for hit in response["results"]: + node = nodes[hit["nodeId"]] + source = node.get("source") + if source is None: + continue + path = source["file"] + if any(part in {"tests", "test", "fixtures", "mocks"} for part in Path(path).parts): + continue + if path not in paths: + paths.append(path) + if len(paths) == 3: + break + correct = [any(path.startswith(prefix) for prefix in case["expected_paths"]) for path in paths] + rows.append({"question": case["question"], "top_paths": paths, "top_one": bool(correct and correct[0]), "top_three": any(correct), "truncated": response["truncated"]}) + report = {"schema": "compass.concept-qualification-report/1", "repository": corpus["repository"], "commit": corpus["commit"], "correct_top_one": sum(row["top_one"] for row in rows), "correct_top_three": sum(row["top_three"] for row in rows), "questions": len(rows), "minimum_correct": corpus["minimum_correct"], "cases": rows} + print(json.dumps(report, indent=2)) + return 0 if report["correct_top_three"] >= corpus["minimum_correct"] else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/tests/qualification/concept-search-dify.json b/tests/qualification/concept-search-dify.json new file mode 100644 index 00000000..6033e818 --- /dev/null +++ b/tests/qualification/concept-search-dify.json @@ -0,0 +1,235 @@ +{ + "schema": "compass.concept-qualification/1", + "repository": "https://github.com/langgenius/dify", + "commit": "1a918ea407990ecd2156af2614932db8c9c43091", + "root": "api", + "author": "agent-authored novice-style questions; expected modules established by source inspection before querying", + "criterion": "correct if one of first three distinct production source paths starts with an expected prefix; also report top-one accuracy", + "minimum_correct": 24, + "cases": [ + { + "question": "How does authorization work?", + "expected_paths": [ + "libs/workspace_permission.py", + "controllers/common/wraps.py", + "controllers/console/wraps.py" + ] + }, + { + "question": "Where is access control enforced?", + "expected_paths": [ + "libs/workspace_permission.py", + "controllers/common/wraps.py", + "controllers/console/wraps.py" + ] + }, + { + "question": "What checks workspace permissions?", + "expected_paths": [ + "libs/workspace_permission.py", + "controllers/common/wraps.py", + "controllers/console/wraps.py" + ] + }, + { + "question": "How does authentication work?", + "expected_paths": [ + "extensions/ext_login.py", + "libs/login.py", + "services/account/login_service.py", + "controllers/console/auth/" + ] + }, + { + "question": "Where does a user sign in?", + "expected_paths": [ + "extensions/ext_login.py", + "libs/login.py", + "services/account/login_service.py", + "controllers/console/auth/" + ] + }, + { + "question": "What handles OAuth authentication?", + "expected_paths": [ + "libs/oauth.py", + "controllers/console/auth/oauth.py", + "services/account/oauth_service.py" + ] + }, + { + "question": "Where is configuration loaded?", + "expected_paths": [ + "configs/" + ] + }, + { + "question": "How are environment variables read?", + "expected_paths": [ + "configs/" + ] + }, + { + "question": "What handles persistence?", + "expected_paths": [ + "repositories/", + "extensions/ext_database.py" + ] + }, + { + "question": "Where is database access implemented?", + "expected_paths": [ + "repositories/", + "extensions/ext_database.py" + ] + }, + { + "question": "Where is uploaded file validation implemented?", + "expected_paths": [ + "factories/file_factory/validation.py", + "factories/file_factory/", + "services/file_service.py" + ] + }, + { + "question": "What implements request throttling?", + "expected_paths": [ + "libs/rate_limit.py", + "libs/helper.py", + "core/app/features/rate_limiting/" + ] + }, + { + "question": "How does rate limiting work?", + "expected_paths": [ + "libs/rate_limit.py", + "libs/helper.py", + "core/app/features/rate_limiting/" + ] + }, + { + "question": "Where do background jobs run?", + "expected_paths": [ + "tasks/", + "extensions/ext_celery.py" + ] + }, + { + "question": "How are recurring jobs scheduled?", + "expected_paths": [ + "schedule/", + "extensions/ext_celery.py" + ] + }, + { + "question": "How does caching work?", + "expected_paths": [ + "extensions/ext_redis.py", + "core/rag/embedding/cached_embedding.py", + "core/helper/" + ] + }, + { + "question": "What handles database transactions?", + "expected_paths": [ + "extensions/ext_database.py", + "repositories/" + ] + }, + { + "question": "Where are feature flags checked?", + "expected_paths": [ + "services/feature_query_service.py", + "configs/feature/", + "models/model.py" + ] + }, + { + "question": "How does observability work?", + "expected_paths": [ + "core/telemetry/", + "services/telemetry_service.py", + "extensions/ext_otel.py", + "extensions/ext_enterprise_telemetry.py" + ] + }, + { + "question": "Where is application logging configured?", + "expected_paths": [ + "extensions/ext_logging.py", + "core/logging/" + ] + }, + { + "question": "What prevents simultaneous database migrations?", + "expected_paths": [ + "libs/db_migration_lock.py" + ] + }, + { + "question": "What handles transient database failures?", + "expected_paths": [ + "services/retention/workflow_run/db_retry.py" + ] + }, + { + "question": "How are request timeouts configured?", + "expected_paths": [ + "configs/" + ] + }, + { + "question": "Where are stored credentials encrypted?", + "expected_paths": [ + "libs/rsa.py", + "core/helper/encrypter.py", + "libs/key_providers/" + ] + }, + { + "question": "What handles file uploads?", + "expected_paths": [ + "services/file_service.py", + "factories/file_factory/" + ] + }, + { + "question": "How does email delivery work?", + "expected_paths": [ + "extensions/ext_mail.py", + "tasks/mail_", + "libs/email_template_renderer.py" + ] + }, + { + "question": "What implements result paging?", + "expected_paths": [ + "libs/pagination.py", + "libs/infinite_scroll_pagination.py" + ] + }, + { + "question": "Where are subscription payments handled?", + "expected_paths": [ + "services/billing_service.py", + "services/billing_portal_service.py", + "controllers/console/billing/" + ] + }, + { + "question": "Where are health checks implemented?", + "expected_paths": [ + "celery_healthcheck.py" + ] + }, + { + "question": "How does data retention work?", + "expected_paths": [ + "services/retention/", + "tasks/", + "schedule/", + "configs/" + ] + } + ] +}